gluu
公開メンバ関数 | 非公開メンバ関数 | 非公開変数類 | 全メンバ一覧
org.xdi.oxauth.authorize.ws.rs.AuthorizeRestWebServiceImpl クラス
org.xdi.oxauth.authorize.ws.rs.AuthorizeRestWebServiceImpl の継承関係図
Inheritance graph
org.xdi.oxauth.authorize.ws.rs.AuthorizeRestWebServiceImpl 連携図
Collaboration graph

公開メンバ関数

Response requestAuthorizationGet (String scope, String responseType, String clientId, String redirectUri, String state, String responseMode, String nonce, String display, String prompt, Integer maxAge, String uiLocales, String idTokenHint, String loginHint, String acrValues, String amrValues, String request, String requestUri, String requestSessionId, String sessionId, String accessToken, String originHeaders, String codeChallenge, String codeChallengeMethod, String customResponseHeaders, String claims, HttpServletRequest httpRequest, HttpServletResponse httpResponse, SecurityContext securityContext)
 
Response requestAuthorizationPost (String scope, String responseType, String clientId, String redirectUri, String state, String responseMode, String nonce, String display, String prompt, Integer maxAge, String uiLocales, String idTokenHint, String loginHint, String acrValues, String amrValues, String request, String requestUri, String requestSessionId, String sessionId, String accessToken, String originHeaders, String codeChallenge, String codeChallengeMethod, String customResponseHeaders, String claims, HttpServletRequest httpRequest, HttpServletResponse httpResponse, SecurityContext securityContext)
 
Response requestAuthorization (String scope, String responseType, String clientId, String redirectUri, String state, String respMode, String nonce, String display, String prompt, Integer maxAge, String uiLocalesStr, String idTokenHint, String loginHint, String acrValuesStr, String amrValuesStr, String request, String requestUri, String requestSessionId, String sessionId, String accessToken, String method, String originHeaders, String codeChallenge, String codeChallengeMethod, String customRespHeaders, String claims, HttpServletRequest httpRequest, HttpServletResponse httpResponse, SecurityContext securityContext)
 
Response requestAuthorizationGet ( @QueryParam("scope") @ApiParam(value="OpenID Connect requests MUST contain the openid scope value. If the openid scope value is not present, the behavior is entirely unspecified. Other scope values MAY be present. Scope values used that are not understood by an implementation SHOULD be ignored.", required=true) String scope, @QueryParam("response_type") @ApiParam(value="OAuth 2.0 Response Type value that determines the authorization processing flow to be used, including what parameters are returned from the endpoints used. When using the Authorization Code Flow, this value is code. ", required=true) String responseType, @QueryParam("client_id") @ApiParam(value="OAuth 2.0 Client Identifier valid at the Authorization Server.", required=true) String clientId, @QueryParam("redirect_uri") @ApiParam(value="Redirection URI to which the response will be sent. This URI MUST exactly match one of the Redirection URI values for the Client pre-registered at the OpenID Provider", required=true) String redirectUri, @QueryParam("state") @ApiParam(value="Opaque value used to maintain state between the request and the callback. Typically, Cross-Site Request Forgery (CSRF, XSRF) mitigation is done by cryptographically binding the value of this parameter with a browser cookie. ", required=false) String state, @QueryParam("response_mode") @ApiParam(value="Informs the Authorization Server of the mechanism to be used for returning parameters from the Authorization Endpoint. This use of this parameter is NOT RECOMMENDED when the Response Mode that would be requested is the default mode specified for the Response Type. ", required=false) String responseMode, @QueryParam("nonce") @ApiParam(value="String value used to associate a Client session with an ID Token, and to mitigate replay attacks. The value is passed through unmodified from the Authorization Request to the ID Token. Sufficient entropy MUST be present in the nonce values used to prevent attackers from guessing values.", required=false) String nonce, @QueryParam("display") @ApiParam(value="ASCII string value that specifies how the Authorization Server displays the authentication and consent user interface pages to the End-User. The defined values are: page, popup, touch, wap", required=false) String display, @QueryParam("prompt") @ApiParam(value="Space delimited, case sensitive list of ASCII string values that specifies whether the Authorization Server prompts the End-User for reauthentication and consent. The defined values are: none, login, consent, select_account", required=false) String prompt, @QueryParam("max_age") @ApiParam(value="Maximum Authentication Age. Specifies the allowable elapsed time in seconds since the last time the End-User was actively authenticated by the OP. If the elapsed time is greater than this value, the OP MUST attempt to actively re-authenticate the End-User. (The max_age request parameter corresponds to the OpenID 2.0 PAPE [OpenID.PAPE] max_auth_age request parameter.) When max_age is used, the ID Token returned MUST include an auth_time Claim Value. ", required=false) Integer maxAge, @QueryParam("ui_locales") @ApiParam(value="End-User's preferred languages and scripts for the user interface, represented as a space-separated list of BCP47 [RFC5646] language tag values, ordered by preference. For instance, the value \r-CA fr en\represents a preference for French as spoken in Canada, then French (without a region designation), followed by English (without a region designation). An error SHOULD NOT result if some or all of the requested locales are not supported by the OpenID Provider. ", required=false) String uiLocales, @QueryParam("id_token_hint") @ApiParam(value="ID Token previously issued by the Authorization Server being passed as a hint about the End-User's current or past authenticated session with the Client. If the End-User identified by the ID Token is logged in or is logged in by the request, then the Authorization Server returns a positive response; otherwise, it SHOULD return an error, such as login_required. When possible, an id_token_hint SHOULD be present when prompt=none is used and an invalid_request error MAY be returned if it is not; however, the server SHOULD respond successfully when possible, even if it is not present. The Authorization Server need not be listed as an audience of the ID Token when it is used as an id_token_hint value. ", required=false) String idTokenHint, @QueryParam("login_hint") @ApiParam(value="Hint to the Authorization Server about the login identifier the End-User might use to log in (if necessary). This hint can be used by an RP if it first asks the End-User for their e-mail address (or other identifier) and then wants to pass that value as a hint to the discovered authorization service. It is RECOMMENDED that the hint value match the value used for discovery. This value MAY also be a phone number in the format specified for the phone_number Claim. The use of this parameter is left to the OP's discretion. ", required=false) String loginHint, @QueryParam("acr_values") @ApiParam(value="Requested Authentication Context Class Reference values. Space-separated string that specifies the acr values that the Authorization Server is being requested to use for processing this Authentication Request, with the values appearing in order of preference. The Authentication Context Class satisfied by the authentication performed is returned as the acr Claim Value, as specified in Section 2. The acr Claim is requested as a Voluntary Claim by this parameter. ", required=false) String acrValues, @QueryParam("amr_values") @ApiParam(value="AMR Values", required=false) String amrValues, @QueryParam("request") @ApiParam(value="This parameter enables OpenID Connect requests to be passed in a single, self-contained parameter and to be optionally signed and/or encrypted. The parameter value is a Request Object value, as specified in Section 6.1. It represents the request as a JWT whose Claims are the request parameters.", required=false) String request, @QueryParam("request_uri") @ApiParam(value="This parameter enables OpenID Connect requests to be passed by reference, rather than by value. The request_uri value is a URL using the https scheme referencing a resource containing a Request Object value, which is a JWT containing the request parameters. ", required=false) String requestUri, @QueryParam("request_session_id") @ApiParam(value="Request session id", required=false) String requestSessionId, @QueryParam("session_id") @ApiParam(value="Session id of this call", required=false) String sessionId, @QueryParam("access_token") @ApiParam(value="Access token", required=false) String accessToken, @QueryParam("origin_headers") @ApiParam(value="Origin headers. Used in custom workflows.", required=false) String originHeaders, @QueryParam("code_challenge") @ApiParam(value="PKCE code challenge.", required=false) String codeChallenge, @QueryParam("code_challenge_method") @ApiParam(value="PKCE code challenge method.", required=false) String codeChallengeMethod, @QueryParam(AuthorizeRequestParam.CUSTOM_RESPONSE_HEADERS) @ApiParam(value="Custom Response Headers.", required=false) String customResponseHeaders, @QueryParam("claims") @ApiParam(value="Requested Claims.", required=false) String claims, @Context HttpServletRequest httpRequest, @Context HttpServletResponse httpResponse, @Context SecurityContext securityContext)
 
