Package org.wildfly.security.auth.util
Class SimpleRegexRealmMapper
- java.lang.Object
-
- org.wildfly.security.auth.util.SimpleRegexRealmMapper
-
- All Implemented Interfaces:
RealmMapper
- Direct Known Subclasses:
MappedRegexRealmMapper
public class SimpleRegexRealmMapper extends Object implements RealmMapper
A simple regular expression-based realm mapper. The realm name pattern must contain a single capture group which matches the substring to use as the realm name. If the substring is not matched, the delegate realm mapper is used. If there is no delegate realm mapper, the default realm is used.- Author:
- David M. Lloyd
-
-
Field Summary
Fields Modifier and Type Field Description private RealmMapperdelegateprivate PatternrealmNamePattern-
Fields inherited from interface org.wildfly.security.auth.server.RealmMapper
DEFAULT_REALM_MAPPER
-
-
Constructor Summary
Constructors Constructor Description SimpleRegexRealmMapper(Pattern realmNamePattern)Construct a new instance.SimpleRegexRealmMapper(Pattern realmNamePattern, RealmMapper delegate)Construct a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetRealmMapping(Principal principal, Evidence evidence)Get the realm mapping.
-
-
-
Field Detail
-
realmNamePattern
private final Pattern realmNamePattern
-
delegate
private final RealmMapper delegate
-
-
Constructor Detail
-
SimpleRegexRealmMapper
public SimpleRegexRealmMapper(Pattern realmNamePattern)
Construct a new instance.- Parameters:
realmNamePattern- the realm name pattern, which must contain at least one capture group (cannot benull)- Throws:
IllegalArgumentException- if the given pattern does not contain a capture group
-
SimpleRegexRealmMapper
public SimpleRegexRealmMapper(Pattern realmNamePattern, RealmMapper delegate)
Construct a new instance.- Parameters:
realmNamePattern- the realm name pattern, which must contain at least one capture group (cannot benull)delegate- the delegate mapper to use if the pattern is not matched (cannot benull)- Throws:
IllegalArgumentException- if the given pattern does not contain a capture group
-
-
Method Detail
-
getRealmMapping
public String getRealmMapping(Principal principal, Evidence evidence)
Description copied from interface:RealmMapperGet the realm mapping. Returnnullif the default realm should be used.- Specified by:
getRealmMappingin interfaceRealmMapper- Parameters:
principal- the authentication principal (ornullif none is known for this authentication)evidence- the authentication evidence (ornullif none is known for this authentication)- Returns:
- the realm, or
nullif no particular realm matches the authentication information
-
-