code: @POST
      @Path("/accept_oauth")
      @Produces(MediaType.APPLICATION_JSON)
      @Consumes(MediaType.APPLICATION_JSON)
      @Description("Approves user for oauth based access.")
      public OAuthAcceptResponseDto accept(OAuthAcceptDto acceptDto, @Context HttpServletRequest request) {
          if(StringUtils.isBlank(acceptDto.getCode())) {
              throw new OAuthException(ResponseCodes.INVALID_AUTH_CODE, HttpResponseStatus.BAD_REQUEST);
          }
          if(StringUtils.isBlank(acceptDto.getState())) {
              throw new OAuthException(ResponseCodes.INVALID_STATE, HttpResponseStatus.BAD_REQUEST);
          }
  
          // Check if authorization code and state is valid, no need to check expiry as it might have been invalidated by token query
          OAuthAuthorizationCode oauthAuthorizationCode = authService.findByCodeAndState(acceptDto.getCode(), acceptDto.getState());
          if (oauthAuthorizationCode == null) {
              throw new OAuthException(ResponseCodes.INVALID_AUTH_CODE_OR_STATE, HttpResponseStatus.BAD_REQUEST);
          }
  
          String userName=findUserByToken(request);
          if(Boolean.valueOf(invalidateAuthCodeAfterUse)) {
              authService.deleteExpiredAuthCodesByUserName(new Timestamp(System.currentTimeMillis()),userName);
          }
  
          // updates userid in oauth_authorization_codes table
          int updateResult = authService.updateUserId(acceptDto.getCode(), acceptDto.getState(), userName);
          if(updateResult == 0) {
              throw new OAuthException(ResponseCodes.INVALID_AUTH_CODE, HttpResponseStatus.BAD_REQUEST);
          }
  
          OAuthAcceptResponseDto responseDto = new OAuthAcceptResponseDto();
          responseDto.setRedirectURI(oauthAuthorizationCode.getRedirectUri());
  
          return responseDto ;
      }
docs: Method to accept oauth access by third party applications. This method associates authorization_code with the logged in username.
  @param acceptDto Json Object which contains information for granting permission for an app to use argus OAuth resources
  @param request   The Http Request with authorization header
  @return OAuthAcceptResponseDto  Json Object which is returned after user grants an application to access argus oauth resources