public class OAuth2Context extends AbstractContext
OAuth2Context
could be used to store and retrieve an AccessTokenInfo
.
Once a ResourceServerFilter
has authorized an OAuth2 request and
obtained the access token's state, the access token can be stored in the
OAuth2Context
in order to influence subsequent processing of the request.
For example, the information provided in the AccessToken may be used for additional fine-grained authorization.
The following code illustrates how an application may store/retrieve an access token:
AccessToken accessToken = ...; Context parentContext = ...; // Create the OAuth2 context and store the access token OAuth2Context context = new OAuth2Context(parentContext, accessToken); [...] AccessToken myToken = context.asContext(OAuth2Context.class).getAccessToken();
data
Constructor and Description |
---|
OAuth2Context(Context parent,
AccessTokenInfo accessToken)
Creates a new OAuth2 context with the provided
AccessTokenInfo . |
Modifier and Type | Method and Description |
---|---|
AccessTokenInfo |
getAccessToken()
Returns the access token associated with this OAuth2 context.
|
asContext, containsContext, containsContext, getContext, getContextName, getId, getParent, getRootId, isRootContext, toJsonValue, toString
public OAuth2Context(Context parent, AccessTokenInfo accessToken)
AccessTokenInfo
.parent
- The parent context.accessToken
- The access token to store.public AccessTokenInfo getAccessToken()
Copyright © 2010-2018, ForgeRock All Rights Reserved.