Response requestAuthorizationPost ( @FormParam("scope") @ApiParam(value="OpenID Connect requests MUST contain the openid scope value. If the openid scope value is not present, the behavior is entirely unspecified. Other scope values MAY be present. Scope values used that are not understood by an implementation SHOULD be ignored.", required=true) String scope, @FormParam("response_type") @ApiParam(value="OAuth 2.0 Response Type value that determines the authorization processing flow to be used, including what parameters are returned from the endpoints used. When using the Authorization Code Flow, this value is code. ", required=true) String responseType, @FormParam("client_id") @ApiParam(value="OAuth 2.0 Client Identifier valid at the Authorization Server. ", required=true) String clientId, @FormParam("redirect_uri") @ApiParam(value="Redirection URI to which the response will be sent. This URI MUST exactly match one of the Redirection URI values for the Client pre-registered at the OpenID Provider", required=true) String redirectUri, @FormParam("state") @ApiParam(value="Opaque value used to maintain state between the request and the callback. Typically, Cross-Site Request Forgery (CSRF, XSRF) mitigation is done by cryptographically binding the value of this parameter with a browser cookie. ", required=false) String state, @QueryParam("response_mode") @ApiParam(value="Informs the Authorization Server of the mechanism to be used for returning parameters from the Authorization Endpoint. This use of this parameter is NOT RECOMMENDED when the Response Mode that would be requested is the default mode specified for the Response Type. ", required=false) String responseMode, @FormParam("nonce") @ApiParam(value="String value used to associate a Client session with an ID Token, and to mitigate replay attacks. The value is passed through unmodified from the Authorization Request to the ID Token. Sufficient entropy MUST be present in the nonce values used to prevent attackers from guessing values.", required=false) String nonce, @FormParam("display") @ApiParam(value="ASCII string value that specifies how the Authorization Server displays the authentication and consent user interface pages to the End-User. The defined values are: page, popup, touch, wap", required=false) String display, @FormParam("prompt") @ApiParam(value="Space delimited, case sensitive list of ASCII string values that specifies whether the Authorization Server prompts the End-User for reauthentication and consent. The defined values are: none, login, consent, select_account", required=false) String prompt, @FormParam("max_age") @ApiParam(value="Maximum Authentication Age. Specifies the allowable elapsed time in seconds since the last time the End-User was actively authenticated by the OP. If the elapsed time is greater than this value, the OP MUST attempt to actively re-authenticate the End-User. (The max_age request parameter corresponds to the OpenID 2.0 PAPE [OpenID.PAPE] max_auth_age request parameter.) When max_age is used, the ID Token returned MUST include an auth_time Claim Value. ", required=false) Integer maxAge, @FormParam("ui_locales") @ApiParam(value="End-User's preferred languages and scripts for the user interface, represented as a space-separated list of BCP47 [RFC5646] language tag values, ordered by preference. For instance, the value \r-CA fr en\represents a preference for French as spoken in Canada, then French (without a region designation), followed by English (without a region designation). An error SHOULD NOT result if some or all of the requested locales are not supported by the OpenID Provider. ", required=false) String uiLocales, @FormParam("id_token_hint") @ApiParam(value="ID Token previously issued by the Authorization Server being passed as a hint about the End-User's current or past authenticated session with the Client. If the End-User identified by the ID Token is logged in or is logged in by the request, then the Authorization Server returns a positive response; otherwise, it SHOULD return an error, such as login_required. When possible, an id_token_hint SHOULD be present when prompt=none is used and an invalid_request error MAY be returned if it is not; however, the server SHOULD respond successfully when possible, even if it is not present. The Authorization Server need not be listed as an audience of the ID Token when it is used as an id_token_hint value. ", required=false) String idTokenHint, @FormParam("login_hint") @ApiParam(value="Hint to the Authorization Server about the login identifier the End-User might use to log in (if necessary). This hint can be used by an RP if it first asks the End-User for their e-mail address (or other identifier) and then wants to pass that value as a hint to the discovered authorization service. It is RECOMMENDED that the hint value match the value used for discovery. This value MAY also be a phone number in the format specified for the phone_number Claim. The use of this parameter is left to the OP's discretion. ", required=false) String loginHint, @FormParam("acr_values") @ApiParam(value="Requested Authentication Context Class Reference values. Space-separated string that specifies the acr values that the Authorization Server is being requested to use for processing this Authentication Request, with the values appearing in order of preference. The Authentication Context Class satisfied by the authentication performed is returned as the acr Claim Value, as specified in Section 2. The acr Claim is requested as a Voluntary Claim by this parameter. ", required=false) String acrValues, @FormParam("amr_values") @ApiParam(value="AMR Values", required=false) String amrValues, @FormParam("request") @ApiParam(value="This parameter enables OpenID Connect requests to be passed in a single, self-contained parameter and to be optionally signed and/or encrypted. The parameter value is a Request Object value, as specified in Section 6.1. It represents the request as a JWT whose Claims are the request parameters.", required=false) String request, @FormParam("request_uri") @ApiParam(value="This parameter enables OpenID Connect requests to be passed by reference, rather than by value. The request_uri value is a URL using the https scheme referencing a resource containing a Request Object value, which is a JWT containing the request parameters. ", required=false) String requestUri, @FormParam("request_session_id") @ApiParam(value="Request session id", required=false) String requestSessionId, @FormParam("session_id") @ApiParam(value="Session id of this call", required=false) String sessionId, @FormParam("access_token") @ApiParam(value="Access token", required=false) String accessToken, @FormParam("origin_headers") @ApiParam(value="Origin headers. Used in custom workflows.", required=false) String originHeaders, @QueryParam("code_challenge") @ApiParam(value="PKCE code challenge.", required=false) String codeChallenge, @QueryParam("code_challenge_method") @ApiParam(value="PKCE code challenge method.", required=false) String codeChallengeMethod, @QueryParam(AuthorizeRequestParam.CUSTOM_RESPONSE_HEADERS) @ApiParam(value="Custom Response Headers.", required=false) String customResponseHeaders, @QueryParam("claims") @ApiParam(value="Requested Claims.", required=false) String claims, @Context HttpServletRequest httpRequest, @Context HttpServletResponse httpResponse, @Context SecurityContext securityContext)
 

非公開メンバ関数

void overrideUnauthenticatedSessionParameters (HttpServletRequest httpRequest, List< Prompt > prompts)
 
Map< String, String > getGenericRequestMap (HttpServletRequest httpRequest)
 
ResponseBuilder error (Response.Status p_status, AuthorizeErrorResponseType p_type, String p_state)
 
void redirectToAuthorizationPage (RedirectUri redirectUriResponse, List< ResponseType > responseTypes, String scope, String clientId, String redirectUri, String state, ResponseMode responseMode, String nonce, String display, List< Prompt > prompts, Integer maxAge, List< String > uiLocales, String idTokenHint, String loginHint, List< String > acrValues, List< String > amrValues, String request, String requestUri, String originHeaders, String codeChallenge, String codeChallengeMethod, String sessionId, String claims, Map< String, String > customParameters)
 
void endSession (String sessionId, HttpServletRequest httpRequest, HttpServletResponse httpResponse)
 

非公開変数類

Logger log
 
ApplicationAuditLogger applicationAuditLogger
 
ErrorResponseFactory errorResponseFactory
 
RedirectionUriService redirectionUriService
 
AuthorizationGrantList authorizationGrantList
 
ClientService clientService
 
UserService userService
 
Identity identity
 
AuthenticationFilterService authenticationFilterService
 
SessionIdService sessionIdService
 
ScopeChecker scopeChecker
 
ClientAuthorizationsService clientAuthorizationsService
 
RequestParameterService requestParameterService
 
AppConfiguration appConfiguration
 

詳解

Implementation for request authorization through REST web services.

著者
Javier Rojas Blum
バージョン
January 17, 2018

関数詳解

◆ endSession()

void org.xdi.oxauth.authorize.ws.rs.AuthorizeRestWebServiceImpl.endSession ( String  sessionId,
HttpServletRequest  httpRequest,
HttpServletResponse  httpResponse 
)
inlineprivate
860  {
861  SessionId sessionUser = identity.getSessionId();
862 
863  identity.logout();
864 
865  if (sessionUser != null) {
866  sessionUser.setUserDn(null);
867  sessionUser.setAuthenticationTime(null);
868  }
869 
870 
871  String id = sessionId;
872  if (StringHelper.isEmpty(id)) {
873  id = sessionIdService.getSessionIdFromCookie(httpRequest);
874  }
875 
876  if (StringHelper.isNotEmpty(id)) {
877  SessionId ldapSessionId = sessionIdService.getSessionId(id);
878  if (ldapSessionId != null) {
879  boolean result = sessionIdService.remove(ldapSessionId);
880  if (!result) {
881  log.error("Failed to remove session_id '{}' from LDAP", id);
882  }
883  } else {
884  log.error("Failed to load session from LDAP by session_id: '{}'", id);
885  }
886  }
887 
889  }
void removeSessionIdCookie(HttpServletResponse httpResponse)
Definition: SessionIdService.java:339
SessionId getSessionId()
Definition: SessionIdService.java:360
SessionId getSessionId()
Definition: Identity.java:30
Identity identity
Definition: AuthorizeRestWebServiceImpl.java:126
Logger log
Definition: AuthorizeRestWebServiceImpl.java:105
boolean remove(SessionId sessionId)
Definition: SessionIdService.java:683
SessionIdService sessionIdService
Definition: AuthorizeRestWebServiceImpl.java:132
String getSessionIdFromCookie(HttpServletRequest request)
Definition: SessionIdService.java:237

◆ error()

ResponseBuilder org.xdi.oxauth.authorize.ws.rs.AuthorizeRestWebServiceImpl.error ( Response.Status  p_status,
AuthorizeErrorResponseType  p_type,
String  p_state 
)
inlineprivate
761  {
762  return Response.status(p_status.getStatusCode()).entity(errorResponseFactory.getErrorAsJson(p_type, p_state));
763  }
String getErrorAsJson(IErrorType p_type)
Definition: ErrorResponseFactory.java:86
ErrorResponseFactory errorResponseFactory
Definition: AuthorizeRestWebServiceImpl.java:111

◆ getGenericRequestMap()

Map<String, String> org.xdi.oxauth.authorize.ws.rs.AuthorizeRestWebServiceImpl.getGenericRequestMap ( HttpServletRequest  httpRequest)
inlineprivate
752  {
753  Map<String, String> result = new HashMap<String, String>();
754  for (Entry<String, String[]> entry : httpRequest.getParameterMap().entrySet()) {
755  result.put(entry.getKey(), entry.getValue()[0]);
756  }
757 
758  return result;
759  }

◆ overrideUnauthenticatedSessionParameters()

void org.xdi.oxauth.authorize.ws.rs.AuthorizeRestWebServiceImpl.overrideUnauthenticatedSessionParameters ( HttpServletRequest  httpRequest,
List< Prompt prompts 
)
inlineprivate

1) https://ce-dev.gluu.org/oxauth/authorize -> session created with parameter list 1 2) https://ce-dev.gluu.org/oxauth/restv1/authorize -> with parameter list 2

Second call will try to reuse session data from call 1 (parameter list1). Here we overriding them.

引数
httpRequesthttp request
promptsprompts
731  {
732  SessionId sessionUser = identity.getSessionId();
733  if (sessionUser != null && sessionUser.getState() != SessionIdState.AUTHENTICATED) {
734  Map<String, String> genericRequestMap = getGenericRequestMap(httpRequest);
735 
736  Map<String, String> parameterMap = Maps.newHashMap(genericRequestMap);
737  Map<String, String> requestParameterMap = requestParameterService.getAllowedParameters(parameterMap);
738 
739  sessionUser.setUserDn(null);
740  sessionUser.setSessionAttributes(requestParameterMap);
741  boolean persisted = sessionIdService.persistSessionId(sessionUser, !prompts.contains(Prompt.NONE));
742  if (persisted) {
743  if (log.isTraceEnabled()) {
744  log.trace("Session '{}' persisted to LDAP", sessionUser.getId());
745  }
746  } else {
747  log.error("Failed to persisted session: {}", sessionUser.getId());
748  }
749  }
750  }
SessionId getSessionId()
Definition: Identity.java:30
boolean persistSessionId(final SessionId sessionId)
Definition: SessionIdService.java:510
Map< String, String > getAllowedParameters(@Nonnull final Map< String, String > requestParameterMap)
Definition: RequestParameterService.java:81
Identity identity
Definition: AuthorizeRestWebServiceImpl.java:126
Logger log
Definition: AuthorizeRestWebServiceImpl.java:105
SessionIdService sessionIdService
Definition: AuthorizeRestWebServiceImpl.java:132
Map< String, String > getGenericRequestMap(HttpServletRequest httpRequest)
Definition: AuthorizeRestWebServiceImpl.java:752
RequestParameterService requestParameterService
Definition: AuthorizeRestWebServiceImpl.java:141

◆ redirectToAuthorizationPage()

