|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.unboundid.directory.sdk.broker.api.TokenStore
@Extensible @IdentityBrokerExtension @ThreadSafety(level=INTERFACE_THREADSAFE) public abstract class TokenStore
This class defines an API that must be implemented by extensions that wish to store and retrieve authorization codes and access tokens instances for the OAuth 2 service. This type of token store is generic and can support a wide range of repositories. When using multiple Identity Broker instances in a deployment, the repository should be accessible from all instances. In addition, this type of token store has the ability to generate the values of the codes and tokens that are returned to the client application. These values are also used to retrieve the authorization code and access token instances from the token store.
dsconfig create-token-store \ ---store-name "{name}" \ --type third-party \ --set "extension-class:{class-name}" \ --set "extension-argument:{name=value}"where "{name}" is the name to use for the token store instance, "{class-name}" is the fully-qualified name of the Java class that extends
com.unboundid.directory.sdk.broker.api.TokenStore
,
and "{name=value}" represents name-value pairs for any arguments to
provide to the token store. If multiple arguments should be
provided to extension, then the
"--set extension-argument:{name=value}
" option should be
provided multiple times.
Constructor Summary | |
---|---|
TokenStore()
Creates a new instance of this token store. |
Method Summary | |
---|---|
abstract AuthorizationCode |
consumeAuthorizationCode(java.lang.String codeValue)
Retrieves the authorization code associated with the specified code value. |
void |
defineConfigArguments(com.unboundid.util.args.ArgumentParser parser)
Updates the provided argument parser to define any configuration arguments which may be used by this extension. |
void |
finalizeTokenStore()
This hook is called when the Identity Broker shuts down. |
abstract AccessToken |
getAccessToken(java.lang.String tokenValue)
Retrieves the access token associated with the specified token value. |
abstract AccessToken |
getAccessTokenFromRefreshToken(java.lang.String tokenValue)
Retrieves the access token associated with the refresh token value. |
abstract java.util.Collection<AccessToken> |
getAccessTokensByUser(java.lang.String username)
Retrieves all the access tokens associated with the provided username. |
java.util.Map<java.util.List<java.lang.String>,java.lang.String> |
getExamplesArgumentSets()
Retrieves a map containing examples of configurations that may be used for this extension. |
abstract java.lang.String[] |
getExtensionDescription()
Retrieves a human-readable description for this extension. |
abstract java.lang.String |
getExtensionName()
Retrieves a human-readable name for this extension. |
void |
initializeTokenStore(IdentityBrokerContext serverContext,
TokenStoreConfig config,
com.unboundid.util.args.ArgumentParser parser)
Initializes this token store. |
abstract AccessToken |
revokeToken(java.lang.String tokenValue)
Revoke the access token along with the associated refresh token if it exists so they will no longer be considered valid. |
abstract void |
storeAccessToken(AccessToken accessToken)
Store a new access token with an optional refresh token and overwrite any existing tokens for the same application by the same owner. |
abstract void |
storeAuthorizationCode(AuthorizationCode authorizationCode)
Store a new authorization code and overwrite any existing codes for the same application by the same owner. |
java.lang.String |
toString()
Retrieves a string representation of this token store. |
abstract void |
toString(java.lang.StringBuilder buffer)
Appends a string representation of this token store to the provided buffer. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public TokenStore()
initializeTokenStore(com.unboundid.directory.sdk.broker.types.IdentityBrokerContext, com.unboundid.directory.sdk.broker.config.TokenStoreConfig, com.unboundid.util.args.ArgumentParser)
method.
Method Detail |
---|
public abstract java.lang.String getExtensionName()
getExtensionName
in interface UnboundIDExtension
public abstract java.lang.String[] getExtensionDescription()
getExtensionDescription
in interface UnboundIDExtension
null
or an empty array if no description should be available.public java.util.Map<java.util.List<java.lang.String>,java.lang.String> getExamplesArgumentSets()
getExamplesArgumentSets
in interface ExampleUsageProvider
null
or empty if there should
not be any example argument sets.public void defineConfigArguments(com.unboundid.util.args.ArgumentParser parser) throws com.unboundid.util.args.ArgumentException
defineConfigArguments
in interface Configurable
parser
- The argument parser to be updated with the configuration
arguments which may be used by this extension.
com.unboundid.util.args.ArgumentException
- If a problem is encountered while updating the
provided argument parser.public void initializeTokenStore(IdentityBrokerContext serverContext, TokenStoreConfig config, com.unboundid.util.args.ArgumentParser parser) throws com.unboundid.ldap.sdk.LDAPException
IdentityBrokerContext
in
a class member so that it can be used elsewhere in the implementation.
The default implementation is empty.
serverContext
- A handle to the server context for the server in
which this extension is running. Extensions should
typically store this in a class member.config
- The general configuration for this object.parser
- The argument parser which has been initialized from
the configuration for this token store.
com.unboundid.ldap.sdk.LDAPException
- If a problem occurs while initializing this token
store.public void finalizeTokenStore()
The default implementation is empty.
public abstract AuthorizationCode consumeAuthorizationCode(java.lang.String codeValue) throws OAuthException
codeValue
- The value of the authorization code.
null
if the code value is not found.
OAuthException
- if an error occurred while retrieving the
authorization code.public abstract void storeAuthorizationCode(AuthorizationCode authorizationCode) throws OAuthException
AuthorizationCode
instance from the token store by calling the
following on the passed-in authorization code:
AuthorizationCode.setValue()
authorizationCode
- The authorization code to store.
OAuthException
- if an error occurred while creating the
authorization code.public abstract void storeAccessToken(AccessToken accessToken) throws OAuthException
AccessToken
instance from the token store by calling the following
on the passed-in access token:
AccessToken.setValue()
and
AccessToken.getRefreshToken().setValue()
If the provided token's value is not null
, the implementation
should try to use those values to reference the stored token without
generating a new value.
accessToken
- the access token to store.
OAuthException
- if an error occurred while creating the access
token.public abstract AccessToken getAccessToken(java.lang.String tokenValue) throws OAuthException
AccessToken.setRefreshToken()
and the token value set by calling AccessToken.setValue()
.
tokenValue
- The value of the access token.
null
if not found.
OAuthException
- if an error occurred while reading the access tokenpublic abstract AccessToken getAccessTokenFromRefreshToken(java.lang.String tokenValue) throws OAuthException
AccessToken.setRefreshToken()
and the token
value set by calling AccessToken.setValue()
.
tokenValue
- The value of the refresh token.
null
if not found.
OAuthException
- If an error occurred while retrieving the access
token.public abstract java.util.Collection<AccessToken> getAccessTokensByUser(java.lang.String username) throws OAuthException
AccessToken.setRefreshToken()
and the token value set by calling
AccessToken.setValue()
.
username
- The username to use to identify the token user.
null
if not found.
OAuthException
- If an error occurred while revoking the access
token.public abstract AccessToken revokeToken(java.lang.String tokenValue) throws OAuthException
tokenValue
- The value of the access or refresh token to revoke.
null
if the token value was
not found.
OAuthException
- If an error occurred while revoking the access
token.public final java.lang.String toString()
toString
in class java.lang.Object
public abstract void toString(java.lang.StringBuilder buffer)
buffer
- The buffer to which the string representation should be
appended.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |