Package io.jans.as.client
Class AuthorizationRequest
- java.lang.Object
-
- io.jans.as.client.BaseRequest
-
- io.jans.as.client.AuthorizationRequest
-
public class AuthorizationRequest extends BaseRequest
Represents an authorization request to send to the authorization server.- Version:
- April 25, 2022
- Author:
- Javier Rojas Blum
-
-
Field Summary
Fields Modifier and Type Field Description static StringNO_REDIRECT_HEADER
-
Constructor Summary
Constructors Constructor Description AuthorizationRequest(String requestUri)AuthorizationRequest(List<io.jans.as.model.common.ResponseType> responseTypes, String clientId, List<String> scopes, String redirectUri, String nonce)Constructs an authorization request.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description io.jans.as.model.authorize.CodeVerifiergenerateAndSetCodeChallengeWithMethod()StringgetAccessToken()List<String>getAcrValues()StringgetAcrValuesAsString()org.json.JSONObjectgetClaims()StringgetClaimsAsString()List<String>getClaimsLocales()StringgetClaimsLocalesAsString()StringgetClientId()Returns the client identifier.StringgetCodeChallenge()StringgetCodeChallengeMethod()Map<String,String>getCustomResponseHeaders()StringgetCustomResponseHeadersAsString()io.jans.as.model.common.DisplaygetDisplay()Returns an ASCII string value that specifies how the Authorization Server displays the authentication page to the End-User.StringgetIdTokenHint()StringgetLoginHint()IntegergetMaxAge()StringgetNonce()Returns a string value used to associate a user agent session with an ID Token, and to mitigate replay attacks.Map<String,String>getParameters()Returns a collection of parameters of the authorization request.StringgetParQueryString()List<io.jans.as.model.common.Prompt>getPrompts()Returns a space delimited list of ASCII strings that can contain the values login, consent, select_account, and none.StringgetPromptsAsString()StringgetQueryString()Returns a query string with the parameters of the authorization request.StringgetRedirectUri()Returns the redirection URI.StringgetRegistration()StringgetRequest()Returns a JWT encoded OpenID Request Object.StringgetRequestUri()Returns an URL that points to an OpenID Request Object.io.jans.as.model.common.ResponseModegetResponseMode()List<io.jans.as.model.common.ResponseType>getResponseTypes()Returns the response types.StringgetResponseTypesAsString()List<String>getScopes()Returns the scopes of the access request.StringgetScopesAsString()StringgetSessionId()Gets session id.StringgetState()Returns the state.List<String>getUiLocales()StringgetUiLocalesAsString()booleanisRequestSessionId()Returns whether session id is requested.booleanisUseNoRedirectHeader()voidsetAccessToken(String accessToken)voidsetAcrValues(List<String> acrValues)voidsetClaims(org.json.JSONObject claims)voidsetClaimsLocales(List<String> claimsLocales)voidsetClientId(String clientId)Sets the client identifier.voidsetCodeChallenge(String codeChallenge)voidsetCodeChallengeMethod(String codeChallengeMethod)voidsetCustomResponseHeaders(Map<String,String> customResponseHeaders)voidsetDisplay(io.jans.as.model.common.Display display)Sets an ASCII string value that specifies how the Authorization Server displays the authentication page to the End-User.voidsetIdTokenHint(String idTokenHint)voidsetLoginHint(String loginHint)voidsetMaxAge(Integer maxAge)voidsetNonce(String nonce)Sets a string value used to associate a user agent session with an ID Token, and to mitigate replay attacks.voidsetPrompts(List<io.jans.as.model.common.Prompt> prompts)voidsetRedirectUri(String redirectUri)Sets the redirection URI.voidsetRegistration(String registration)voidsetRequest(String request)Sets a JWT encoded OpenID Request Object.voidsetRequestSessionId(boolean requestSessionId)Sets whether session id should be requested.voidsetRequestUri(String requestUri)Sets an URL that points to an OpenID Request Object.voidsetResponseMode(io.jans.as.model.common.ResponseMode responseMode)voidsetResponseTypes(List<io.jans.as.model.common.ResponseType> responseTypes)Sets the response types.voidsetScopes(List<String> scopes)Sets the scope of the access request.voidsetSessionId(String sessionId)Sets session id.voidsetState(String state)Sets the state.voidsetUiLocales(List<String> uiLocales)voidsetUseNoRedirectHeader(boolean useNoRedirectHeader)-
Methods inherited from class io.jans.as.client.BaseRequest
addCustomParameter, getAuthenticationMethod, getAuthorizationMethod, getAuthPassword, getAuthUsername, getContentType, getCredentials, getCustomParameters, getEncodedCredentials, getEncodedCredentials, getJSONParameters, getMediaType, hasCredentials, setAuthenticationMethod, setAuthorizationMethod, setAuthPassword, setAuthUsername, setContentType, setMediaType
-
-
-
-
Field Detail
-
NO_REDIRECT_HEADER
public static final String NO_REDIRECT_HEADER
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
AuthorizationRequest
public AuthorizationRequest(List<io.jans.as.model.common.ResponseType> responseTypes, String clientId, List<String> scopes, String redirectUri, String nonce)
Constructs an authorization request.- Parameters:
responseTypes- The 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.clientId- The client identifier is mandatory.scopes- The scope of the access request.redirectUri- Redirection URInonce- A string value used to associate a user agent session with an ID Token, and to mitigate replay attacks.
-
AuthorizationRequest
public AuthorizationRequest(String requestUri)
-
-
Method Detail
-
generateAndSetCodeChallengeWithMethod
public io.jans.as.model.authorize.CodeVerifier generateAndSetCodeChallengeWithMethod()
-
getCodeChallenge
public String getCodeChallenge()
-
getCodeChallengeMethod
public String getCodeChallengeMethod()
-
setCodeChallenge
public void setCodeChallenge(String codeChallenge)
-
setCodeChallengeMethod
public void setCodeChallengeMethod(String codeChallengeMethod)
-
getResponseTypes
public List<io.jans.as.model.common.ResponseType> getResponseTypes()
Returns the response types.- Returns:
- The response types.
-
setResponseTypes
public void setResponseTypes(List<io.jans.as.model.common.ResponseType> responseTypes)
Sets the response types.- Parameters:
responseTypes- The response types.
-
getClientId
public String getClientId()
Returns the client identifier.- Returns:
- The client identifier.
-
setClientId
public void setClientId(String clientId)
Sets the client identifier.- Parameters:
clientId- The client identifier.
-
getScopes
public List<String> getScopes()
Returns the scopes of the access request. The authorization endpoint allow the client to specify the scope of the access request using the scope request parameter. In turn, the authorization server uses the scope response parameter to inform the client of the scope of the access token issued. The value of the scope parameter is expressed as a list of space-delimited, case sensitive strings.- Returns:
- The scopes of the access request.
-
setScopes
public void setScopes(List<String> scopes)
Sets the scope of the access request. The authorization endpoint allow the client to specify the scope of the access request using the scope request parameter. In turn, the authorization server uses the scope response parameter to inform the client of the scope of the access token issued. The value of the scope parameter is expressed as a list of space-delimited, case sensitive strings.- Parameters:
scopes- The scope of the access request.
-
getRedirectUri
public String getRedirectUri()
Returns the redirection URI.- Returns:
- The redirection URI.
-
setRedirectUri
public void setRedirectUri(String redirectUri)
Sets the redirection URI.- Parameters:
redirectUri- The redirection URI.
-
getState
public String getState()
Returns the state. The state is an 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.- Returns:
- The state.
-
setState
public void setState(String state)
Sets the state. The state is an 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.- Parameters:
state- The state.
-
getResponseMode
public io.jans.as.model.common.ResponseMode getResponseMode()
-
setResponseMode
public void setResponseMode(io.jans.as.model.common.ResponseMode responseMode)
-
getNonce
public String getNonce()
Returns a string value used to associate a user agent session with an ID Token, and to mitigate replay attacks.- Returns:
- The nonce value.
-
setNonce
public void setNonce(String nonce)
Sets a string value used to associate a user agent session with an ID Token, and to mitigate replay attacks.- Parameters:
nonce- The nonce value.
-
getDisplay
public io.jans.as.model.common.Display getDisplay()
Returns an ASCII string value that specifies how the Authorization Server displays the authentication page to the End-User.- Returns:
- The display value.
-
setDisplay
public void setDisplay(io.jans.as.model.common.Display display)
Sets an ASCII string value that specifies how the Authorization Server displays the authentication page to the End-User.- Parameters:
display- The display value.
-
getPrompts
public List<io.jans.as.model.common.Prompt> getPrompts()
Returns a space delimited list of ASCII strings that can contain the values login, consent, select_account, and none.- Returns:
- The prompt list.
-
setPrompts
public void setPrompts(List<io.jans.as.model.common.Prompt> prompts)
-
getMaxAge
public Integer getMaxAge()
-
setMaxAge
public void setMaxAge(Integer maxAge)
-
getIdTokenHint
public String getIdTokenHint()
-
setIdTokenHint
public void setIdTokenHint(String idTokenHint)
-
getLoginHint
public String getLoginHint()
-
setLoginHint
public void setLoginHint(String loginHint)
-
getClaims
public org.json.JSONObject getClaims()
-
setClaims
public void setClaims(org.json.JSONObject claims)
-
getRegistration
public String getRegistration()
-
setRegistration
public void setRegistration(String registration)
-
getRequest
public String getRequest()
Returns a JWT encoded OpenID Request Object.- Returns:
- A JWT encoded OpenID Request Object.
-
setRequest
public void setRequest(String request)
Sets a JWT encoded OpenID Request Object.- Parameters:
request- A JWT encoded OpenID Request Object.
-
getRequestUri
public String getRequestUri()
Returns an URL that points to an OpenID Request Object.- Returns:
- An URL that points to an OpenID Request Object.
-
setRequestUri
public void setRequestUri(String requestUri)
Sets an URL that points to an OpenID Request Object.- Parameters:
requestUri- An URL that points to an OpenID Request Object.
-
isRequestSessionId
public boolean isRequestSessionId()
Returns whether session id is requested.- Returns:
- whether session id is requested
-
setRequestSessionId
public void setRequestSessionId(boolean requestSessionId)
Sets whether session id should be requested.- Parameters:
requestSessionId- session id.
-
getSessionId
public String getSessionId()
Gets session id.- Returns:
- session id.
-
setSessionId
public void setSessionId(String sessionId)
Sets session id.- Parameters:
sessionId- session id
-
getAccessToken
public String getAccessToken()
-
setAccessToken
public void setAccessToken(String accessToken)
-
isUseNoRedirectHeader
public boolean isUseNoRedirectHeader()
-
setUseNoRedirectHeader
public void setUseNoRedirectHeader(boolean useNoRedirectHeader)
-
getResponseTypesAsString
public String getResponseTypesAsString()
-
getScopesAsString
public String getScopesAsString()
-
getPromptsAsString
public String getPromptsAsString()
-
getUiLocalesAsString
public String getUiLocalesAsString()
-
getClaimsLocalesAsString
public String getClaimsLocalesAsString()
-
getAcrValuesAsString
public String getAcrValuesAsString()
-
getCustomResponseHeadersAsString
public String getCustomResponseHeadersAsString() throws org.json.JSONException
- Throws:
org.json.JSONException
-
setCustomResponseHeaders
public void setCustomResponseHeaders(Map<String,String> customResponseHeaders)
-
getClaimsAsString
public String getClaimsAsString()
-
getParQueryString
public String getParQueryString()
-
getQueryString
public String getQueryString()
Returns a query string with the parameters of the authorization request. Anynullor empty parameter will be omitted.- Specified by:
getQueryStringin classBaseRequest- Returns:
- A query string of parameters.
-
getParameters
public Map<String,String> getParameters()
Returns a collection of parameters of the authorization request. Anynullor empty parameter will be omitted.- Overrides:
getParametersin classBaseRequest- Returns:
- A collection of parameters.
-
-