void org.xdi.oxauth.authorize.ws.rs.AuthorizeRestWebServiceImpl.redirectToAuthorizationPage ( RedirectUri  redirectUriResponse,
List< ResponseType responseTypes,
String  scope,
String  clientId,
String  redirectUri,
String  state,
ResponseMode  responseMode,
String  nonce,
String  display,
List< Prompt prompts,
Integer  maxAge,
List< String >  uiLocales,
String  idTokenHint,
String  loginHint,
List< String >  acrValues,
List< String >  amrValues,
String  request,
String  requestUri,
String  originHeaders,
String  codeChallenge,
String  codeChallengeMethod,
String  sessionId,
String  claims,
Map< String, String >  customParameters 
)
inlineprivate
771  {
772 
773  redirectUriResponse.setBaseRedirectUri(appConfiguration.getAuthorizationPage());
774  redirectUriResponse.setResponseMode(ResponseMode.QUERY);
775 
776  // oAuth parameters
777  String responseType = implode(responseTypes, " ");
778  if (StringUtils.isNotBlank(responseType)) {
779  redirectUriResponse.addResponseParameter(AuthorizeRequestParam.RESPONSE_TYPE, responseType);
780  }
781  if (StringUtils.isNotBlank(scope)) {
782  redirectUriResponse.addResponseParameter(AuthorizeRequestParam.SCOPE, scope);
783  }
784  if (StringUtils.isNotBlank(clientId)) {
785  redirectUriResponse.addResponseParameter(AuthorizeRequestParam.CLIENT_ID, clientId);
786  }
787  if (StringUtils.isNotBlank(redirectUri)) {
788  redirectUriResponse.addResponseParameter(AuthorizeRequestParam.REDIRECT_URI, redirectUri);
789  }
790  if (StringUtils.isNotBlank(state)) {
791  redirectUriResponse.addResponseParameter(AuthorizeRequestParam.STATE, state);
792  }
793  if (responseMode != null) {
794  redirectUriResponse.addResponseParameter(AuthorizeRequestParam.RESPONSE_MODE, responseMode.getParamName());
795  }
796 
797  // OIC parameters
798  if (StringUtils.isNotBlank(nonce)) {
799  redirectUriResponse.addResponseParameter(AuthorizeRequestParam.NONCE, nonce);
800  }
801  if (StringUtils.isNotBlank(display)) {
802  redirectUriResponse.addResponseParameter(AuthorizeRequestParam.DISPLAY, display);
803  }
804  String prompt = implode(prompts, " ");
805  if (StringUtils.isNotBlank(prompt)) {
806  redirectUriResponse.addResponseParameter(AuthorizeRequestParam.PROMPT, prompt);
807  }
808  if (maxAge != null) {
809  redirectUriResponse.addResponseParameter(AuthorizeRequestParam.MAX_AGE, maxAge.toString());
810  }
811  String uiLocalesStr = implode(uiLocales, " ");
812  if (StringUtils.isNotBlank(uiLocalesStr)) {
813  redirectUriResponse.addResponseParameter(AuthorizeRequestParam.UI_LOCALES, uiLocalesStr);
814  }
815  if (StringUtils.isNotBlank(idTokenHint)) {
816  redirectUriResponse.addResponseParameter(AuthorizeRequestParam.ID_TOKEN_HINT, idTokenHint);
817  }
818  if (StringUtils.isNotBlank(loginHint)) {
819  redirectUriResponse.addResponseParameter(AuthorizeRequestParam.LOGIN_HINT, loginHint);
820  }
821  String acrValuesStr = implode(acrValues, " ");
822  if (StringUtils.isNotBlank(acrValuesStr)) {
823  redirectUriResponse.addResponseParameter(AuthorizeRequestParam.ACR_VALUES, acrValuesStr);
824  }
825  String amrValuesStr = implode(amrValues, " ");
826  if (StringUtils.isNotBlank(amrValuesStr)) {
827  redirectUriResponse.addResponseParameter(AuthorizeRequestParam.AMR_VALUES, amrValuesStr);
828  }
829  if (StringUtils.isNotBlank(request)) {
830  redirectUriResponse.addResponseParameter(AuthorizeRequestParam.REQUEST, request);
831  }
832  if (StringUtils.isNotBlank(requestUri)) {
833  redirectUriResponse.addResponseParameter(AuthorizeRequestParam.REQUEST_URI, requestUri);
834  }
835  if (StringUtils.isNotBlank(codeChallenge)) {
836  redirectUriResponse.addResponseParameter(AuthorizeRequestParam.CODE_CHALLENGE, codeChallenge);
837  }
838  if (StringUtils.isNotBlank(codeChallengeMethod)) {
839  redirectUriResponse.addResponseParameter(AuthorizeRequestParam.CODE_CHALLENGE_METHOD, codeChallengeMethod);
840  }
841  if (StringUtils.isNotBlank(sessionId)) {
842  redirectUriResponse.addResponseParameter(AuthorizeRequestParam.SESSION_ID, sessionId);
843  }
844  if (StringUtils.isNotBlank(claims)) {
845  redirectUriResponse.addResponseParameter(AuthorizeRequestParam.CLAIMS, claims);
846  }
847 
848  // mod_ox param
849  if (StringUtils.isNotBlank(originHeaders)) {
850  redirectUriResponse.addResponseParameter(AuthorizeRequestParam.ORIGIN_HEADERS, originHeaders);
851  }
852 
853  if (customParameters != null && customParameters.size() > 0) {
854  for (Map.Entry<String, String> entry : customParameters.entrySet()) {
855  redirectUriResponse.addResponseParameter(entry.getKey(), entry.getValue());
856  }
857  }
858  }
AppConfiguration appConfiguration
Definition: AuthorizeRestWebServiceImpl.java:144
String getAuthorizationPage()
Definition: AppConfiguration.java:310

◆ requestAuthorization()

