Class FlatFileExternalAgentResolver
java.lang.Object
net.shibboleth.shared.component.AbstractInitializableComponent
net.shibboleth.shared.component.AbstractIdentifiedInitializableComponent
net.shibboleth.shared.component.AbstractIdentifiableInitializableComponent
net.shibboleth.sp.agent.resolver.AbstractExternalAgentResolver
net.shibboleth.sp.agent.resolver.impl.FlatFileExternalAgentResolver
- All Implemented Interfaces:
Component,DestructableComponent,IdentifiableComponent,IdentifiedComponent,InitializableComponent,Resolver<Agent,,CriteriaSet> AgentResolver
External agent source that relies on a flat file.
The format of this file is similar to an LDIF file due to the variability of fields supported and the need for multiple values in some of the fields. Entries are separated by empty lines and lines that begin with a '#' are comments and ignored. Each valid line consists of a field specifier followed by a colon, followed by a single field value. All values are trimmed of leading and trailing whitespace. Supported fields:
- id
- Agent ID
- allowedRange
- Allowed address range
- username
- An alternative agent username
- issuer
- Issuer value for Agent protocol messages
- authority
- Authenticating authority
Only the "id" field is required. Both "allowedRange" and "username" may appear any number of times.
-
Nested Class Summary
Nested classes/interfaces inherited from class net.shibboleth.sp.agent.resolver.AbstractExternalAgentResolver
AbstractExternalAgentResolver.AgentTemplate -
Field Summary
FieldsModifier and TypeFieldDescriptionAgent map.static final StringIP Range fieldstatic final StringAuthority fieldstatic final StringAgent ID fieldstatic final StringIssuer fieldprivate longFile timestamp.private ReadWriteLockA shared lock to synchronize access.private final org.slf4j.LoggerClass logger.private DurationOptional reload interval.private TimerTaskTask that monitors resource for reload.private TimerTimer used to schedule reload task.private ResourceSource of information.static final StringUsername field -
Constructor Summary
ConstructorsConstructorDescriptionFlatFileExternalAgentResolver(ProtocolSupportServiceManager protocolManager) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidprotected voiddoResolve(CriteriaSet criteria) Performs resolution of a specific named agent record in the form of a template object which the base class will fully configure and resolve.protected TimerTaskprivate voidinstallMappings(Map<String, AbstractExternalAgentResolver.AgentTemplate> map, AbstractExternalAgentResolver.AgentTemplate template) Install mappings while guarding against duplicates.load(InputStream is) Loads data from the supplied input stream.voidsetReloadInterval(Duration interval) Sets the time between checks for changes to the resource and reload of the records.voidsetResource(Resource resource) Set the resource to use.Methods inherited from class net.shibboleth.sp.agent.resolver.AbstractExternalAgentResolver
resolve, resolveSingle, setAllowedAddressRanges, setAttributeFilter, setAttributeResolver, setAttributeTranscoderRegistry, setAuthenticatingAuthority, setAuthenticatingAuthorityLookupStrategy, setAuthenticationMethod, setAuthorizedUtilityOperations, setCacheEnabled, setCharacterEncoding, setCredentialResolver, setDetailedErrors, setDetailedErrorsPredicate, setDiscoveryService, setDiscoveryServiceLookupStrategy, setExpireAfterAccess, setExpireAfterWrite, setIssuer, setIssuerLookupStrategy, setLogoutAdmins, setLogoutAdminsLookupStrategy, setLogoutConsumers, setLogoutConsumersLookupStrategy, setLogoutInitiators, setLogoutInitiatorsLookupStrategy, setMaximumCachedElements, setMetricName, setPostLimit, setProfileConfigurations, setProfileConfigurationsLookupStrategy, setRelyingPartyConfigurations, setSecurityConfiguration, setSecurityConfigurationLookupStrategy, setSessionInitiators, setSessionInitiatorsLookupStrategy, setStateManager, setSupportsCachedAuthentication, setSupportsPostPreservation, setTokenConsumers, setTokenConsumersLookupStrategy, setUnverifiedConfigurationMethods 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, 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
-
ID_FIELD
Agent ID field- See Also:
-
ALLOWED_RANGE_FIELD
IP Range field- See Also:
-
USERNAME_FIELD
Username field- See Also:
-
ISSUER_FIELD
Issuer field- See Also:
-
AUTHORITY_FIELD
Authority field- See Also:
-
log
@Nonnull private final org.slf4j.Logger logClass logger. -
storageResource
Source of information. -
reloadInterval
Optional reload interval. -
lastModified
private long lastModifiedFile timestamp. -
reloadTask
Task that monitors resource for reload. -
reloadTaskTimer
Timer used to schedule reload task. -
lock
A shared lock to synchronize access. -
agentMap
Agent map.
-
-
Constructor Details
-
FlatFileExternalAgentResolver
public FlatFileExternalAgentResolver(@ParameterName(name="protocolManager") @Nonnull ProtocolSupportServiceManager protocolManager) Constructor.- Parameters:
protocolManager- protocol support manager
-
-
Method Details
-
setReloadInterval
Sets the time between checks for changes to the resource and reload of the records.A value of 0 (the default) indicates that no reloading will be performed. The default is 5 minutes.
Non-file resources are detected and reload is not supported.
- Parameters:
interval- time between reload checking
-
doInitialize
- Overrides:
doInitializein classAbstractExternalAgentResolver- Throws:
ComponentInitializationException
-
doDestroy
protected void doDestroy()- Overrides:
doDestroyin classAbstractInitializableComponent
-
getReloadTask
-
load
@Nonnull @Unmodifiable @NotLive private Map<String,AbstractExternalAgentResolver.AgentTemplate> load(@Nonnull InputStream is) throws IOException Loads data from the supplied input stream.Must be called while holding the write lock.
- Parameters:
is-- Returns:
- the constructed map of records
- Throws:
IOException- on error
-
installMappings
private void installMappings(@Nonnull Map<String, AbstractExternalAgentResolver.AgentTemplate> map, @Nonnull AbstractExternalAgentResolver.AgentTemplate template) Install mappings while guarding against duplicates.- Parameters:
map- map of templatestemplate- template to add