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 String
NO_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.CodeVerifier
generateAndSetCodeChallengeWithMethod()
String
getAccessToken()
List<String>
getAcrValues()
String
getAcrValuesAsString()
org.json.JSONObject
getClaims()
String
getClaimsAsString()
List<String>
getClaimsLocales()
String
getClaimsLocalesAsString()
String
getClientId()
Returns the client identifier.String
getCodeChallenge()
String
getCodeChallengeMethod()
Map<String,String>
getCustomResponseHeaders()
String
getCustomResponseHeadersAsString()
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.String
getIdTokenHint()
String
getLoginHint()
Integer
getMaxAge()
String
getNonce()
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.String
getParQueryString()
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.String
getPromptsAsString()
String
getQueryString()
Returns a query string with the parameters of the authorization request.String
getRedirectUri()
Returns the redirection URI.String
getRegistration()
String
getRequest()
Returns a JWT encoded OpenID Request Object.String
getRequestUri()
Returns an URL that points to an OpenID Request Object.io.jans.as.model.common.ResponseMode
getResponseMode()
List<io.jans.as.model.common.ResponseType>
getResponseTypes()
Returns the response types.String
getResponseTypesAsString()
List<String>
getScopes()
Returns the scopes of the access request.String
getScopesAsString()
String
getSessionId()
Gets session id.String
getState()
Returns the state.List<String>
getUiLocales()
String
getUiLocalesAsString()
boolean
isRequestSessionId()
Returns whether session id is requested.boolean
isUseNoRedirectHeader()
void
setAccessToken(String accessToken)
void
setAcrValues(List<String> acrValues)
void
setClaims(org.json.JSONObject claims)
void
setClaimsLocales(List<String> claimsLocales)
void
setClientId(String clientId)
Sets the client identifier.void
setCodeChallenge(String codeChallenge)
void
setCodeChallengeMethod(String codeChallengeMethod)
void
setCustomResponseHeaders(Map<String,String> customResponseHeaders)
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.void
setIdTokenHint(String idTokenHint)
void
setLoginHint(String loginHint)
void
setMaxAge(Integer maxAge)
void
setNonce(String nonce)
Sets a string value used to associate a user agent session with an ID Token, and to mitigate replay attacks.void
setPrompts(List<io.jans.as.model.common.Prompt> prompts)
void
setRedirectUri(String redirectUri)
Sets the redirection URI.void
setRegistration(String registration)
void
setRequest(String request)
Sets a JWT encoded OpenID Request Object.void
setRequestSessionId(boolean requestSessionId)
Sets whether session id should be requested.void
setRequestUri(String requestUri)
Sets an URL that points to an OpenID Request Object.void
setResponseMode(io.jans.as.model.common.ResponseMode responseMode)
void
setResponseTypes(List<io.jans.as.model.common.ResponseType> responseTypes)
Sets the response types.void
setScopes(List<String> scopes)
Sets the scope of the access request.void
setSessionId(String sessionId)
Sets session id.void
setState(String state)
Sets the state.void
setUiLocales(List<String> uiLocales)
void
setUseNoRedirectHeader(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. Anynull
or empty parameter will be omitted.- Specified by:
getQueryString
in classBaseRequest
- Returns:
- A query string of parameters.
-
getParameters
public Map<String,String> getParameters()
Returns a collection of parameters of the authorization request. Anynull
or empty parameter will be omitted.- Overrides:
getParameters
in classBaseRequest
- Returns:
- A collection of parameters.
-
-