Response org.xdi.oxauth.authorize.ws.rs.AuthorizeRestWebServiceImpl.requestAuthorization ( String  scope,
String  responseType,
String  clientId,
String  redirectUri,
String  state,
String  respMode,
String  nonce,
String  display,
String  prompt,
Integer  maxAge,
String  uiLocalesStr,
String  idTokenHint,
String  loginHint,
String  acrValuesStr,
String  amrValuesStr,
String  request,
String  requestUri,
String  requestSessionId,
String  sessionId,
String  accessToken,
String  method,
String  originHeaders,
String  codeChallenge,
String  codeChallengeMethod,
String  customRespHeaders,
String  claims,
HttpServletRequest  httpRequest,
HttpServletResponse  httpResponse,
SecurityContext  securityContext 
)
inline
180  {
181  scope = ServerUtil.urlDecode(scope); // it may be encoded in uma case
182 
183  String tokenBindingHeader = httpRequest.getHeader("Sec-Token-Binding");
184 
185  OAuth2AuditLog oAuth2AuditLog = new OAuth2AuditLog(ServerUtil.getIpAddress(httpRequest), Action.USER_AUTHORIZATION);
186  oAuth2AuditLog.setClientId(clientId);
187  oAuth2AuditLog.setScope(scope);
188 
189  // ATTENTION : please do not add more parameter in this debug method because it will not work with Seam 2.2.2.Final ,
190  // there is limit of 10 parameters (hardcoded), see: org.jboss.seam.core.Interpolator#interpolate
191  log.debug("Attempting to request authorization: "
192  + "responseType = {}, clientId = {}, scope = {}, redirectUri = {}, nonce = {}, "
193  + "state = {}, request = {}, isSecure = {}, requestSessionId = {}, sessionId = {}",
194  responseType, clientId, scope, redirectUri, nonce,
195  state, request, securityContext.isSecure(), requestSessionId, sessionId);
196 
197  log.debug("Attempting to request authorization: "
198  + "acrValues = {}, amrValues = {}, originHeaders = {}, codeChallenge = {}, codeChallengeMethod = {}, "
199  + "customRespHeaders = {}, claims = {}, tokenBindingHeader = {}",
200  acrValuesStr, amrValuesStr, originHeaders, codeChallenge, codeChallengeMethod, customRespHeaders, claims, tokenBindingHeader);
201 
202  ResponseBuilder builder = Response.ok();
203 
204  List<String> uiLocales = null;
205  if (StringUtils.isNotBlank(uiLocalesStr)) {
206  uiLocales = Util.splittedStringAsList(uiLocalesStr, " ");
207  }
208 
209  List<ResponseType> responseTypes = ResponseType.fromString(responseType, " ");
210  List<Prompt> prompts = Prompt.fromString(prompt, " ");
211  List<String> acrValues = Util.splittedStringAsList(acrValuesStr, " ");
212  List<String> amrValues = Util.splittedStringAsList(amrValuesStr, " ");
213 
214  ResponseMode responseMode = ResponseMode.getByValue(respMode);
215 
216  Map<String, String> customParameters = requestParameterService.getCustomParameters(
217  QueryStringDecoder.decode(httpRequest.getQueryString()));
218 
219  SessionId sessionUser = identity.getSessionId();
220  User user = sessionUser != null && StringUtils.isNotBlank(sessionUser.getUserDn()) ?
221  userService.getUserByDn(sessionUser.getUserDn()) : null;
222 
223  try {
224  Map<String, String> customResponseHeaders = Util.jsonObjectArrayStringAsMap(customRespHeaders);
225 
226  try {
228  } catch (AcrChangedException e) { // Acr changed
229  //See https://github.com/GluuFederation/oxTrust/issues/797
230  if (e.isForceReAuthentication()) {
231  if (!prompts.contains(Prompt.LOGIN)) {
232  log.info("ACR is changed, adding prompt=login to prompts");
233  prompts.add(Prompt.LOGIN);
234  //Override prompt in session
235  sessionUser.getSessionAttributes().put("prompt", org.xdi.oxauth.model.util.StringUtils.implode(prompts, " "));
236  }
237  } else {
238  throw e;
239  }
240  }
241 
242  if (!AuthorizeParamsValidator.validateParams(responseType, clientId, prompts, nonce, request, requestUri)) {
243  if (clientId != null && redirectUri != null && redirectionUriService.validateRedirectionUri(clientId, redirectUri) != null) {
244  RedirectUri redirectUriResponse = new RedirectUri(redirectUri, responseTypes, responseMode);
245  redirectUriResponse.parseQueryString(errorResponseFactory.getErrorAsQueryString(
246  AuthorizeErrorResponseType.INVALID_REQUEST, state));
247 
248  builder = RedirectUtil.getRedirectResponseBuilder(redirectUriResponse, httpRequest);
249  } else {
250  builder = Response.status(Response.Status.BAD_REQUEST.getStatusCode()); // 400
251  builder.entity(errorResponseFactory.getErrorAsJson(
252  AuthorizeErrorResponseType.INVALID_REQUEST, state));
253  }
254  } else {
255  Client client = clientService.getClient(clientId);
256  if (CollectionUtils.isEmpty(acrValues) && client != null && !ArrayUtils.isEmpty(client.getDefaultAcrValues())) {
257  acrValues = new ArrayList<String>();
258  acrValues.addAll(Arrays.asList(client.getDefaultAcrValues()));
259  }
260 
261  JwtAuthorizationRequest jwtAuthorizationRequest = null;
262 
263  if (client != null) {
264  if (client.isDisabled()) {
265  builder = Response.status(Response.Status.FORBIDDEN.getStatusCode()); // 403
266  builder.entity(errorResponseFactory.getErrorAsJson(AuthorizeErrorResponseType.DISABLED_CLIENT, state));
267 
268  applicationAuditLogger.sendMessage(oAuth2AuditLog);
269 
270  return builder.build();
271  }
272 
273  List<String> scopes = new ArrayList<String>();
274  if (StringHelper.isNotEmpty(scope)) {
275  Set<String> grantedScopes = scopeChecker.checkScopesPolicy(client, scope);
276  scopes.addAll(grantedScopes);
277  }
278 
279  // Validate redirectUri
280  redirectUri = redirectionUriService.validateRedirectionUri(clientId, redirectUri);
281  boolean validRedirectUri = redirectUri != null;
282 
283  if (AuthorizeParamsValidator.validateResponseTypes(responseTypes, client)
284  && AuthorizeParamsValidator.validateGrantType(responseTypes, client.getGrantTypes(), appConfiguration.getGrantTypesSupported())) {
285  if (validRedirectUri) {
286 
287  if (StringUtils.isNotBlank(accessToken)) {
288  boolean onlyFromCache = ServerUtil.isTrue(appConfiguration.getUseCacheForAllImplicitFlowObjects() && ResponseType.isImplicitFlow(responseType));
289  AuthorizationGrant authorizationGrant = authorizationGrantList.getAuthorizationGrantByAccessToken(accessToken, onlyFromCache);
290  boolean denyAccess = true;
291 
292  if (authorizationGrant != null) {
293  final AbstractToken accessTokenObject = authorizationGrant.getAccessToken(accessToken);
294  if (accessTokenObject != null && accessTokenObject.isValid()) {
295  denyAccess = false;
296  }
297  }
298 
299  if (denyAccess) {
300  RedirectUri redirectUriResponse = new RedirectUri(redirectUri, responseTypes, responseMode);
301  redirectUriResponse.parseQueryString(errorResponseFactory.getErrorAsQueryString(
302  AuthorizeErrorResponseType.ACCESS_DENIED, state));
303 
304  builder = RedirectUtil.getRedirectResponseBuilder(redirectUriResponse, httpRequest);
305  applicationAuditLogger.sendMessage(oAuth2AuditLog);
306  return builder.build();
307  } else {
308  oAuth2AuditLog.setUsername(authorizationGrant.getUserId());
309  user = userService.getUser(authorizationGrant.getUserId());
310  sessionUser = sessionIdService.generateAuthenticatedSessionId(httpRequest, user.getDn(), prompt);
311  sessionUser.addPermission(client.getClientId(), true);
312  }
313  }
314 
315  if (StringUtils.isNotBlank(requestUri)) {
316  boolean validRequestUri = false;
317  try {
318  URI reqUri = new URI(requestUri);
319  String reqUriHash = reqUri.getFragment();
320  String reqUriWithoutFragment = reqUri.getScheme() + ":" + reqUri.getSchemeSpecificPart();
321 
322  ClientRequest clientRequest = new ClientRequest(reqUriWithoutFragment);
323  clientRequest.setHttpMethod(HttpMethod.GET);
324 
325  ClientResponse<String> clientResponse = clientRequest.get(String.class);
326  int status = clientResponse.getStatus();
327 
328  if (status == 200) {
329  request = clientResponse.getEntity(String.class);
330 
331  if (StringUtils.isBlank(reqUriHash)) {
332  validRequestUri = true;
333  } else {
334  String hash = Base64Util.base64urlencode(JwtUtil.getMessageDigestSHA256(request));
335  validRequestUri = StringUtils.equals(reqUriHash, hash);
336  }
337  }
338 
339  if (validRequestUri) {
340  requestUri = null;
341  } else {
342  RedirectUri redirectUriResponse = new RedirectUri(redirectUri, responseTypes, responseMode);
343  redirectUriResponse.parseQueryString(errorResponseFactory.getErrorAsQueryString(
344  AuthorizeErrorResponseType.INVALID_REQUEST_URI, state));
345 
346  builder = RedirectUtil.getRedirectResponseBuilder(redirectUriResponse, httpRequest);
347  applicationAuditLogger.sendMessage(oAuth2AuditLog);
348  return builder.build();
349  }
350  } catch (URISyntaxException e) {
351  log.error(e.getMessage(), e);
352  } catch (UnknownHostException e) {
353  log.error(e.getMessage(), e);
354  } catch (ConnectException e) {
355  log.error(e.getMessage(), e);
356  } catch (Exception e) {
357  log.error(e.getMessage(), e);
358  }
359  }
360 
361  boolean invalidOpenidRequestObject = false;
362  if (StringUtils.isNotBlank(request)) {
363  try {
364  jwtAuthorizationRequest = new JwtAuthorizationRequest(appConfiguration, request, client);
365 
366  if (!jwtAuthorizationRequest.getResponseTypes().containsAll(responseTypes)
367  || !responseTypes.containsAll(jwtAuthorizationRequest.getResponseTypes())) {
368  throw new InvalidJwtException("The responseType parameter is not the same in the JWT");
369  } else if (jwtAuthorizationRequest.getClientId() != null
370  && !jwtAuthorizationRequest.getClientId().equals(clientId)) {
371  throw new InvalidJwtException("The clientId parameter is not the same in the JWT");
372  } else if (!jwtAuthorizationRequest.getScopes().containsAll(scopes)
373  || !scopes.containsAll(jwtAuthorizationRequest.getScopes())) {
374  throw new InvalidJwtException("The scope parameter is not the same in the JWT");
375  } else if (jwtAuthorizationRequest.getRedirectUri() != null
376  && !jwtAuthorizationRequest.getRedirectUri().equals(redirectUri)) {
377  throw new InvalidJwtException("The redirectUri parameter is not the same in the JWT");
378  } else if (jwtAuthorizationRequest.getState() != null && StringUtils.isNotBlank(state)
379  && !jwtAuthorizationRequest.getState().equals(state)) {
380  throw new InvalidJwtException("The state parameter is not the same in the JWT");
381  } else if (jwtAuthorizationRequest.getNonce() != null && StringUtils.isNotBlank(nonce)
382  && !jwtAuthorizationRequest.getNonce().equals(nonce)) {
383  throw new InvalidJwtException("The nonce parameter is not the same in the JWT");
384  } else if (jwtAuthorizationRequest.getDisplay() != null && StringUtils.isNotBlank(display)
385  && !jwtAuthorizationRequest.getDisplay().getParamName().equals(display)) {
386  throw new InvalidJwtException("The display parameter is not the same in the JWT");
387  } else if (!jwtAuthorizationRequest.getPrompts().isEmpty() && !prompts.isEmpty()
388  && !jwtAuthorizationRequest.getPrompts().containsAll(prompts)) {
389  throw new InvalidJwtException("The prompt parameter is not the same in the JWT");
390  } else if (jwtAuthorizationRequest.getIdTokenMember() != null
391  && jwtAuthorizationRequest.getIdTokenMember().getMaxAge() != null && maxAge != null
392  && !jwtAuthorizationRequest.getIdTokenMember().getMaxAge().equals(maxAge)) {
393  throw new InvalidJwtException("The maxAge parameter is not the same in the JWT");
394  }
395  } catch (InvalidJwtException e) {
396  invalidOpenidRequestObject = true;
397  log.debug("Invalid JWT authorization request. Exception = {}, Message = {}", e,
398  e.getClass().getName(), e.getMessage());
399  } catch (Exception e) {
400  invalidOpenidRequestObject = true;
401  log.debug("Invalid JWT authorization request. Exception = {}, Message = {}", e,
402  e.getClass().getName(), e.getMessage());
403  }
404  }
405  if (invalidOpenidRequestObject) {
406  RedirectUri redirectUriResponse = new RedirectUri(redirectUri, responseTypes, responseMode);
407 
408  redirectUriResponse.parseQueryString(errorResponseFactory.getErrorAsQueryString(
409  AuthorizeErrorResponseType.INVALID_OPENID_REQUEST_OBJECT, state));
410 
411  builder = RedirectUtil.getRedirectResponseBuilder(redirectUriResponse, httpRequest);
412  } else {
413  AuthorizationGrant authorizationGrant = null;
414  RedirectUri redirectUriResponse = new RedirectUri(redirectUri, responseTypes, responseMode);
415 
416  if (jwtAuthorizationRequest != null && jwtAuthorizationRequest.getIdTokenMember() != null) {
417  Claim userIdClaim = jwtAuthorizationRequest.getIdTokenMember().getClaim(JwtClaimName.SUBJECT_IDENTIFIER);
418  if (userIdClaim != null && userIdClaim.getClaimValue() != null
419  && userIdClaim.getClaimValue().getValue() != null) {
420  String userIdClaimValue = userIdClaim.getClaimValue().getValue();
421 
422  if (user != null) {
423  String userId = user.getUserId();
424 
425  if (!userId.equalsIgnoreCase(userIdClaimValue)) {
426  redirectUriResponse.parseQueryString(errorResponseFactory.getErrorAsQueryString(
427  AuthorizeErrorResponseType.USER_MISMATCHED, state));
428 
429  builder = RedirectUtil.getRedirectResponseBuilder(redirectUriResponse, httpRequest);
430  applicationAuditLogger.sendMessage(oAuth2AuditLog);
431  return builder.build();
432  }
433  }
434  }
435  }
436 
437  if (user == null) {
438  identity.logout();
439  if (prompts.contains(Prompt.NONE)) {
441  Map<String, String> params;
442  if (method.equals(HttpMethod.GET)) {
443  params = QueryStringDecoder.decode(httpRequest.getQueryString());
444  } else {
445  params = getGenericRequestMap(httpRequest);
446  }
447 
449  if (userDn != null) {
450  Map<String, String> genericRequestMap = getGenericRequestMap(httpRequest);
451 
452  Map<String, String> parameterMap = Maps.newHashMap(genericRequestMap);
453  Map<String, String> requestParameterMap = requestParameterService.getAllowedParameters(parameterMap);
454 
455  sessionUser = sessionIdService.generateAuthenticatedSessionId(httpRequest, userDn, prompt);
456  sessionUser.setSessionAttributes(requestParameterMap);
457 
458  sessionIdService.createSessionIdCookie(sessionUser.getId(), sessionUser.getSessionState(), httpResponse, false);
459  sessionIdService.updateSessionId(sessionUser);
460  user = userService.getUserByDn(sessionUser.getUserDn());
461  } else {
462  redirectUriResponse.parseQueryString(errorResponseFactory.getErrorAsQueryString(
463  AuthorizeErrorResponseType.LOGIN_REQUIRED, state));
464 
465  builder = RedirectUtil.getRedirectResponseBuilder(redirectUriResponse, httpRequest);
466  applicationAuditLogger.sendMessage(oAuth2AuditLog);
467  return builder.build();
468  }
469  } else {
470  redirectUriResponse.parseQueryString(errorResponseFactory.getErrorAsQueryString(
471  AuthorizeErrorResponseType.LOGIN_REQUIRED, state));
472 
473  builder = RedirectUtil.getRedirectResponseBuilder(redirectUriResponse, httpRequest);
474  applicationAuditLogger.sendMessage(oAuth2AuditLog);
475  return builder.build();
476  }
477  } else {
478  if (prompts.contains(Prompt.LOGIN)) {
479  endSession(sessionId, httpRequest, httpResponse);
480  sessionId = null;
481  prompts.remove(Prompt.LOGIN);
482  }
483 
484  redirectToAuthorizationPage(redirectUriResponse, responseTypes, scope, clientId,
485  redirectUri, state, responseMode, nonce, display, prompts, maxAge, uiLocales,
486  idTokenHint, loginHint, acrValues, amrValues, request, requestUri, originHeaders,
487  codeChallenge, codeChallengeMethod, sessionId, claims, customParameters);
488  builder = RedirectUtil.getRedirectResponseBuilder(redirectUriResponse, httpRequest);
489  applicationAuditLogger.sendMessage(oAuth2AuditLog);
490  return builder.build();
491  }
492  }
493 
494  // OXAUTH-37 : Validate authentication max age
495  boolean validAuthenticationMaxAge = true;
496  Integer authenticationMaxAge = null;
497  if (maxAge != null) {
498  authenticationMaxAge = maxAge;
499  } else if (!invalidOpenidRequestObject && jwtAuthorizationRequest != null
500  && jwtAuthorizationRequest.getIdTokenMember() != null
501  && jwtAuthorizationRequest.getIdTokenMember().getMaxAge() != null) {
502  authenticationMaxAge = jwtAuthorizationRequest.getIdTokenMember().getMaxAge();
503  }
504  GregorianCalendar now = new GregorianCalendar(TimeZone.getTimeZone("UTC"));
505  GregorianCalendar userAuthenticationTime = new GregorianCalendar(TimeZone.getTimeZone("UTC"));
506  userAuthenticationTime.setTime(sessionUser.getAuthenticationTime());
507  if (authenticationMaxAge != null) {
508  userAuthenticationTime.add(Calendar.SECOND, authenticationMaxAge);
509  validAuthenticationMaxAge = userAuthenticationTime.after(now);
510  } else if (client.getDefaultMaxAge() != null) {
511  userAuthenticationTime.add(Calendar.SECOND, client.getDefaultMaxAge());
512  validAuthenticationMaxAge = userAuthenticationTime.after(now);
513  }
514  if (!validAuthenticationMaxAge) {
515  endSession(sessionId, httpRequest, httpResponse);
516  sessionId = null;
517 
518  redirectToAuthorizationPage(redirectUriResponse, responseTypes, scope, clientId,
519  redirectUri, state, responseMode, nonce, display, prompts, maxAge, uiLocales,
520  idTokenHint, loginHint, acrValues, amrValues, request, requestUri, originHeaders,
521  codeChallenge, codeChallengeMethod, sessionId, claims, customParameters);
522  builder = RedirectUtil.getRedirectResponseBuilder(redirectUriResponse, httpRequest);
523  applicationAuditLogger.sendMessage(oAuth2AuditLog);
524  return builder.build();
525  }
526 
527  oAuth2AuditLog.setUsername(user.getUserId());
528 
529  ClientAuthorizations clientAuthorizations = clientAuthorizationsService.findClientAuthorizations(
530  user.getAttribute("inum"),
531  client.getClientId(),
532  client.getPersistClientAuthorizations());
533  if (scopes.size() > 0) {
534  if (clientAuthorizations != null && clientAuthorizations.getScopes() != null) {
535  if (Arrays.asList(clientAuthorizations.getScopes()).containsAll(scopes)) {
536  sessionUser.addPermission(clientId, true);
537  } else {
538  redirectToAuthorizationPage(redirectUriResponse, responseTypes, scope, clientId,
539  redirectUri, state, responseMode, nonce, display, prompts, maxAge, uiLocales,
540  idTokenHint, loginHint, acrValues, amrValues, request, requestUri, originHeaders,
541  codeChallenge, codeChallengeMethod, sessionId, claims, customParameters);
542  builder = RedirectUtil.getRedirectResponseBuilder(redirectUriResponse, httpRequest);
543  applicationAuditLogger.sendMessage(oAuth2AuditLog);
544  return builder.build();
545  }
546  } else if (client.getTrustedClient()) {
547  sessionUser.addPermission(clientId, true);
548  }
549  }
550 
551  if (prompts.contains(Prompt.LOGIN)) {
552  endSession(sessionId, httpRequest, httpResponse);
553  sessionId = null;
554  prompts.remove(Prompt.LOGIN);
555 
556  redirectToAuthorizationPage(redirectUriResponse, responseTypes, scope, clientId,
557  redirectUri, state, responseMode, nonce, display, prompts, maxAge, uiLocales,
558  idTokenHint, loginHint, acrValues, amrValues, request, requestUri, originHeaders,
559  codeChallenge, codeChallengeMethod, sessionId, claims, customParameters);
560  builder = RedirectUtil.getRedirectResponseBuilder(redirectUriResponse, httpRequest);
561  applicationAuditLogger.sendMessage(oAuth2AuditLog);
562  return builder.build();
563  }
564 
565  if (prompts.contains(Prompt.CONSENT) || !sessionUser.isPermissionGrantedForClient(clientId)) {
566  prompts.remove(Prompt.CONSENT);
567 
568  redirectToAuthorizationPage(redirectUriResponse, responseTypes, scope, clientId,
569  redirectUri, state, responseMode, nonce, display, prompts, maxAge, uiLocales,
570  idTokenHint, loginHint, acrValues, amrValues, request, requestUri, originHeaders,
571  codeChallenge, codeChallengeMethod, sessionId, claims, customParameters);
572  builder = RedirectUtil.getRedirectResponseBuilder(redirectUriResponse, httpRequest);
573  applicationAuditLogger.sendMessage(oAuth2AuditLog);
574  return builder.build();
575  }
576 
577  AuthorizationCode authorizationCode = null;
578  if (responseTypes.contains(ResponseType.CODE)) {
579  authorizationGrant = authorizationGrantList.createAuthorizationCodeGrant(user, client,
580  sessionUser.getAuthenticationTime());
581  authorizationGrant.setNonce(nonce);
582  authorizationGrant.setJwtAuthorizationRequest(jwtAuthorizationRequest);
583  authorizationGrant.setTokenBindingHash(TokenBindingMessage.getTokenBindingIdHashFromTokenBindingMessage(tokenBindingHeader, client.getIdTokenTokenBindingCnf()));
584  authorizationGrant.setScopes(scopes);
585  authorizationGrant.setCodeChallenge(codeChallenge);
586  authorizationGrant.setCodeChallengeMethod(codeChallengeMethod);
587  authorizationGrant.setClaims(claims);
588 
589  // Store acr_values
590  authorizationGrant.setAcrValues(acrValuesStr);
591  authorizationGrant.setSessionDn(sessionUser.getDn());
592  authorizationGrant.save(); // call save after object modification!!!
593 
594  authorizationCode = authorizationGrant.getAuthorizationCode();
595 
596  redirectUriResponse.addResponseParameter("code", authorizationCode.getCode());
597  }
598 
599  AccessToken newAccessToken = null;
600  if (responseTypes.contains(ResponseType.TOKEN)) {
601  if (authorizationGrant == null) {
602  authorizationGrant = authorizationGrantList.createImplicitGrant(user, client,
603  sessionUser.getAuthenticationTime());
604  authorizationGrant.setNonce(nonce);
605  authorizationGrant.setJwtAuthorizationRequest(jwtAuthorizationRequest);
606  authorizationGrant.setScopes(scopes);
607  authorizationGrant.setClaims(claims);
608 
609  // Store acr_values
610  authorizationGrant.setAcrValues(acrValuesStr);
611  authorizationGrant.setSessionDn(sessionUser.getDn());
612  authorizationGrant.save(); // call save after object modification!!!
613  }
614  newAccessToken = authorizationGrant.createAccessToken();
615 
616  redirectUriResponse.addResponseParameter(AuthorizeResponseParam.ACCESS_TOKEN, newAccessToken.getCode());
617  redirectUriResponse.addResponseParameter(AuthorizeResponseParam.TOKEN_TYPE, newAccessToken.getTokenType().toString());
618  redirectUriResponse.addResponseParameter(AuthorizeResponseParam.EXPIRES_IN, newAccessToken.getExpiresIn() + "");
619  }
620 
621  if (responseTypes.contains(ResponseType.ID_TOKEN)) {
622  boolean includeIdTokenClaims = Boolean.TRUE.equals(appConfiguration.getLegacyIdTokenClaims());
623  if (authorizationGrant == null) {
624  includeIdTokenClaims = true;
625  authorizationGrant = authorizationGrantList.createAuthorizationGrant(user, client,
626  sessionUser.getAuthenticationTime());
627  authorizationGrant.setNonce(nonce);
628  authorizationGrant.setJwtAuthorizationRequest(jwtAuthorizationRequest);
629  authorizationGrant.setScopes(scopes);
630  authorizationGrant.setClaims(claims);
631 
632  // Store authentication acr values
633  authorizationGrant.setAcrValues(acrValuesStr);
634  authorizationGrant.setSessionDn(sessionUser.getDn());
635  authorizationGrant.save(); // call save after object modification, call is asynchronous!!!
636  }
637  IdToken idToken = authorizationGrant.createIdToken(
638  nonce, authorizationCode, newAccessToken, authorizationGrant, includeIdTokenClaims, TokenBindingMessage.createIdTokenTokingBindingPreprocessing(tokenBindingHeader, client.getIdTokenTokenBindingCnf()));
639 
640  redirectUriResponse.addResponseParameter(AuthorizeResponseParam.ID_TOKEN, idToken.getCode());
641  }
642 
643  if (authorizationGrant != null && StringHelper.isNotEmpty(acrValuesStr)) {
644  redirectUriResponse.addResponseParameter(AuthorizeResponseParam.ACR_VALUES, acrValuesStr);
645  }
646 
647  //if (Boolean.valueOf(requestSessionId) && StringUtils.isBlank(sessionId) &&
648  if (sessionUser.getId() == null) {
649  final SessionId newSessionUser = sessionIdService.generateAuthenticatedSessionId(httpRequest, sessionUser.getUserDn(), prompt);
650  String newSessionId = newSessionUser.getId();
651  sessionUser.setId(newSessionId);
652  log.trace("newSessionId = {}", newSessionId);
653  }
654  redirectUriResponse.addResponseParameter(AuthorizeResponseParam.SESSION_ID, sessionUser.getId());
655  redirectUriResponse.addResponseParameter(AuthorizeResponseParam.SESSION_STATE, sessionUser.getSessionState());
656  redirectUriResponse.addResponseParameter(AuthorizeResponseParam.STATE, state);
657  if (scope != null && !scope.isEmpty()) {
658  scope = authorizationGrant.checkScopesPolicy(scope);
659 
660  redirectUriResponse.addResponseParameter(AuthorizeResponseParam.SCOPE, scope);
661  }
662 
663  clientService.updatAccessTime(client, false);
664  oAuth2AuditLog.setSuccess(true);
665 
666  builder = RedirectUtil.getRedirectResponseBuilder(redirectUriResponse, httpRequest);
667 
669  for (String key : customResponseHeaders.keySet()) {
670  builder.header(key, customResponseHeaders.get(key));
671  }
672  }
673  }
674  } else { // Invalid redirectUri
675  builder = error(Response.Status.BAD_REQUEST,
676  AuthorizeErrorResponseType.INVALID_REQUEST_REDIRECT_URI, state); // 400
677  }
678  } else { // Invalid responseTypes
679  builder = Response.status(Response.Status.BAD_REQUEST.getStatusCode()); // 400
680  builder.entity(errorResponseFactory.getErrorAsJson(
681  AuthorizeErrorResponseType.UNSUPPORTED_RESPONSE_TYPE, state));
682  }
683  } else {
684  builder = error(Response.Status.UNAUTHORIZED, AuthorizeErrorResponseType.UNAUTHORIZED_CLIENT, state);
685  }
686  }
687 // } catch (AcrChangedException e) {
688 // builder = Response.status(Response.Status.UNAUTHORIZED).entity("Session already exist with ACR that is different " +
689 // "than the one send with this authorization request. Please perform logout in order to login with another ACR. ACR: " + acrValuesStr);
690 // log.error(e.getMessage(), e);
691  } catch (AcrChangedException e) { // Acr changed
692  log.error("ACR is changed, please provide a supported and enabled acr value");
693  log.error(e.getMessage(), e);
694 
695  RedirectUri redirectUriResponse = new RedirectUri(redirectUri, responseTypes, responseMode);
696  redirectUriResponse.parseQueryString(errorResponseFactory.getErrorAsQueryString(
697  AuthorizeErrorResponseType.SESSION_SELECTION_REQUIRED, state));
698  redirectUriResponse.addResponseParameter("hint", "Use prompt=login in order to alter existing session.");
699  applicationAuditLogger.sendMessage(oAuth2AuditLog);
700  return RedirectUtil.getRedirectResponseBuilder(redirectUriResponse, httpRequest).build();
701  } catch (EntryPersistenceException e) { // Invalid clientId
702  builder = error(Response.Status.UNAUTHORIZED, AuthorizeErrorResponseType.UNAUTHORIZED_CLIENT, state);
703  log.error(e.getMessage(), e);
704  } catch (SignatureException e) {
705  builder = Response.status(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode()); // 500
706  log.error(e.getMessage(), e);
707  } catch (StringEncrypter.EncryptionException e) {
708  builder = Response.status(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode()); // 500
709  log.error(e.getMessage(), e);
710  } catch (InvalidJwtException e) {
711  builder = Response.status(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode()); // 500
712  log.error(e.getMessage(), e);
713  } catch (Exception e) {
714  builder = Response.status(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode()); // 500
715  log.error(e.getMessage(), e);
716  }
717 
718  applicationAuditLogger.sendMessage(oAuth2AuditLog);
719  return builder.build();
720  }
String getErrorAsJson(IErrorType p_type)
Definition: ErrorResponseFactory.java:86
void addPermission(String clientId, Boolean granted)
Definition: SessionId.java:188
void updatAccessTime(Client client, boolean isUpdateLogonTime)
Definition: ClientService.java:306
void sendMessage(OAuth2AuditLog oAuth2AuditLog)
Definition: ApplicationAuditLogger.java:78
void endSession(String sessionId, HttpServletRequest httpRequest, HttpServletResponse httpResponse)
Definition: AuthorizeRestWebServiceImpl.java:860
static String implode(String[] inputArray, String glueString)
Definition: StringUtils.java:56
void setNonce(String nonce)
Definition: AbstractAuthorizationGrant.java:133
AppConfiguration appConfiguration
Definition: AuthorizeRestWebServiceImpl.java:144
Map< String, String > getCustomParameters(@Nonnull final Map< String, String > requestParameterMap)
Definition: RequestParameterService.java:100
UserService userService
Definition: AuthorizeRestWebServiceImpl.java:123
String getErrorAsQueryString(IErrorType p_type, String p_state)
Definition: ErrorResponseFactory.java:126
ApplicationAuditLogger applicationAuditLogger
Definition: AuthorizeRestWebServiceImpl.java:108
SessionId getSessionId()
Definition: Identity.java:30
ClientAuthorizationsService clientAuthorizationsService
Definition: AuthorizeRestWebServiceImpl.java:138
ErrorResponseFactory errorResponseFactory
Definition: AuthorizeRestWebServiceImpl.java:111
SessionId assertAuthenticatedSessionCorrespondsToNewRequest(SessionId session, String acrValuesStr)
Definition: SessionIdService.java:126
AuthorizationCodeGrant createAuthorizationCodeGrant(User user, Client client, Date authenticationTime)
Definition: AuthorizationGrantList.java:85
Definition: Base64Util.java:7
ScopeChecker scopeChecker
Definition: AuthorizeRestWebServiceImpl.java:135
Map< String, String > getAllowedParameters(@Nonnull final Map< String, String > requestParameterMap)
Definition: RequestParameterService.java:81
ImplicitGrant createImplicitGrant(User user, Client client, Date authenticationTime)
Definition: AuthorizationGrantList.java:96
Boolean getUseCacheForAllImplicitFlowObjects()
Definition: AppConfiguration.java:952
Identity identity
Definition: AuthorizeRestWebServiceImpl.java:126
SessionId generateAuthenticatedSessionId(HttpServletRequest httpRequest, String userDn)
Definition: SessionIdService.java:378
Boolean getLegacyIdTokenClaims()
Definition: AppConfiguration.java:1265
Logger log
Definition: AuthorizeRestWebServiceImpl.java:105
String processAuthenticationFilters(Map<?, ?> attributeValues)
Definition: BaseAuthFilterService.java:234
Set< GrantType > getGrantTypesSupported()
Definition: AppConfiguration.java:549
User getUser(String userId, String... returnAttributes)
Definition: UserService.java:87
AuthenticationFilterService authenticationFilterService
Definition: AuthorizeRestWebServiceImpl.java:129
void redirectToAuthorizationPage(RedirectUri redirectUriResponse, List< ResponseType > responseTypes, String scope, String clientId, String redirectUri, String state, ResponseMode responseMode, String nonce, String display, List< Prompt > prompts, Integer maxAge, List< String > uiLocales, String idTokenHint, String loginHint, List< String > acrValues, List< String > amrValues, String request, String requestUri, String originHeaders, String codeChallenge, String codeChallengeMethod, String sessionId, String claims, Map< String, String > customParameters)
Definition: AuthorizeRestWebServiceImpl.java:765
boolean isEnabled()
Definition: BaseAuthFilterService.java:259
AuthorizationGrant createAuthorizationGrant(User user, Client client, Date authenticationTime)
Definition: AuthorizationGrantList.java:77
String getId()
Definition: SessionId.java:136
void setSessionAttributes(Map< String, String > sessionAttributes)
Definition: SessionId.java:203
RedirectionUriService redirectionUriService
Definition: AuthorizeRestWebServiceImpl.java:114
AuthorizationGrantList authorizationGrantList
Definition: AuthorizeRestWebServiceImpl.java:117
SessionIdService sessionIdService
Definition: AuthorizeRestWebServiceImpl.java:132
ResponseBuilder error(Response.Status p_status, AuthorizeErrorResponseType p_type, String p_state)
Definition: AuthorizeRestWebServiceImpl.java:761
Definition: StringUtils.java:24
ClientService clientService
Definition: AuthorizeRestWebServiceImpl.java:120
AbstractToken getAccessToken(String tokenCode)
Definition: AbstractAuthorizationGrant.java:445
void createSessionIdCookie(String sessionId, String sessionState, HttpServletResponse httpResponse, String cookieName)
Definition: SessionIdService.java:284
boolean updateSessionId(final SessionId sessionId)
Definition: SessionIdService.java:534
Set< Client > getClient(Collection< String > clientIds, boolean silent)
Definition: ClientService.java:123
AuthorizationGrant getAuthorizationGrantByAccessToken(String accessToken)
Definition: AuthorizationGrantList.java:166
Boolean getCustomHeadersWithAuthorizationResponse()
Definition: AppConfiguration.java:1273
User getUserByDn(String dn, String... returnAttributes)
Definition: UserService.java:66
Map< String, String > getGenericRequestMap(HttpServletRequest httpRequest)
Definition: AuthorizeRestWebServiceImpl.java:752
String validateRedirectionUri(String clientIdentifier, String redirectionUri)
Definition: RedirectionUriService.java:50
Set< String > checkScopesPolicy(Client client, String scope)
Definition: ScopeChecker.java:39
RequestParameterService requestParameterService
Definition: AuthorizeRestWebServiceImpl.java:141
ClientAuthorizations findClientAuthorizations(String userInum, String clientId, boolean persistInLdap)
Definition: ClientAuthorizationsService.java:68

