Class AbstractOIDCEntityResolver<Key extends com.nimbusds.oauth2.sdk.id.Identifier,Value>
- java.lang.Object
-
- net.shibboleth.utilities.java.support.component.AbstractInitializableComponent
-
- net.shibboleth.utilities.java.support.component.AbstractIdentifiedInitializableComponent
-
- net.shibboleth.utilities.java.support.component.AbstractIdentifiableInitializableComponent
-
- net.shibboleth.oidc.metadata.impl.AbstractOIDCEntityResolver<Key,Value>
-
- Type Parameters:
Key- The identifier type in the backing storeValue- The entity type in the backing store
- All Implemented Interfaces:
Component,DestructableComponent,IdentifiableComponent,IdentifiedComponent,InitializableComponent
- Direct Known Subclasses:
AbstractReloadingOIDCEntityResolver
public abstract class AbstractOIDCEntityResolver<Key extends com.nimbusds.oauth2.sdk.id.Identifier,Value> extends AbstractIdentifiableInitializableComponent
A base class forResolvers used for resolving entities containing identifiers based onIdentifier.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classAbstractOIDCEntityResolver.JsonBackingStoreThe collection of data which provides the backing store for the processed metadata.
-
Field Summary
Fields Modifier and Type Field Description private booleanfailFastInitializationWhether problems during initialization should cause the provider to fail or go on without metadata.private AbstractOIDCEntityResolver.JsonBackingStorejsonBackingStoreBacking store for runtime JSON data.private org.slf4j.LoggerlogClass logger.private StringlogPrefixLogging prefix.
-
Constructor Summary
Constructors Constructor Description AbstractOIDCEntityResolver()Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected AbstractOIDCEntityResolver.JsonBackingStorecreateNewBackingStore()Create a new backing store instance for entity data.protected voiddoInitialize()protected AbstractOIDCEntityResolver.JsonBackingStoregetBackingStore()Get the entity backing store currently in use by the metadata resolver.protected StringgetLogPrefix()Return a prefix for logging messages for this component.protected voidindexEntityDescriptor(Value entityDescriptor, Key key, AbstractOIDCEntityResolver.JsonBackingStore backingStore)Index the specified entity descriptor, updating the specified entity backing store instance as necessary.protected voidinitOIDCResolver()Initializes this resolver by creating a new backing store.booleanisFailFastInitialization()Gets whether problems during initialization should cause the provider to fail or go on without metadata.protected List<Value>lookupIdentifier(Key identifier)Get list of information matching a given identifier.protected List<Value>lookupIndexedIdentifier(Key identifier)Lookup the specified identifier from the index.protected voidpreProcessEntityDescriptor(Value entityDescriptor, Key key, AbstractOIDCEntityResolver.JsonBackingStore backingStore)Pre-process the specified entity descriptor, updating the specified entity backing store instance as necessary.protected voidremoveByIdentifier(Key identifier, AbstractOIDCEntityResolver.JsonBackingStore backingStore)Remove from the backing store all metadata for the entity with the given identifier.protected voidsetBackingStore(AbstractOIDCEntityResolver.JsonBackingStore newBackingStore)Set the entity backing store currently in use by the metadata resolver.voidsetFailFastInitialization(boolean failFast)Sets whether problems during initialization should cause the provider to fail or go on without metadata.-
Methods inherited from class net.shibboleth.utilities.java.support.component.AbstractIdentifiableInitializableComponent
setId
-
Methods inherited from class net.shibboleth.utilities.java.support.component.AbstractIdentifiedInitializableComponent
getId
-
Methods inherited from class net.shibboleth.utilities.java.support.component.AbstractInitializableComponent
destroy, doDestroy, initialize, isDestroyed, isInitialized
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.shibboleth.utilities.java.support.component.IdentifiedComponent
getId
-
-
-
-
Field Detail
-
log
private final org.slf4j.Logger log
Class logger.
-
jsonBackingStore
private AbstractOIDCEntityResolver.JsonBackingStore jsonBackingStore
Backing store for runtime JSON data.
-
logPrefix
private String logPrefix
Logging prefix.
-
failFastInitialization
private boolean failFastInitialization
Whether problems during initialization should cause the provider to fail or go on without metadata. The assumption being that in most cases a provider will recover at some point in the future. Default: true.
-
-
Method Detail
-
getLogPrefix
@Nonnull @NotEmpty protected String getLogPrefix()
Return a prefix for logging messages for this component.- Returns:
- a string for insertion at the beginning of any log messages
-
isFailFastInitialization
public boolean isFailFastInitialization()
Gets whether problems during initialization should cause the provider to fail or go on without metadata. The assumption being that in most cases a provider will recover at some point in the future.- Returns:
- whether problems during initialization should cause the provider to fail
-
setFailFastInitialization
public void setFailFastInitialization(boolean failFast)
Sets whether problems during initialization should cause the provider to fail or go on without metadata. The assumption being that in most cases a provider will recover at some point in the future.- Parameters:
failFast- whether problems during initialization should cause the provider to fail
-
doInitialize
protected void doInitialize() throws ComponentInitializationException- Overrides:
doInitializein classAbstractIdentifiedInitializableComponent- Throws:
ComponentInitializationException
-
initOIDCResolver
protected void initOIDCResolver() throws ComponentInitializationExceptionInitializes this resolver by creating a new backing store.- Throws:
ComponentInitializationException- If the initialization fails.
-
lookupIdentifier
@Nonnull @NonnullElements protected List<Value> lookupIdentifier(@Nonnull @NotEmpty Key identifier) throws ResolverException
Get list of information matching a given identifier.- Parameters:
identifier- identifier to lookup- Returns:
- a list of information
- Throws:
ResolverException- if an error occurs
-
lookupIndexedIdentifier
@Nonnull @NonnullElements protected List<Value> lookupIndexedIdentifier(@Nonnull @NotEmpty Key identifier)
Lookup the specified identifier from the index. The returned list will be a copy of what is stored in the backing index, and is safe to be manipulated by callers.- Parameters:
identifier- the identifier to lookup- Returns:
- list copy of indexed identifiers, may be empty, will never be null
-
preProcessEntityDescriptor
protected void preProcessEntityDescriptor(@Nonnull Value entityDescriptor, @Nonnull Key key, @Nonnull AbstractOIDCEntityResolver.JsonBackingStore backingStore)Pre-process the specified entity descriptor, updating the specified entity backing store instance as necessary.- Parameters:
entityDescriptor- the target entity descriptor to processkey- key to entitybackingStore- the backing store instance to update
-
removeByIdentifier
protected void removeByIdentifier(@Nonnull Key identifier, @Nonnull AbstractOIDCEntityResolver.JsonBackingStore backingStore)Remove from the backing store all metadata for the entity with the given identifier.- Parameters:
identifier- the identifier of the metadata to removebackingStore- the backing store instance to update
-
indexEntityDescriptor
protected void indexEntityDescriptor(@Nonnull Value entityDescriptor, @Nonnull Key key, @Nonnull AbstractOIDCEntityResolver.JsonBackingStore backingStore)Index the specified entity descriptor, updating the specified entity backing store instance as necessary.- Parameters:
entityDescriptor- the target entity descriptor to processkey- key to entitybackingStore- the backing store instance to update
-
createNewBackingStore
@Nonnull protected AbstractOIDCEntityResolver.JsonBackingStore createNewBackingStore()
Create a new backing store instance for entity data. Subclasses may override to return a more specialized subclass type. Note this method does not make the returned backing store the effective one in use. The caller is responsible for callingsetBackingStore(AbstractOIDCEntityResolver.JsonBackingStore)to make it the effective instance in use.- Returns:
- the new backing store instance
-
getBackingStore
@Nonnull protected AbstractOIDCEntityResolver.JsonBackingStore getBackingStore()
Get the entity backing store currently in use by the metadata resolver.- Returns:
- the current effective entity backing store
-
setBackingStore
protected void setBackingStore(@Nonnull AbstractOIDCEntityResolver.JsonBackingStore newBackingStore)Set the entity backing store currently in use by the metadata resolver.- Parameters:
newBackingStore- the new entity backing store
-
-