@Extensible @IdentityBrokerExtension @ThreadSafety(level=INTERFACE_THREADSAFE) public abstract class StoreAdapter extends java.lang.Object implements UnboundIDExtension, Configurable, ExampleUsageProvider
A Store Adapter can optionally support authentication by implementing the
supportsAuthentication()
and
authenticate(StoreAuthenticationRequest)
methods.
A Store Adapter can also opt to store the Identity Broker user metadata attributes, which contain the consents, OAuth tokens, and consent history, among other things. This metadata is separated into two categories: small and large. Both types are multi-valued and store raw binary values. The main difference is that the "small" metadata will typically contain small binary values and be accessed more frequently, whereas the "large" metadata will contain more sizable values (or a larger number of values) and be accessed less frequently. Implementers should take this into consideration when deciding where to store these metadata attributes.
After the StoreAdapter is initialized (via the initializeStoreAdapter()
method), all methods will be guarded by a call to isAvailable()
to
make sure that the adapter is currently connected and ready to service
requests. If this returns false
, the DataView will return an
appropriate 503 response code to clients until the adapter becomes available
again.
dsconfig create-store-adapter \ ---adapter-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.StoreAdapter
,
and "{name=value}" represents name-value pairs for any arguments to
provide to the store adapter. If multiple arguments should be
provided to extension, then the
"--set extension-argument:{name=value}
" option should be
provided multiple times.Constructor and Description |
---|
StoreAdapter()
Creates a new instance of this store adapter.
|
Modifier and Type | Method and Description |
---|---|
boolean |
authenticate(java.lang.String scimId,
AuthenticationRequest request)
Authenticate the specified user against the backend data store.
|
abstract com.unboundid.scim.data.BaseResource |
create(StoreCreateRequest request)
Create the specified entry in the native data store.
|
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.
|
abstract void |
delete(StoreDeleteRequest request)
Delete the specified entry from the native data store.
|
void |
finalizeStoreAdapter()
This hook is called when the DataView is disabled or the Identity Broker
shuts down.
|
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.
|
abstract com.unboundid.scim.schema.ResourceDescriptor |
getNativeSchema()
Gets a ResourceDescriptor that describes the schema for the objects that
will be returned by this StoreAdapter.
|
java.util.Collection<com.unboundid.util.ByteString> |
getUserIndexedMetaData(java.lang.String scimId)
Retrieve the user indexed metadata for the specified user.
|
java.util.Collection<com.unboundid.util.ByteString> |
getUserLargeMetaData(java.lang.String scimId)
Retrieve the user large metadata for the specified user.
|
java.util.Collection<com.unboundid.util.ByteString> |
getUserMetaData(java.lang.String scimId)
Retrieve the user metadata for the specified user.
|
void |
initializeStoreAdapter(IdentityBrokerContext serverContext,
StoreAdapterConfig config,
com.unboundid.util.args.ArgumentParser parser)
Initializes this store adapter.
|
abstract boolean |
isAvailable()
Determines whether this StoreAdapter is currently available and
in-service.
|
abstract com.unboundid.scim.sdk.Resources<? extends com.unboundid.scim.data.BaseResource> |
search(StoreSearchRequest request)
Fetches the entries that match the specified criteria.
|
com.unboundid.scim.sdk.Resources<? extends com.unboundid.scim.data.BaseResource> |
searchIndexedMetaData(com.unboundid.scim.sdk.SCIMFilterType filterType,
com.unboundid.util.ByteString value,
com.unboundid.scim.sdk.SCIMQueryAttributes requestAttrs)
Retrieve resources that contain the specified user indexed metadata value.
|
boolean |
supportsAuthentication(java.lang.Class<? extends AuthenticationRequest> request)
Determines whether this StoreAdapter can handle the provided
authentication request.
|
boolean |
supportsUserMetaData()
Determines whether this StoreAdapter supports reading and writing the user
metadata attributes.
|
abstract com.unboundid.scim.data.BaseResource |
update(StoreUpdateRequest request)
Update the specified entry in the native data store.
|
void |
updateUserMetaData(java.lang.String scimId,
MetaDataMods metaDataMods,
MetaDataMods indexedMetaDataMods,
MetaDataMods largeMetaDataMods)
Update the user metadata and/or user indexed metadata for the specified
user with the specified modifications.
|
public StoreAdapter()
initializeStoreAdapter(com.unboundid.directory.sdk.broker.types.IdentityBrokerContext, com.unboundid.directory.sdk.broker.config.StoreAdapterConfig, com.unboundid.util.args.ArgumentParser)
method.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 initializeStoreAdapter(IdentityBrokerContext serverContext, StoreAdapterConfig config, com.unboundid.util.args.ArgumentParser parser) throws java.lang.Exception
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 store adapter.java.lang.Exception
- If a problem occurs while initializing this store
adapter.public void finalizeStoreAdapter()
The default implementation is empty.
public boolean supportsAuthentication(java.lang.Class<? extends AuthenticationRequest> request)
false
,
but subclasses may override this if they do support authentication.request
- the class of the authentication request.public boolean supportsUserMetaData()
false
, but
subclasses may override this if they do support storing the metadata
attributes.public boolean authenticate(java.lang.String scimId, AuthenticationRequest request) throws com.unboundid.scim.sdk.SCIMException, AuthenticationException
scimId
- the id of the user to authenticate.request
- the authentication request.true
if authentication succeeds or false
if this StoreAdaptor is unable to support the authentication
request. In this case, other StoreAdaptors that supports the
authentication request will be tried.com.unboundid.scim.sdk.SCIMException
- if there is a problem authenticating the userAuthenticationException
- if authentication failspublic abstract boolean isAvailable()
false
in the case that all
backend servers are down, for example; during this time the DataView
will return an appropriate 503 response code to clients.true
if the StoreAdapter initialized and connected;
false
otherwise.public abstract com.unboundid.scim.schema.ResourceDescriptor getNativeSchema()
isAvailable()
method will be checked as well.null
.public abstract com.unboundid.scim.sdk.Resources<? extends com.unboundid.scim.data.BaseResource> search(StoreSearchRequest request) throws com.unboundid.scim.sdk.SCIMException
request
- the search requestnull
.com.unboundid.scim.sdk.SCIMException
- if there is a problem fulfilling the search requestpublic abstract com.unboundid.scim.data.BaseResource create(StoreCreateRequest request) throws com.unboundid.scim.sdk.SCIMException
request
- the create requestcom.unboundid.scim.sdk.SCIMException
- if there is a problem creating the entrypublic abstract com.unboundid.scim.data.BaseResource update(StoreUpdateRequest request) throws com.unboundid.scim.sdk.SCIMException
request
- the update requestcom.unboundid.scim.sdk.SCIMException
- if there is a problem modifying the entrypublic abstract void delete(StoreDeleteRequest request) throws com.unboundid.scim.sdk.SCIMException
request
- the delete requestcom.unboundid.scim.sdk.SCIMException
- if there is a problem deleting the entrypublic void updateUserMetaData(java.lang.String scimId, MetaDataMods metaDataMods, MetaDataMods indexedMetaDataMods, MetaDataMods largeMetaDataMods) throws com.unboundid.scim.sdk.SCIMException
scimId
- the id of the user whose metadata is to be updatedmetaDataMods
- the set of modifications to the user metadata
(may be null
)indexedMetaDataMods
- the set of modifications to the indexed metadata
(may be null
)largeMetaDataMods
- the set of modifications to the large metadata
(may be null
)com.unboundid.scim.sdk.SCIMException
- if there is a problem updating the metadatapublic java.util.Collection<com.unboundid.util.ByteString> getUserMetaData(java.lang.String scimId) throws com.unboundid.scim.sdk.SCIMException
scimId
- the id of the usercom.unboundid.scim.sdk.SCIMException
- if there is a problem retrieving the metadatapublic java.util.Collection<com.unboundid.util.ByteString> getUserIndexedMetaData(java.lang.String scimId) throws com.unboundid.scim.sdk.SCIMException
scimId
- the id of the usercom.unboundid.scim.sdk.SCIMException
- if there is a problem retrieving the large metadatapublic java.util.Collection<com.unboundid.util.ByteString> getUserLargeMetaData(java.lang.String scimId) throws com.unboundid.scim.sdk.SCIMException
scimId
- the id of the usercom.unboundid.scim.sdk.SCIMException
- if there is a problem retrieving the large metadatapublic com.unboundid.scim.sdk.Resources<? extends com.unboundid.scim.data.BaseResource> searchIndexedMetaData(com.unboundid.scim.sdk.SCIMFilterType filterType, com.unboundid.util.ByteString value, com.unboundid.scim.sdk.SCIMQueryAttributes requestAttrs) throws com.unboundid.scim.sdk.SCIMException
filterType
- The filter type to use.value
- The user indexed metadata value to search on.requestAttrs
- The attributes to return.null
, but could be empty.com.unboundid.scim.sdk.SCIMException
- if there is a problem fulfilling the search request