Class MappedRegexRealmMapper

  • All Implemented Interfaces:
    RealmMapper

    public class MappedRegexRealmMapper
    extends SimpleRegexRealmMapper
    A simple mapping regular expression-based realm mapper. The pattern is used to find the realm portion of the user name. Then, a map is consulted to map this realm portion to an actual configured realm name.
    Author:
    David M. Lloyd
    • Constructor Detail

      • MappedRegexRealmMapper

        public MappedRegexRealmMapper​(Pattern realmNamePattern,
                                      Map<String,​String> realmNameMap)
        Construct a new instance.
        Parameters:
        realmNamePattern - the realm name pattern, which must contain at least one capture group (cannot be null)
        realmNameMap - the realm portion to realm name map (cannot be null)
      • MappedRegexRealmMapper

        public MappedRegexRealmMapper​(Pattern realmNamePattern,
                                      RealmMapper delegate,
                                      Map<String,​String> realmNameMap)
        Construct a new instance.
        Parameters:
        realmNamePattern - the realm name pattern, which must contain at least one capture group (cannot be null)
        delegate - the delegate mapper to use if the pattern is not matched (cannot be null)
        realmNameMap - the realm portion to realm name map (cannot be null)
    • Method Detail

      • getRealmMapping

        public String getRealmMapping​(Principal principal,
                                      Evidence evidence)
        Description copied from interface: RealmMapper
        Get the realm mapping. Return null if the default realm should be used.
        Specified by:
        getRealmMapping in interface RealmMapper
        Overrides:
        getRealmMapping in class SimpleRegexRealmMapper
        Parameters:
        principal - the authentication principal (or null if none is known for this authentication)
        evidence - the authentication evidence (or null if none is known for this authentication)
        Returns:
        the realm, or null if no particular realm matches the authentication information