◆ requestAuthorizationGet() [1/2]

Response org.xdi.oxauth.authorize.ws.rs.AuthorizeRestWebServiceImpl.requestAuthorizationGet ( String  scope,
String  responseType,
String  clientId,
String  redirectUri,
String  state,
String  responseMode,
String  nonce,
String  display,
String  prompt,
Integer  maxAge,
String  uiLocales,
String  idTokenHint,
String  loginHint,
String  acrValues,
String  amrValues,
String  request,
String  requestUri,
String  requestSessionId,
String  sessionId,
String  accessToken,
String  originHeaders,
String  codeChallenge,
String  codeChallengeMethod,
String  customResponseHeaders,
String  claims,
HttpServletRequest  httpRequest,
HttpServletResponse  httpResponse,
SecurityContext  securityContext 
)
inline
153  {
154  return requestAuthorization(scope, responseType, clientId, redirectUri, state, responseMode, nonce, display,
155  prompt, maxAge, uiLocales, idTokenHint, loginHint, acrValues, amrValues, request, requestUri,
156  requestSessionId, sessionId, accessToken, HttpMethod.GET, originHeaders, codeChallenge,
157  codeChallengeMethod, customResponseHeaders, claims, httpRequest, httpResponse, securityContext);
158  }
Response requestAuthorization(String scope, String responseType, String clientId, String redirectUri, String state, String respMode, String nonce, String display, String prompt, Integer maxAge, String uiLocalesStr, String idTokenHint, String loginHint, String acrValuesStr, String amrValuesStr, String request, String requestUri, String requestSessionId, String sessionId, String accessToken, String method, String originHeaders, String codeChallenge, String codeChallengeMethod, String customRespHeaders, String claims, HttpServletRequest httpRequest, HttpServletResponse httpResponse, SecurityContext securityContext)
Definition: AuthorizeRestWebServiceImpl.java:174

