Class ExternalAuthenticationContext

  • All Implemented Interfaces:
    Iterable<BaseContext>

    public final class ExternalAuthenticationContext
    extends BaseContext
    A context representing the state of an externalized authentication attempt, a case where authentication happens outside of a web flow.
    Parent:
    AuthenticationContext
    Added:
    Before dispatching control to an external login flow
    • Field Detail

      • externalAuthentication

        @Nonnull
        private final ExternalAuthentication externalAuthentication
        Implementation object.
      • flowExecutionUrl

        @Nullable
        private String flowExecutionUrl
        Value of flowExecutionUrl on branching from flow.
      • principalName

        @Nullable
        private String principalName
        Name of a principal that was authenticated.
      • subject

        @Nullable
        private Subject subject
        Name of a Subject that was authenticated.
      • authnInstant

        @Nullable
        private Instant authnInstant
        Time of authentication.
      • authnError

        @Nullable
        private String authnError
        Error message.
      • authnException

        @Nullable
        private Exception authnException
        Exception.
      • doNotCache

        private boolean doNotCache
        Flag preventing caching of result for SSO.
      • previousResult

        private boolean previousResult
        Flag indicating this "new" result is really "old".
    • Constructor Detail

      • ExternalAuthenticationContext

        public ExternalAuthenticationContext​(@Nonnull
                                             ExternalAuthentication authentication)
        Constructor.
        Parameters:
        authentication - implementation object
    • Method Detail

      • getExternalAuthentication

        @Nonnull
        public ExternalAuthentication getExternalAuthentication()
        Get the ExternalAuthentication object installed in the context.
        Returns:
        the external authentication implementation
        Since:
        4.0.0
      • getFlowExecutionUrl

        @Nullable
        public String getFlowExecutionUrl()
        Get the flow execution URL to return control to.
        Returns:
        return location
      • setFlowExecutionUrl

        @Nonnull
        public ExternalAuthenticationContext setFlowExecutionUrl​(@Nullable
                                                                 String url)
        Set the flow execution URL to return control to.
        Parameters:
        url - return location
        Returns:
        this context
      • getPrincipal

        @Nullable
        public Principal getPrincipal()
        Get a Principal that was authenticated.
        Returns:
        the principal
      • getPrincipalName

        @Nullable
        public String getPrincipalName()
        Get the name of a principal that was authenticated.
        Returns:
        name of a principal
      • setPrincipalName

        @Nonnull
        public ExternalAuthenticationContext setPrincipalName​(@Nullable
                                                              String name)
        Set the name of a principal that was authenticated.
        Parameters:
        name - name of principal to set
        Returns:
        this context
      • getSubject

        @Nullable
        public Subject getSubject()
        Get a Subject that was authenticated.
        Returns:
        subject that was authenticated
      • getAuthnInstant

        @Nullable
        public Instant getAuthnInstant()
        Get the time of authentication.
        Returns:
        time of authentication
      • setAuthnInstant

        @Nonnull
        public ExternalAuthenticationContext setAuthnInstant​(@Nullable
                                                             Instant instant)
        Set the time of authentication.
        Parameters:
        instant - time of authentication to set
        Returns:
        this context
      • getAuthenticatingAuthorities

        @Nonnull
        @NonnullElements
        @Live
        public Collection<String> getAuthenticatingAuthorities()
        Get a mutable, ordered list of proxied authentication sources.
        Returns:
        proxied authentication sources
        Since:
        3.4.0
      • getAuthnError

        @Nullable
        public String getAuthnError()
        Get an error message from the authentication process.
        Returns:
        an error message
      • setAuthnError

        @Nonnull
        public ExternalAuthenticationContext setAuthnError​(@Nullable
                                                           String message)
        Set an error message from the authentication process.
        Parameters:
        message - message to set
        Returns:
        this context
      • getAuthnException

        @Nullable
        public Exception getAuthnException()
        Get an exception from the authentication process.
        Returns:
        an exception
      • setAuthnException

        @Nonnull
        public ExternalAuthenticationContext setAuthnException​(@Nullable
                                                               Exception exception)
        Set an exception from the authentication process.
        Parameters:
        exception - exception to set
        Returns:
        this context
      • doNotCache

        public boolean doNotCache()
        Get the "do not cache" flag.
        Returns:
        true iff the result of the authentication should not be cached
      • setDoNotCache

        @Nonnull
        public ExternalAuthenticationContext setDoNotCache​(boolean flag)
        Set the "do not cache" flag.
        Parameters:
        flag - flag to set
        Returns:
        this context
      • isPreviousResult

        public boolean isPreviousResult()
        Get whether this result is the product of an external SSO event and not a new act of authentication.
        Returns:
        true iff this result was produced as part of an earlier request
        Since:
        3.3.0
      • setPreviousResult

        @Nonnull
        public ExternalAuthenticationContext setPreviousResult​(boolean flag)
        Set whether this result is the product of an external SSO event and not a new act of authentication.
        Parameters:
        flag - flag to set
        Returns:
        this context
        Since:
        3.3.0