Class DefaultDuoOIDCIntegration
java.lang.Object
net.shibboleth.shared.component.AbstractInitializableComponent
net.shibboleth.idp.plugin.authn.duo.DefaultDuoOIDCIntegration
- All Implemented Interfaces:
PrincipalSupportingComponent,DuoOIDCIntegration,DynamicDuoOIDCIntegration,Component,DestructableComponent,InitializableComponent
@ThreadSafe
public final class DefaultDuoOIDCIntegration
extends AbstractInitializableComponent
implements DynamicDuoOIDCIntegration
Data wrapper for use with Duo OIDC integrations. Holds shared-state.
Despite most fields being 'effectively immutable' once published by Spring, the redirectURI is allowed to change, but in a guarded, shared-thread-safe manor.
-
Field Summary
FieldsModifier and TypeFieldDescriptionA set of 'allowed' factors.A set of 'allowed' origins that can be used as the scheme, host, and port portion of the redirectURI.private StringAPI host.private StringThe URL path to the authorization endpoint.private StringIntegration key.private Function<ProfileRequestContext,Collection<Principal>> Hook to map context information to principal collections.private StringThe URL path to the health endpoint.private final org.slf4j.LoggerClass logger.private booleanPasswordless indicator.private StringThe used (by clients) redirect_uri to send the client after authorisation .private StringA statically set (pre-registered) redirectURI to send the client to after authorisation.private StringSecret key.private final SubjectContainer for supported principals.private StringThe URL path to the token endpoint. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidbooleanGets the set of allowable factors to enforce during validation.Get a list of URL origins that are allowed to appear in computed redirect URIs.Get the name of the API host to contact.Get the path of the authorization endpoint.Get the clientId key.Get the context to principal mapping strategy for mapping context information into principal collections.Get the path of the health check endpoint.Get the runtime redirectURI to direct the client to after authorisation.Get the static pre-registered redirect_uri.Get the secret key.getSupportedPrincipals(Class<T> c) Get the path of the token endpoint.inthashCode()booleanGets whether the integration is suitable for use as a passwordless single factor.booleanHas a redirectURI been pre-registered i.e.voidsetAllowedFactors(Collection<String> factors) Set the allowable factors.voidsetAllowedOrigins(Collection<String> hosts) Set the origins that are allowed to form the scheme, host, and port part of a computed redirect_uri.voidsetAPIHost(String host) Set the API host to use.voidsetAuthorizeEndpoint(String endpoint) Set the authorize endpoint URL path.voidsetClientId(String id) Set the client ID to use.voidSet the context to principal mapping strategy for mapping context information into principal collections.voidsetHealthCheckEndpoint(String endpoint) Set the health check endpoint URL path.voidsetPasswordless(boolean flag) Sets whether this integration is suitable for use as a single factor.voidsetRedirectURIIfAbsent(String computedRedirectURI) Set the redirectURI from the one given in a thread-safe way.voidSet the redirect_uri to use.voidsetSecretKey(String key) Set the secret key to use.<T extends Principal>
voidsetSupportedPrincipals(Collection<T> principals) Set supported non-user-specific principals that the action will include in the subjects it generates, in place of any default principals from the flow.voidsetTokenEndpoint(String endpoint) Set the token endpoint URL path.toString()Methods inherited from class net.shibboleth.shared.component.AbstractInitializableComponent
checkComponentActive, checkSetterPreconditions, destroy, doDestroy, ifDestroyedThrowDestroyedComponentException, ifInitializedThrowUnmodifiabledComponentException, ifNotInitializedThrowUninitializedComponentException, initialize, isDestroyed, isInitialized
-
Field Details
-
log
@Nonnull private final org.slf4j.Logger logClass logger. -
passwordless
private boolean passwordlessPasswordless indicator. -
apiHost
API host. -
clientId
Integration key. -
secretKey
Secret key. -
redirectURI
The used (by clients) redirect_uri to send the client after authorisation . -
registeredRedirectURI
A statically set (pre-registered) redirectURI to send the client to after authorisation. -
allowedOrigins
A set of 'allowed' origins that can be used as the scheme, host, and port portion of the redirectURI. -
allowedFactors
A set of 'allowed' factors. -
healthEndpoint
The URL path to the health endpoint. -
authorizeEndpoint
The URL path to the authorization endpoint. -
tokenEndpoint
The URL path to the token endpoint. -
supportedPrincipals
Container for supported principals. -
contextToPrincipalMappingStrategy
@Nullable private Function<ProfileRequestContext,Collection<Principal>> contextToPrincipalMappingStrategyHook to map context information to principal collections.
-
-
Constructor Details
-
DefaultDuoOIDCIntegration
public DefaultDuoOIDCIntegration()Constructor.
-
-
Method Details
-
setPasswordless
public void setPasswordless(boolean flag) Sets whether this integration is suitable for use as a single factor.Defaults to false.
- Parameters:
flag- flag to set- Since:
- 2.1.0
-
isPasswordless
public boolean isPasswordless()Gets whether the integration is suitable for use as a passwordless single factor.Defaults to false.
- Specified by:
isPasswordlessin interfaceDuoOIDCIntegration- Returns:
- true iff the integration limits methods to passwordless
-
setAllowedOrigins
Set the origins that are allowed to form the scheme, host, and port part of a computed redirect_uri.- Parameters:
hosts- the hostnames to allow.
-
getAllowedOrigins
Get a list of URL origins that are allowed to appear in computed redirect URIs.- Specified by:
getAllowedOriginsin interfaceDynamicDuoOIDCIntegration- Returns:
- a set of unmodifiable allowed origins. Never null but could be empty.
-
setAllowedFactors
Set the allowable factors.- Parameters:
factors- the factors to allow- Since:
- 2.1.0
-
getAllowedFactors
Gets the set of allowable factors to enforce during validation.- Specified by:
getAllowedFactorsin interfaceDuoOIDCIntegration- Returns:
- allowable factors, or null for any
-
getAPIHost
Get the name of the API host to contact.- Specified by:
getAPIHostin interfaceDuoOIDCIntegration- Returns:
- name of API host
-
setAPIHost
Set the API host to use.- Parameters:
host- API host
-
getHealthCheckEndpoint
Get the path of the health check endpoint.- Specified by:
getHealthCheckEndpointin interfaceDuoOIDCIntegration- Returns:
- the path of the health check endpoint
-
setHealthCheckEndpoint
Set the health check endpoint URL path.- Parameters:
endpoint- the endpoint.
-
getAuthorizeEndpoint
Get the path of the authorization endpoint.- Specified by:
getAuthorizeEndpointin interfaceDuoOIDCIntegration- Returns:
- the path of the authorization endpoint
-
setAuthorizeEndpoint
Set the authorize endpoint URL path.- Parameters:
endpoint- the endpoint.
-
getTokenEndpoint
Get the path of the token endpoint.- Specified by:
getTokenEndpointin interfaceDuoOIDCIntegration- Returns:
- the path of the token endpoint;
-
setTokenEndpoint
Set the token endpoint URL path.- Parameters:
endpoint- the endpoint.
-
getRedirectURI
Get the runtime redirectURI to direct the client to after authorisation.- Specified by:
getRedirectURIin interfaceDuoOIDCIntegration- Returns:
- the redirectURI
-
setRegisteredRedirectURI
Set the redirect_uri to use.- Parameters:
uri- the redirect_uri
-
getRegisteredRedirectURI
Get the static pre-registered redirect_uri.- Specified by:
getRegisteredRedirectURIin interfaceDynamicDuoOIDCIntegration- Returns:
- the pre-registered redirect_uri.
-
isRedirectURIPreregistered
public boolean isRedirectURIPreregistered()Has a redirectURI been pre-registered i.e. set in the properties file.- Specified by:
isRedirectURIPreregisteredin interfaceDynamicDuoOIDCIntegration- Returns:
- true iff
DynamicDuoOIDCIntegration.getRegisteredRedirectURI()is not null, false otherwise.
-
setRedirectURIIfAbsent
Set the redirectURI from the one given in a thread-safe way.
Once set,
DuoOIDCIntegration.getRedirectURI()should return the value of computedRedirectURI.This is a sate changing operation, and should be thread-safe in its operation, as the integration will be shared amongst threads e.g. synchronize the method call.
- Specified by:
setRedirectURIIfAbsentin interfaceDynamicDuoOIDCIntegration- Parameters:
computedRedirectURI- the runtime computed redirectURI.
-
setClientId
Set the client ID to use.- Parameters:
id- the client identifier.
-
getClientId
Get the clientId key.- Specified by:
getClientIdin interfaceDuoOIDCIntegration- Returns:
- the integration key
-
setSecretKey
Set the secret key to use.- Parameters:
key- secret key
-
getSecretKey
Get the secret key.- Specified by:
getSecretKeyin interfaceDuoOIDCIntegration- Returns:
- the secret key
-
getSupportedPrincipals
@Nonnull @NonnullElements @Unmodifiable public <T extends Principal> Set<T> getSupportedPrincipals(@Nonnull Class<T> c) - Specified by:
getSupportedPrincipalsin interfacePrincipalSupportingComponent
-
setSupportedPrincipals
public <T extends Principal> void setSupportedPrincipals(@Nullable @NonnullElements Collection<T> principals) Set supported non-user-specific principals that the action will include in the subjects it generates, in place of any default principals from the flow.Setting to a null or empty collection will maintain the default behavior of relying on the flow.
- Type Parameters:
T- a type of principal to add, if not generic- Parameters:
principals- supported principals to include
-
setContextToPrincipalMappingStrategy
public void setContextToPrincipalMappingStrategy(@Nullable Function<ProfileRequestContext, Collection<Principal>> hook) Set the context to principal mapping strategy for mapping context information into principal collections.- Parameters:
hook- principal mapping hook
-
getContextToPrincipalMappingStrategy
@Nullable public Function<ProfileRequestContext,Collection<Principal>> getContextToPrincipalMappingStrategy()Get the context to principal mapping strategy for mapping context information into principal collections.- Specified by:
getContextToPrincipalMappingStrategyin interfaceDuoOIDCIntegration- Returns:
- the mapping hook
-
doInitialize
- Overrides:
doInitializein classAbstractInitializableComponent- Throws:
ComponentInitializationException
-
hashCode
public int hashCode() -
equals
-
toString
-