◆ requestAuthorizationGet() [2/2]

Response org.xdi.oxauth.authorize.ws.rs.AuthorizeRestWebService.requestAuthorizationGet ( @QueryParam("scope") @ApiParam(value="OpenID Connect requests MUST contain the openid scope value. If the openid scope value is not present, the behavior is entirely unspecified. Other scope values MAY be present. Scope values used that are not understood by an implementation SHOULD be ignored.", required=true) String  scope,
@QueryParam("response_type") @ApiParam(value="OAuth 2.0 Response Type value that determines the authorization processing flow to be used, including what parameters are returned from the endpoints used. When using the Authorization Code Flow, this value is code. ", required=true) String  responseType,
@QueryParam("client_id") @ApiParam(value="OAuth 2.0 Client Identifier valid at the Authorization Server.", required=true) String  clientId,
@QueryParam("redirect_uri") @ApiParam(value="Redirection URI to which the response will be sent. This URI MUST exactly match one of the Redirection URI values for the Client pre-registered at the OpenID Provider", required=true) String  redirectUri,
@QueryParam("state") @ApiParam(value="Opaque value used to maintain state between the request and the callback. Typically, Cross-Site Request Forgery (CSRF, XSRF) mitigation is done by cryptographically binding the value of this parameter with a browser cookie. ", required=false) String  state,
@QueryParam("response_mode") @ApiParam(value="Informs the Authorization Server of the mechanism to be used for returning parameters from the Authorization Endpoint. This use of this parameter is NOT RECOMMENDED when the Response Mode that would be requested is the default mode specified for the Response Type. ", required=false) String  responseMode,
@QueryParam("nonce") @ApiParam(value="String value used to associate a Client session with an ID Token, and to mitigate replay attacks. The value is passed through unmodified from the Authorization Request to the ID Token. Sufficient entropy MUST be present in the nonce values used to prevent attackers from guessing values.", required=false) String  nonce,
@QueryParam("display") @ApiParam(value="ASCII string value that specifies how the Authorization Server displays the authentication and consent user interface pages to the End-User. The defined values are: page, popup, touch, wap", required=false) String  display,
@QueryParam("prompt") @ApiParam(value="Space delimited, case sensitive list of ASCII string values that specifies whether the Authorization Server prompts the End-User for reauthentication and consent. The defined values are: none, login, consent, select_account", required=false) String  prompt,
@QueryParam("max_age") @ApiParam(value="Maximum Authentication Age. Specifies the allowable elapsed time in seconds since the last time the End-User was actively authenticated by the OP. If the elapsed time is greater than this value, the OP MUST attempt to actively re-authenticate the End-User. (The max_age request parameter corresponds to the OpenID 2.0 PAPE [OpenID.PAPE] max_auth_age request parameter.) When max_age is used, the ID Token returned MUST include an auth_time Claim Value. ", required=false) Integer  maxAge,
@QueryParam("ui_locales") @ApiParam(value="End-User's preferred languages and scripts for the user interface, represented as a space-separated list of BCP47 [RFC5646] language tag values, ordered by preference. For instance, the value \CA fr en\presents a preference for French as spoken in Canada, then French (without a region designation), followed by English (without a region designation). An error SHOULD NOT result if some or all of the requested locales are not supported by the OpenID Provider. ", required=false) String  uiLocales,
@QueryParam("id_token_hint") @ApiParam(value="ID Token previously issued by the Authorization Server being passed as a hint about the End-User's current or past authenticated session with the Client. If the End-User identified by the ID Token is logged in or is logged in by the request, then the Authorization Server returns a positive response; otherwise, it SHOULD return an error, such as login_required. When possible, an id_token_hint SHOULD be present when prompt=none is used and an invalid_request error MAY be returned if it is not; however, the server SHOULD respond successfully when possible, even if it is not present. The Authorization Server need not be listed as an audience of the ID Token when it is used as an id_token_hint value. ", required=false) String  idTokenHint,
@QueryParam("login_hint") @ApiParam(value="Hint to the Authorization Server about the login identifier the End-User might use to log in (if necessary). This hint can be used by an RP if it first asks the End-User for their e-mail address (or other identifier) and then wants to pass that value as a hint to the discovered authorization service. It is RECOMMENDED that the hint value match the value used for discovery. This value MAY also be a phone number in the format specified for the phone_number Claim. The use of this parameter is left to the OP's discretion. ", required=false) String  loginHint,
@QueryParam("acr_values") @ApiParam(value="Requested Authentication Context Class Reference values. Space-separated string that specifies the acr values that the Authorization Server is being requested to use for processing this Authentication Request, with the values appearing in order of preference. The Authentication Context Class satisfied by the authentication performed is returned as the acr Claim Value, as specified in Section 2. The acr Claim is requested as a Voluntary Claim by this parameter. ", required=false) String  acrValues,
@QueryParam("amr_values") @ApiParam(value="AMR Values", required=false) String  amrValues,
@QueryParam("request") @ApiParam(value="This parameter enables OpenID Connect requests to be passed in a single, self-contained parameter and to be optionally signed and/or encrypted. The parameter value is a Request Object value, as specified in Section 6.1. It represents the request as a JWT whose Claims are the request parameters.", required=false) String  request,
@QueryParam("request_uri") @ApiParam(value="This parameter enables OpenID Connect requests to be passed by reference, rather than by value. The request_uri value is a URL using the https scheme referencing a resource containing a Request Object value, which is a JWT containing the request parameters. ", required=false) String  requestUri,
@QueryParam("request_session_id") @ApiParam(value="Request session id", required=false) String  requestSessionId,
@QueryParam("session_id") @ApiParam(value="Session id of this call", required=false) String  sessionId,
@QueryParam("access_token") @ApiParam(value="Access token", required=false) String  accessToken,
@QueryParam("origin_headers") @ApiParam(value="Origin headers. Used in custom workflows.", required=false) String  originHeaders,
@QueryParam("code_challenge") @ApiParam(value="PKCE code challenge.", required=false) String  codeChallenge,
@QueryParam("code_challenge_method") @ApiParam(value="PKCE code challenge method.", required=false) String  codeChallengeMethod,
@QueryParam(AuthorizeRequestParam.CUSTOM_RESPONSE_HEADERS) @ApiParam(value="Custom Response Headers.", required=false) String  customResponseHeaders,
@QueryParam("claims") @ApiParam(value="Requested Claims.", required=false) String  claims,
@Context HttpServletRequest  httpRequest,
@Context HttpServletResponse  httpResponse,
@Context SecurityContext  securityContext 
)
inherited

