Package org.forgerock.oauth2.core
Interface OAuth2Request
- All Superinterfaces:
org.forgerock.oauth2.core.BasicOAuth2Request
An abstraction of the actual request so as to allow the core of the OAuth2 provider to be agnostic of the library
used to translate the HTTP request.
- Since:
- 7.0.0
-
Method Summary
Modifier and TypeMethodDescriptiongetAttribute(String name) Gets the value for an attribute from the request with the specified name.getBody()Gets the body of the request.org.forgerock.oauth2.core.ClientGets the client associated with this request, or null if not yet set.org.forgerock.oauth2.core.ClientRegistrationGet the OAuth2 client registration of the request.Get the request locale.getOps()Gets the user's session public reference for this request.<T> TgetParameter(String name) Gets the specified parameter from the request.<T> TgetParameter(String name, boolean checkQueryParam) Gets the specified parameter from the request.intgetParameterCount(String name) Gets the count of the parameter present in the request with the given nameGets the name of the parameters in the current requestgetQueryParameter(String name) Gets the value for a query parameter from the request with the specified name.Gets the actual underlying request.Gets the user's session for this request.getSid()Gets the session's OIDC Session ID for this request.<T extends Token>
TGet a Token that is in play for this request.Get all the tokens that have been used in this request.voidsetClient(org.forgerock.oauth2.core.Client client) Sets the client associated with this request.voidsetClientRegistration(org.forgerock.oauth2.core.ClientRegistration clientRegistration) Set the OAuth2 client registration.voidvoidSets the user's session public reference for this request.voidsetSession(String sessionId) Sets the user's session for this request.voidSets the session's OIDC Session ID for this request.<T extends Token>
voidSet a Token that is in play for this request.
-
Method Details
-
getRequest
Gets the actual underlying request.- Returns:
- The underlying request.
-
getParameter
Gets the specified parameter from the request.
Used to call the overloaded getParameter method with checkQueryParam set to true. The checkQueryParam enables us to prevent checking the query parameters from the request.- Type Parameters:
T- The type of the parameter.- Parameters:
name- The name of the parameter.- Returns:
- The parameter value or null if no parameter found.
-
getParameter
Gets the specified parameter from the request.This method will first check the attributes then query string if checkQueryParam == true, then move onto check entity values if it is a post.
Historically the request's realm would be obtained from this method but as this now comes from the CHF context, the
BasicOAuth2Request.getRealm()andgetClientRealm()should be used instead.- Type Parameters:
T- The type of the parameter.- Parameters:
name- The name of the parameter. "realm" is not accepted.checkQueryParam- boolean value indicating if the query parameter should be checked.- Returns:
- The parameter value or null if no parameter found.
-
getParameterCount
Gets the count of the parameter present in the request with the given name- Parameters:
name- The name of the parameter- Returns:
- The count of the the parameter with the given name
-
getParameterNames
Gets the name of the parameters in the current request- Returns:
- The parameter names in the request
-
getAttribute
Gets the value for an attribute from the request with the specified name.- Parameters:
name- The name.- Returns:
- The attribute value, may be
null
-
getQueryParameter
Gets the value for a query parameter from the request with the specified name.- Parameters:
name- The name.- Returns:
- The query parameter value, may be
null.
-
getBody
Gets the body of the request.
Note: reading of the body maybe a one time only operation, so the implementation needs to cache the content of the body so multiple calls to this method do not behave differently.
This method should only ever be called for access and refresh token request and requests to the userinfo and tokeninfo endpoints.- Returns:
- The body of the request.
-
setToken
Set a Token that is in play for this request.- Type Parameters:
T- The type of token.- Parameters:
tokenClass- The token type.token- The token instance.
-
getToken
Get a Token that is in play for this request.- Type Parameters:
T- The type of token.- Parameters:
tokenClass- The token type.- Returns:
- The token instance.
-
getTokens
Get all the tokens that have been used in this request.- Returns:
- The token instances.
-
setSession
Sets the user's session for this request.- Parameters:
sessionId- The user's session.
-
getSession
Gets the user's session for this request.- Returns:
- The user's session.
-
setOps
Sets the user's session public reference for this request.- Parameters:
ops- The user's session public reference.
-
getOps
Gets the user's session public reference for this request.- Returns:
- The user's session public reference.
-
setSid
Sets the session's OIDC Session ID for this request.- Parameters:
sid- the OIDC SID.
-
getSid
Gets the session's OIDC Session ID for this request.- Returns:
- the SID.
-
getLocale
Get the request locale.- Returns:
- The Locale object.
-
getClientRegistration
Get the OAuth2 client registration of the request.- Returns:
- The client registration.
-
setConsentResponseJwt
- Parameters:
jwt- A possibly null consent response to assign to this request.
-
getConsentResponseJwt
- Returns:
- A possibly null
SignedJwtif assigned.
-
setClientRegistration
@Supported void setClientRegistration(org.forgerock.oauth2.core.ClientRegistration clientRegistration) Set the OAuth2 client registration.- Parameters:
clientRegistration- The client registration.
-
getClient
Gets the client associated with this request, or null if not yet set. UseClientDAO.read(String, OAuth2Request)if not yet set.- Returns:
- the client associated with this request.
-
setClient
Sets the client associated with this request.- Parameters:
client- the client to associate with this request.
-