Class DuoOIDCAuthenticationContext
- java.lang.Object
-
- org.opensaml.messaging.context.BaseContext
-
- net.shibboleth.idp.plugin.authn.duo.context.DuoOIDCAuthenticationContext
-
- All Implemented Interfaces:
Iterable<BaseContext>
@NotThreadSafe public final class DuoOIDCAuthenticationContext extends BaseContext
Mutable Context that carries the Duo integration, request-response state, authorization code, and Duo authentication result token.
As with other context classes, holds state, is not thread-safe and should be thread-confined.
- Parent:
AuthenticationContext- Added:
- After extracting the Duo integration for the given authentication request.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.opensaml.messaging.context.BaseContext
BaseContext.ContextSetNoRemoveIteratorDecorator
-
-
Field Summary
Fields Modifier and Type Field Description private StringauthCodeThe authorization code return from the Duo authorization request.private com.nimbusds.jwt.JWTauthTokenThe JWT token received from Duo as a result of 2FA.private DuoOIDCClientclientThe Duo OIDC client to use for the lifetime of this authentication request.private DuoOIDCIntegrationintegrationThe selected Duo integration to use for the lifetime of this request.private StringnonceString value used to associate a Client session with an ID Token to mitigate replay attacks.private StringredirectURIOverrideA request-bound redirect URI that was determined at runtime.private StringrequestStateA randomly generated 32 character minimum String sent in the Duo 2FA authorization request.private StringresponseStateA randomly generated 32 character minimum String returned in the Duo 2FA authorization response.private StringusernameUsername.
-
Constructor Summary
Constructors Constructor Description DuoOIDCAuthenticationContext()Public no-arg constructor to allow auto-creation.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetAuthorizationCode()Get the authorization code.com.nimbusds.jwt.JWTgetAuthToken()Get the Duo authentication token.DuoOIDCClientgetClient()Get the client used to communicate with the Duo OIDC API.DuoOIDCIntegrationgetIntegration()Get the Duo integration.StringgetNonce()Get the nonce.StringgetRedirectURIOverride()Get the override redirect URI.StringgetRequestState()Get the request state.StringgetResponseState()Get the response state.StringgetUsername()Get the username.DuoOIDCAuthenticationContextsetAuthorizationCode(String code)Set the authorization code.DuoOIDCAuthenticationContextsetAuthToken(com.nimbusds.jwt.JWT token)Set the Duo authentication token.DuoOIDCAuthenticationContextsetClient(DuoOIDCClient duoClient)Set the client used to communicate with the Duo OIDC API.DuoOIDCAuthenticationContextsetIntegration(DuoOIDCIntegration duoIntegration)Set the Duo integration.DuoOIDCAuthenticationContextsetNonce(String oidcNonce)Set the OIDC nonce.DuoOIDCAuthenticationContextsetRedirectURIOverride(String override)Set the override redirect URI.DuoOIDCAuthenticationContextsetRequestState(String state)Set the request state.DuoOIDCAuthenticationContextsetResponseState(String state)Set the response state.DuoOIDCAuthenticationContextsetUsername(String name)Set the username.-
Methods inherited from class org.opensaml.messaging.context.BaseContext
addSubcontext, addSubcontext, clearSubcontexts, containsSubcontext, createSubcontext, getParent, getSubcontext, getSubcontext, getSubcontext, getSubcontext, iterator, removeSubcontext, removeSubcontext, setParent
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Field Detail
-
username
@Nullable private String username
Username.
-
integration
@Nullable private DuoOIDCIntegration integration
The selected Duo integration to use for the lifetime of this request.
-
requestState
@Nullable private String requestState
A randomly generated 32 character minimum String sent in the Duo 2FA authorization request.
-
responseState
@Nullable private String responseState
A randomly generated 32 character minimum String returned in the Duo 2FA authorization response.
-
nonce
@Nullable private String nonce
String value used to associate a Client session with an ID Token to mitigate replay attacks.
-
authCode
@Nullable private String authCode
The authorization code return from the Duo authorization request.
-
authToken
@Nullable private com.nimbusds.jwt.JWT authToken
The JWT token received from Duo as a result of 2FA. Token *must* be signed.
-
client
@Nullable private DuoOIDCClient client
The Duo OIDC client to use for the lifetime of this authentication request.
-
redirectURIOverride
@Nullable private String redirectURIOverride
A request-bound redirect URI that was determined at runtime. Used to override the URI inside aDuoOIDCIntegrationfor supported clients. Allows per-request redirects e.g. useful if one IdP instance is fronted by different virtual hosts.
-
-
Method Detail
-
getRedirectURIOverride
@Nullable public String getRedirectURIOverride()
Get the override redirect URI.- Returns:
- the override redirect URI.
-
setRedirectURIOverride
@Nonnull public DuoOIDCAuthenticationContext setRedirectURIOverride(@Nullable String override)
Set the override redirect URI.- Parameters:
override- the override redirect URI.- Returns:
- this context.
-
getNonce
@Nullable public String getNonce()
Get the nonce.- Returns:
- the nonce.
-
setNonce
@Nonnull public DuoOIDCAuthenticationContext setNonce(@Nullable String oidcNonce)
Set the OIDC nonce.- Parameters:
oidcNonce- the nonce.- Returns:
- this context.
-
getAuthorizationCode
@Nullable public String getAuthorizationCode()
Get the authorization code.- Returns:
- the authorization code.
-
setAuthorizationCode
@Nonnull public DuoOIDCAuthenticationContext setAuthorizationCode(@Nullable String code)
Set the authorization code.- Parameters:
code- the authorization code.- Returns:
- this context.
-
getClient
@Nullable public DuoOIDCClient getClient()
Get the client used to communicate with the Duo OIDC API.- Returns:
- the duo client.
-
setClient
@Nonnull public DuoOIDCAuthenticationContext setClient(@Nullable DuoOIDCClient duoClient)
Set the client used to communicate with the Duo OIDC API.- Parameters:
duoClient- the duo client.- Returns:
- this context.
-
setAuthToken
@Nonnull public DuoOIDCAuthenticationContext setAuthToken(@Nullable com.nimbusds.jwt.JWT token)
Set the Duo authentication token.- Parameters:
token- the duo authentication token- Returns:
- this context
-
getAuthToken
@Nullable public com.nimbusds.jwt.JWT getAuthToken()
Get the Duo authentication token.- Returns:
- the token
-
getRequestState
@Nullable public String getRequestState()
Get the request state.- Returns:
- the state
-
setRequestState
@Nonnull public DuoOIDCAuthenticationContext setRequestState(@Nullable String state)
Set the request state.- Parameters:
state- the state.- Returns:
- this context
-
getResponseState
@Nullable public String getResponseState()
Get the response state.- Returns:
- the state
-
setResponseState
@Nonnull public DuoOIDCAuthenticationContext setResponseState(@Nullable String state)
Set the response state.- Parameters:
state- the state.- Returns:
- this context
-
getUsername
@Nullable public String getUsername()
Get the username.- Returns:
- username
-
setUsername
@Nonnull public DuoOIDCAuthenticationContext setUsername(@Nullable String name)
Set the username.- Parameters:
name- username- Returns:
- this context
-
setIntegration
@Nonnull public DuoOIDCAuthenticationContext setIntegration(@Nullable DuoOIDCIntegration duoIntegration)
Set the Duo integration.- Parameters:
duoIntegration- the integration- Returns:
- this context
-
getIntegration
@Nullable public DuoOIDCIntegration getIntegration()
Get the Duo integration.- Returns:
- the Duo integration
-
-