Requests authorization.

引数
scopeThe scope of the access request.
responseTypeThe response type informs the authorization server of the desired response type: code, token, id_token a combination of them. The response type parameter is mandatory.
clientIdThe client identifier.
redirectUriRedirection URI
stateAn opaque value used by the client to maintain state between the request and callback. The authorization server includes this value when redirecting the user-agent back to the client. The parameter should be used for preventing cross-site request forgery.
responseModeInforms the Authorization Server of the mechanism to be used for returning parameters from the Authorization Endpoint. This use of this parameter is NOT RECOMMENDED when the Response Mode that would be requested is the default mode specified for the Response Type.
nonceA string value used to associate a user agent session with an ID Token, and to mitigate replay attacks.
displayAn ASCII string value that specifies how the Authorization Server displays the authentication page to the End-User.
promptA space delimited list of ASCII strings that can contain the values login, consent, select_account, and none.
maxAgeMaximum Authentication Age. Specifies the allowable elapsed time in seconds since the last time the End-User was actively authenticated.
uiLocalesEnd-User's preferred languages and scripts for the user interface, represented as a space-separated list of BCP47 [RFC5646] language tag values, ordered by preference.
idTokenHintPreviously issued ID Token passed to the Authorization Server as a hint about the End-User's current or past authenticated session with the Client.
loginHintHint to the Authorization Server about the login identifier the End-User might use to log in (if necessary).
acrValuesRequested Authentication Context Class Reference values. Space-separated string that specifies the acr values that the Authorization Server is being requested to use for processing this Authentication Request, with the values appearing in order of preference.
amrValuesRequested Authentication Methods References. JSON array of strings that are identifiers for authentication methods used in the authentication. For instance, values might indicate that both password and OTP authentication methods were used. The definition of particular values to be used in the amr Claim is beyond the scope of this specification.The amr value is an array of case sensitive strings.
requestA JWT encoded OpenID Request Object.
requestUriAn URL that points to an OpenID Request Object.
codeChallengePKCE code challenge
codeChallengeMethodPKCE code challenge method
requestSessionIdrequest session id
sessionIdsession id
accessTokenaccess token
httpRequesthttp request
securityContextAn injectable interface that provides access to security related information.
戻り値

When the responseType parameter is set to code:

If the resource owner grants the access request, the authorization server issues an authorization code and delivers it to the client by adding the following parameters to the query component of the redirection URI using the application/x-www-form-urlencoded format:

code
The authorization code generated by the authorization server.
state
If the state parameter was present in the client authorization request. The exact value received from the client.

When the responseType parameter is set to token:

If the resource owner grants the access request, the authorization server issues an access token and delivers it to the client by adding the following parameters to the fragment component of the redirection URI using the application/x-www-form-urlencoded format.

access_token
The access token issued by the authorization server.
token_type
The type of the token issued. Value is case insensitive.
expires_in
The lifetime in seconds of the access token. For example, the value 3600 denotes that the access token will expire in one hour from the time the response was generated.
scope
The scope of the access token.
state
If the state parameter was present in the client authorization request. The exact value received from the client.

