Class AbstractReloadingOIDCEntityResolver<Key extends Identifier,Value>
java.lang.Object
net.shibboleth.shared.component.AbstractInitializableComponent
net.shibboleth.shared.component.AbstractIdentifiedInitializableComponent
net.shibboleth.shared.component.AbstractIdentifiableInitializableComponent
net.shibboleth.oidc.metadata.impl.AbstractOIDCEntityResolver<Key,Value>
net.shibboleth.oidc.metadata.impl.AbstractReloadingOIDCEntityResolver<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:
AbstractFileOIDCEntityResolver
public abstract class AbstractReloadingOIDCEntityResolver<Key extends Identifier,Value>
extends AbstractOIDCEntityResolver<Key,Value>
Base class for metadata providers that cache and periodically refresh their entities.
Based on
AbstractReloadingMetadataResolver.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate classBackground task that refreshes metadata.Nested classes/interfaces inherited from class net.shibboleth.oidc.metadata.impl.AbstractOIDCEntityResolver
AbstractOIDCEntityResolver.JsonBackingStore -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final booleanWhether we created our own task timer during object construction.private InstantLast time a refresh cycle occurred.private InstantLast time the metadata was updated.private final org.slf4j.LoggerClass logger.private DurationRefresh interval used when metadata does not contain any validUntil or cacheDuration information.private DurationFloor, in milliseconds, for the refresh interval.private InstantNext time a refresh cycle will occur.Current task to refresh metadata.private final TimerTimer used to schedule background metadata update tasks. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedConstructor.protectedAbstractReloadingOIDCEntityResolver(Timer backgroundTaskTimer) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract byte[]Fetches metadata from a source.protected abstract KeyGets the identifier for the given entity.Get last refresh of resolver.Get last update of resolver.protected abstract StringGets an identifier which may be used to distinguish this metadata in logging statements.protected voidInitializes this resolver by creating a new backing store.parse(byte[] bytes) Parses an entity from the byte array.voidrefresh()Refreshes the metadata from its source.protected voidscheduleNextRefresh(Duration delay) Schedules the next refresh.voidsetMaxRefreshDelay(Duration delay) Sets the maximum amount of time between refresh intervals.voidsetMinRefreshDelay(Duration delay) Sets the minimum amount of time between refreshes.Methods inherited from class net.shibboleth.oidc.metadata.impl.AbstractOIDCEntityResolver
createNewBackingStore, doInitialize, getBackingStore, getLogPrefix, indexEntityDescriptor, isFailFastInitialization, lookupIdentifier, lookupIndexedIdentifier, preProcessEntityDescriptor, removeByIdentifier, setBackingStore, setFailFastInitializationMethods inherited from class net.shibboleth.shared.component.AbstractIdentifiableInitializableComponent
setIdMethods inherited from class net.shibboleth.shared.component.AbstractIdentifiedInitializableComponent
ensureId, getId, ifDestroyedThrowDestroyedComponentException, ifInitializedThrowUnmodifiabledComponentException, ifNotInitializedThrowUninitializedComponentExceptionMethods inherited from class net.shibboleth.shared.component.AbstractInitializableComponent
checkComponentActive, checkSetterPreconditions, destroy, doDestroy, initialize, isDestroyed, isInitializedMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.shibboleth.shared.component.IdentifiedComponent
getId
-
Field Details
-
log
@Nonnull private final org.slf4j.Logger logClass logger. -
taskTimer
Timer used to schedule background metadata update tasks. -
createdOwnTaskTimer
private final boolean createdOwnTaskTimerWhether we created our own task timer during object construction. -
refreshMetadataTask
@Nullable private AbstractReloadingOIDCEntityResolver<Key extends Identifier,Value>.RefreshMetadataTask refreshMetadataTaskCurrent task to refresh metadata. -
maxRefreshDelay
Refresh interval used when metadata does not contain any validUntil or cacheDuration information. Default value: 4 hours -
minRefreshDelay
Floor, in milliseconds, for the refresh interval. Default value: 5 minutes -
lastUpdate
Last time the metadata was updated. -
lastRefresh
Last time a refresh cycle occurred. -
nextRefresh
Next time a refresh cycle will occur.
-
-
Constructor Details
-
AbstractReloadingOIDCEntityResolver
protected AbstractReloadingOIDCEntityResolver()Constructor. -
AbstractReloadingOIDCEntityResolver
Constructor.- Parameters:
backgroundTaskTimer- time used to schedule background refresh tasks
-
-
Method Details
-
initOIDCResolver
Description copied from class:AbstractOIDCEntityResolverInitializes this resolver by creating a new backing store.- Overrides:
initOIDCResolverin classAbstractOIDCEntityResolver<Key extends Identifier,Value> - Throws:
ComponentInitializationException- If the initialization fails.
-
getLastUpdate
Get last update of resolver.- Returns:
- last update
-
getLastRefresh
Get last refresh of resolver.- Returns:
- last refresh
-
setMinRefreshDelay
Sets the minimum amount of time between refreshes.- Parameters:
delay- minimum amount of time between refreshes
-
setMaxRefreshDelay
Sets the maximum amount of time between refresh intervals.- Parameters:
delay- maximum amount of time, in milliseconds, between refresh intervals
-
refresh
Refreshes the metadata from its source.- Throws:
ResolverException- thrown is there is a problem retrieving and processing the metadata
-
scheduleNextRefresh
Schedules the next refresh. If the given delay is 0 or null, thenmaxRefreshDelayis used.- Parameters:
delay- The delay before the next refresh.
-
parse
Parses an entity from the byte array.- Parameters:
bytes- The encoded entity- Returns:
- The parsed entity
- Throws:
ParseException- if parse fails
-
getKey
Gets the identifier for the given entity.- Parameters:
value- The entity whose identifier will be returned.- Returns:
- The identifier for the given entity.
-
getMetadataIdentifier
Gets an identifier which may be used to distinguish this metadata in logging statements.- Returns:
- identifier which may be used to distinguish this metadata in logging statements
-
fetchMetadata
Fetches metadata from a source.- Returns:
- the fetched metadata, or
nullif the metadata is known not to have changed since the last retrieval - Throws:
ResolverException- thrown if there is a problem fetching the metadata
-