Class SourceAddressRoleDecoder

  • All Implemented Interfaces:
    RoleDecoder

    public class SourceAddressRoleDecoder
    extends Object
    implements RoleDecoder
    A decoder to obtain role information using the source IP address runtime attribute from the identity.
    Author:
    Farah Juma
    • Field Detail

      • sourceAddress

        private String sourceAddress
      • sourceAddressPattern

        private Pattern sourceAddressPattern
      • roles

        private Roles roles
    • Constructor Detail

      • SourceAddressRoleDecoder

        public SourceAddressRoleDecoder​(String sourceAddress,
                                        Roles roles)
        Construct a new instance.
        Parameters:
        sourceAddress - the source IP address to match (cannot be null)
        roles - the roles to associate with the identity if the actual source IP address matches the given source IP address
      • SourceAddressRoleDecoder

        public SourceAddressRoleDecoder​(Pattern sourceAddressPattern,
                                        Roles roles)
        Construct a new instance.
        Parameters:
        sourceAddressPattern - the source IP address pattern to match (cannot be null)
        roles - the roles to associate with the identity if the actual source IP address matches the given pattern
    • Method Detail

      • decodeRoles

        public Roles decodeRoles​(AuthorizationIdentity authorizationIdentity)
        Decode the role set using the source IP address runtime attribute from the given authorization identity.
        Specified by:
        decodeRoles in interface RoleDecoder
        Parameters:
        authorizationIdentity - the authorization identity (not null)
        Returns:
        the role set (must not be null)