◆ requestAuthorizationPost() [1/2]

Response org.xdi.oxauth.authorize.ws.rs.AuthorizeRestWebServiceImpl.requestAuthorizationPost ( String  scope,
String  responseType,
String  clientId,
String  redirectUri,
String  state,
String  responseMode,
String  nonce,
String  display,
String  prompt,
Integer  maxAge,
String  uiLocales,
String  idTokenHint,
String  loginHint,
String  acrValues,
String  amrValues,
String  request,
String  requestUri,
String  requestSessionId,
String  sessionId,
String  accessToken,
String  originHeaders,
String  codeChallenge,
String  codeChallengeMethod,
String  customResponseHeaders,
String  claims,
HttpServletRequest  httpRequest,
HttpServletResponse  httpResponse,
SecurityContext  securityContext 
)
inline
167  {
168  return requestAuthorization(scope, responseType, clientId, redirectUri, state, responseMode, nonce, display,
169  prompt, maxAge, uiLocales, idTokenHint, loginHint, acrValues, amrValues, request, requestUri,
170  requestSessionId, sessionId, accessToken, HttpMethod.POST, originHeaders, codeChallenge,
171  codeChallengeMethod, customResponseHeaders, claims, httpRequest, httpResponse, securityContext);
172  }
Response requestAuthorization(String scope, String responseType, String clientId, String redirectUri, String state, String respMode, String nonce, String display, String prompt, Integer maxAge, String uiLocalesStr, String idTokenHint, String loginHint, String acrValuesStr, String amrValuesStr, String request, String requestUri, String requestSessionId, String sessionId, String accessToken, String method, String originHeaders, String codeChallenge, String codeChallengeMethod, String customRespHeaders, String claims, HttpServletRequest httpRequest, HttpServletResponse httpResponse, SecurityContext securityContext)
Definition: AuthorizeRestWebServiceImpl.java:174

◆ requestAuthorizationPost() [2/2]

Response org.xdi.oxauth.authorize.ws.rs.AuthorizeRestWebService.requestAuthorizationPost ( @FormParam("scope") @ApiParam(value="OpenID Connect requests MUST contain the openid scope value. If the openid scope value is not present, the behavior is entirely unspecified. Other scope values MAY be present. Scope values used that are not understood by an implementation SHOULD be ignored.", required=true) String  scope,
@FormParam("response_type") @ApiParam(value="OAuth 2.0 Response Type value that determines the authorization processing flow to be used, including what parameters are returned from the endpoints used. When using the Authorization Code Flow, this value is code. ", required=true) String  responseType,
@FormParam("client_id") @ApiParam(value="OAuth 2.0 Client Identifier valid at the Authorization Server. ", required=true) String  clientId,
@FormParam("redirect_uri") @ApiParam(value="Redirection URI to which the response will be sent. This URI MUST exactly match one of the Redirection URI values for the Client pre-registered at the OpenID Provider", required=true) String  redirectUri,
@FormParam("state") @ApiParam(value="Opaque value used to maintain state between the request and the callback. Typically, Cross-Site Request Forgery (CSRF, XSRF) mitigation is done by cryptographically binding the value of this parameter with a browser cookie. ", required=false) String  state,
@QueryParam("response_mode") @ApiParam(value="Informs the Authorization Server of the mechanism to be used for returning parameters from the Authorization Endpoint. This use of this parameter is NOT RECOMMENDED when the Response Mode that would be requested is the default mode specified for the Response Type. ", required=false) String  responseMode,
@FormParam("nonce") @ApiParam(value="String value used to associate a Client session with an ID Token, and to mitigate replay attacks. The value is passed through unmodified from the Authorization Request to the ID Token. Sufficient entropy MUST be present in the nonce values used to prevent attackers from guessing values.", required=false) String  nonce,
@FormParam("display") @ApiParam(value="ASCII string value that specifies how the Authorization Server displays the authentication and consent user interface pages to the End-User. The defined values are: page, popup, touch, wap", required=false) String  display,
@FormParam("prompt") @ApiParam(value="Space delimited, case sensitive list of ASCII string values that specifies whether the Authorization Server prompts the End-User for reauthentication and consent. The defined values are: none, login, consent, select_account", required=false) String  prompt,
@FormParam("max_age") @ApiParam(value="Maximum Authentication Age. Specifies the allowable elapsed time in seconds since the last time the End-User was actively authenticated by the OP. If the elapsed time is greater than this value, the OP MUST attempt to actively re-authenticate the End-User. (The max_age request parameter corresponds to the OpenID 2.0 PAPE [OpenID.PAPE] max_auth_age request parameter.) When max_age is used, the ID Token returned MUST include an auth_time Claim Value. ", required=false) Integer  maxAge,
@FormParam("ui_locales") @ApiParam(value="End-User's preferred languages and scripts for the user interface, represented as a space-separated list of BCP47 [RFC5646] language tag values, ordered by preference. For instance, the value \CA fr en\presents a preference for French as spoken in Canada, then French (without a region designation), followed by English (without a region designation). An error SHOULD NOT result if some or all of the requested locales are not supported by the OpenID Provider. ", required=false) String  uiLocales,
@FormParam("id_token_hint") @ApiParam(value="ID Token previously issued by the Authorization Server being passed as a hint about the End-User's current or past authenticated session with the Client. If the End-User identified by the ID Token is logged in or is logged in by the request, then the Authorization Server returns a positive response; otherwise, it SHOULD return an error, such as login_required. When possible, an id_token_hint SHOULD be present when prompt=none is used and an invalid_request error MAY be returned if it is not; however, the server SHOULD respond successfully when possible, even if it is not present. The Authorization Server need not be listed as an audience of the ID Token when it is used as an id_token_hint value. ", required=false) String  idTokenHint,
@FormParam("login_hint") @ApiParam(value="Hint to the Authorization Server about the login identifier the End-User might use to log in (if necessary). This hint can be used by an RP if it first asks the End-User for their e-mail address (or other identifier) and then wants to pass that value as a hint to the discovered authorization service. It is RECOMMENDED that the hint value match the value used for discovery. This value MAY also be a phone number in the format specified for the phone_number Claim. The use of this parameter is left to the OP's discretion. ", required=false) String  loginHint,
@FormParam("acr_values") @ApiParam(value="Requested Authentication Context Class Reference values. Space-separated string that specifies the acr values that the Authorization Server is being requested to use for processing this Authentication Request, with the values appearing in order of preference. The Authentication Context Class satisfied by the authentication performed is returned as the acr Claim Value, as specified in Section 2. The acr Claim is requested as a Voluntary Claim by this parameter. ", required=false) String  acrValues,
@FormParam("amr_values") @ApiParam(value="AMR Values", required=false) String  amrValues,
@FormParam("request") @ApiParam(value="This parameter enables OpenID Connect requests to be passed in a single, self-contained parameter and to be optionally signed and/or encrypted. The parameter value is a Request Object value, as specified in Section 6.1. It represents the request as a JWT whose Claims are the request parameters.", required=false) String  request,
@FormParam("request_uri") @ApiParam(value="This parameter enables OpenID Connect requests to be passed by reference, rather than by value. The request_uri value is a URL using the https scheme referencing a resource containing a Request Object value, which is a JWT containing the request parameters. ", required=false) String  requestUri,
@FormParam("request_session_id") @ApiParam(value="Request session id", required=false) String  requestSessionId,
@FormParam("session_id") @ApiParam(value="Session id of this call", required=false) String  sessionId,
@FormParam("access_token") @ApiParam(value="Access token", required=false) String  accessToken,
@FormParam("origin_headers") @ApiParam(value="Origin headers. Used in custom workflows.", required=false) String  originHeaders,
@QueryParam("code_challenge") @ApiParam(value="PKCE code challenge.", required=false) String  codeChallenge,
@QueryParam("code_challenge_method") @ApiParam(value="PKCE code challenge method.", required=false) String  codeChallengeMethod,
@QueryParam(AuthorizeRequestParam.CUSTOM_RESPONSE_HEADERS) @ApiParam(value="Custom Response Headers.", required=false) String  customResponseHeaders,
@QueryParam("claims") @ApiParam(value="Requested Claims.", required=false) String  claims,
@Context HttpServletRequest  httpRequest,
@Context HttpServletResponse  httpResponse,
@Context SecurityContext  securityContext 
)
inherited

メンバ詳解

◆ appConfiguration

AppConfiguration org.xdi.oxauth.authorize.ws.rs.AuthorizeRestWebServiceImpl.appConfiguration
private

◆ applicationAuditLogger

ApplicationAuditLogger org.xdi.oxauth.authorize.ws.rs.AuthorizeRestWebServiceImpl.applicationAuditLogger
private

◆ authenticationFilterService

AuthenticationFilterService org.xdi.oxauth.authorize.ws.rs.AuthorizeRestWebServiceImpl.authenticationFilterService
private

◆ authorizationGrantList

AuthorizationGrantList org.xdi.oxauth.authorize.ws.rs.AuthorizeRestWebServiceImpl.authorizationGrantList
private

◆ clientAuthorizationsService

ClientAuthorizationsService org.xdi.oxauth.authorize.ws.rs.AuthorizeRestWebServiceImpl.clientAuthorizationsService
private

◆ clientService

ClientService org.xdi.oxauth.authorize.ws.rs.AuthorizeRestWebServiceImpl.clientService
private

◆ errorResponseFactory

ErrorResponseFactory org.xdi.oxauth.authorize.ws.rs.AuthorizeRestWebServiceImpl.errorResponseFactory
private

◆ identity

Identity org.xdi.oxauth.authorize.ws.rs.AuthorizeRestWebServiceImpl.identity
private

◆ log

Logger org.xdi.oxauth.authorize.ws.rs.AuthorizeRestWebServiceImpl.log
private

◆ redirectionUriService

RedirectionUriService org.xdi.oxauth.authorize.ws.rs.AuthorizeRestWebServiceImpl.redirectionUriService
private

◆ requestParameterService

RequestParameterService org.xdi.oxauth.authorize.ws.rs.AuthorizeRestWebServiceImpl.requestParameterService
private

◆ scopeChecker

ScopeChecker org.xdi.oxauth.authorize.ws.rs.AuthorizeRestWebServiceImpl.scopeChecker
private

◆ sessionIdService

SessionIdService org.xdi.oxauth.authorize.ws.rs.AuthorizeRestWebServiceImpl.sessionIdService
private

◆ userService

UserService org.xdi.oxauth.authorize.ws.rs.AuthorizeRestWebServiceImpl.userService
private

このクラス詳解は次のファイルから抽出されました: