Interface RoleDecoder

  • All Known Implementing Classes:
    SourceAddressRoleDecoder
    Functional Interface:
    This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

    @FunctionalInterface
    public interface RoleDecoder
    A decoder to extract role information from an identity's attributes.
    Author:
    David M. Lloyd
    • Field Detail

      • KEY_ROLES

        static final String KEY_ROLES
        A key whose value is the string "Roles", to provide a standard/default location at which roles may be found.
        See Also:
        Constant Field Values
      • KEY_SOURCE_ADDRESS

        static final String KEY_SOURCE_ADDRESS
        A key whose value is the string "Source-Address". This is where the IP address of a remote client may be found.
        See Also:
        Constant Field Values
      • EMPTY

        static final RoleDecoder EMPTY
        A role decoder which decodes no roles.
      • DEFAULT

        static final RoleDecoder DEFAULT
        A role decoder which always decodes roles from the attribute called "Roles".
    • Method Detail

      • decodeRoles

        Roles decodeRoles​(AuthorizationIdentity authorizationIdentity)
        Decode the role set from the given authorization identity.
        Parameters:
        authorizationIdentity - the authorization identity (not null)
        Returns:
        the role set (must not be null)
      • simple

        static RoleDecoder simple​(String attribute)
        Create a simple role decoder which returns the values of the given attribute.
        Parameters:
        attribute - the attribute
        Returns:
        the roles
      • aggregate

        static RoleDecoder aggregate​(RoleDecoder... decoders)
        Create an aggregate role decoder. Each role decoder is applied in order and the returned value is a union of the roles returned by each decoder.
        Parameters:
        decoders - the role decoders to apply (must not be null or contain null elements)
        Returns:
        the aggregate role decoder (not null)