public class TokenValidationManager
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
INVALID_TOKEN_ERROR |
Constructor and Description |
---|
TokenValidationManager(java.net.URI authorizationURI,
java.lang.String clientId,
java.lang.String clientSecret)
Constructs a new TokenValidationManager
|
TokenValidationManager(java.net.URI authorizationURI,
java.lang.String clientId,
java.lang.String clientSecret,
long cacheSize)
Constructs a new TokenValidationManager
|
Modifier and Type | Method and Description |
---|---|
protected TokenIntrospectionData |
makeIntrospectionRequest(java.lang.String authorizationHeader) |
java.util.Map |
obtainAccessToken(java.lang.String scope)
Obtains an access token from the Authorization Server's token endpoint.
|
TokenValidationResult |
validate(java.lang.String authorizationHeader)
Validates and returns the Introspection Data of the specified authorization header via the Introspection Endpoint of the AZ server
|
TokenValidationResult |
validate(java.lang.String authorizationHeader,
java.lang.String expectedScope)
Validates and returns the Introspection Data of the specified authorization header via the Introspection Endpoint of the AZ server
|
public static final java.lang.String INVALID_TOKEN_ERROR
public TokenValidationManager(java.net.URI authorizationURI, java.lang.String clientId, java.lang.String clientSecret, long cacheSize) throws TokenValidationException
authorizationURI
- The URI of the Authorization Server for example http://localhost:clientId
- , The confidential-client clientId of the resourceclientSecret
- , The confidential-client secret of the resourcecacheSize
- , the size of the cached access tokens mapping (default 10000)TokenValidationException
public TokenValidationManager(java.net.URI authorizationURI, java.lang.String clientId, java.lang.String clientSecret) throws TokenValidationException
authorizationURI
- The URI of the Authorization Server for example http://localhost:clientId
- , The confidential-client clientId of the resourceclientSecret
- , The confidential-client secret of the resourceTokenValidationException
public TokenValidationResult validate(java.lang.String authorizationHeader, java.lang.String expectedScope) throws TokenValidationException
authorizationHeader
- the authorization header to validateexpectedScope
- the scope to validate this authorization header withTokenValidationException
- in the case of an error connecting to the AZ Serverpublic TokenValidationResult validate(java.lang.String authorizationHeader) throws TokenValidationException
authorizationHeader
- the authorization header to validateTokenValidationException
- in the case of an error connecting to the AZ Serverpublic java.util.Map obtainAccessToken(java.lang.String scope) throws TokenValidationException
scope
- the scope to obtain an access token toTokenValidationException
- if unable to obtain token, its possible this error is thrown if the confidential client of this manager is not allowed to obtain this scopeprotected TokenIntrospectionData makeIntrospectionRequest(java.lang.String authorizationHeader) throws TokenValidationException
TokenValidationException
© Copyright IBM Corp. 2006, 2015. All Rights Reserved.