Class DefaultAuthenticatedIdentity

  • All Implemented Interfaces:
    AuthenticatedIdentity, Principal

    public class DefaultAuthenticatedIdentity
    extends Object
    implements AuthenticatedIdentity
    Default implementation of AuthenticatedIdentity.

    This implementation is an immutable structure, with a facility to store it in TLS. It's the responsibility of the context, e.g. the HTTP request handler, to remove the identity from TLS at the end of the context (e.g. end of the HTTP request), or at any other appropriate time (e.g. when logging out mid-request).

    Author:
    Arjan Tijms
    • Constructor Detail

      • DefaultAuthenticatedIdentity

        public DefaultAuthenticatedIdentity​(Principal callerPrincipal,
                                            Set<String> groups)
    • Method Detail

      • setCurrentIdentity

        public static void setCurrentIdentity​(Principal callerPrincipal,
                                              Set<String> groups)
      • getCurrentSubject

        public static Subject getCurrentSubject()
      • clear

        public static void clear()
      • getCallerPrincipal

        public Principal getCallerPrincipal()
        Description copied from interface: AuthenticatedIdentity
        Returns the caller principal, which represents the primary name of the calling entity (aka the "caller") to a server.
        Specified by:
        getCallerPrincipal in interface AuthenticatedIdentity
        Returns:
        the caller principal, or null if authentication has not (yet) completed successfully.
      • getGroups

        public Set<String> getGroups()
        Description copied from interface: AuthenticatedIdentity
        The groups the caller is in.

        If group to role mapping is not active (the default) groups are equal to roles.

        Specified by:
        getGroups in interface AuthenticatedIdentity
        Returns:
        the set of groups the caller is in, never null.