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' 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 StringThe URL path to the health endpoint.private final org.slf4j.LoggerClass logger.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 voidbooleanGet 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 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()booleanHas a redirectURI been pre-registered i.e.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.voidsetHealthCheckEndpoint(String endpoint) Set the health check endpoint URL path.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. -
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. -
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.
-
-
Constructor Details
-
DefaultDuoOIDCIntegration
public DefaultDuoOIDCIntegration()Constructor.
-
-
Method Details
-
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
Description copied from interface:DynamicDuoOIDCIntegrationGet 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.
-
getAPIHost
Description copied from interface:DuoOIDCIntegrationGet 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
Description copied from interface:DuoOIDCIntegrationGet 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
Description copied from interface:DuoOIDCIntegrationGet 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
Description copied from interface:DuoOIDCIntegrationGet 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
Description copied from interface:DuoOIDCIntegrationGet 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
Description copied from interface:DynamicDuoOIDCIntegrationGet the static pre-registered redirect_uri.- Specified by:
getRegisteredRedirectURIin interfaceDynamicDuoOIDCIntegration- Returns:
- the pre-registered redirect_uri.
-
isRedirectURIPreregistered
public boolean isRedirectURIPreregistered()Description copied from interface:DynamicDuoOIDCIntegrationHas 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
Description copied from interface:DynamicDuoOIDCIntegrationSet 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
Description copied from interface:DuoOIDCIntegrationGet the clientId key.- Specified by:
getClientIdin interfaceDuoOIDCIntegration- Returns:
- the integration key
-
setSecretKey
Set the secret key to use.- Parameters:
key- secret key
-
getSecretKey
Description copied from interface:DuoOIDCIntegrationGet 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
-
doInitialize
- Overrides:
doInitializein classAbstractInitializableComponent- Throws:
ComponentInitializationException
-
hashCode
public int hashCode() -
equals
-
toString
-