Package org.wildfly.security.auth.server
Interface RealmMapper
-
- All Known Implementing Classes:
MappedRegexRealmMapper
,SimpleRegexRealmMapper
- 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 RealmMapper
A realm mapper. Examines authentication identity information and translates it into a realm name. If the realm mapper does not recognize the authentication information, a default realm will be chosen.- Author:
- David M. Lloyd
-
-
Field Summary
Fields Modifier and Type Field Description static RealmMapper
DEFAULT_REALM_MAPPER
A realm mapper which always falls back to a default realm.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description static RealmMapper
aggregate(RealmMapper... mappers)
Create an aggregate realm mapping strategy.static RealmMapper
aggregate(RealmMapper mapper1, RealmMapper mapper2)
Create an aggregate realm mapping strategy.String
getRealmMapping(Principal principal, Evidence evidence)
Get the realm mapping.static RealmMapper
matching(BiPredicate<? super Principal,? super Evidence> matchRule, String realmName)
Create a realm mapper that matches when the given predicate matches.static RealmMapper
matchingEvidence(Predicate<? super Evidence> matchRule, String realmName)
Create a realm mapper that matches when the given predicate matches the evidence.static RealmMapper
matchingEvidenceType(Class<? extends Evidence> evidenceType, String realmName)
Create a realm mapper that matches when the evidence is of the given type.static RealmMapper
matchingPrincipal(Predicate<? super Principal> matchRule, String realmName)
Create a realm mapper that matches when the given predicate matches the principal.static RealmMapper
matchingPrincipalType(Class<? extends Principal> principalType, String realmName)
Create a realm mapper that matches when the principal is of the given type.static RealmMapper
single(String realmName)
Create a realm mapper that always maps to the given realm.
-
-
-
Field Detail
-
DEFAULT_REALM_MAPPER
static final RealmMapper DEFAULT_REALM_MAPPER
A realm mapper which always falls back to a default realm.
-
-
Method Detail
-
getRealmMapping
String getRealmMapping(Principal principal, Evidence evidence)
Get the realm mapping. Returnnull
if the default realm should be used.- Parameters:
principal
- the authentication principal (ornull
if none is known for this authentication)evidence
- the authentication evidence (ornull
if none is known for this authentication)- Returns:
- the realm, or
null
if no particular realm matches the authentication information
-
single
static RealmMapper single(String realmName)
Create a realm mapper that always maps to the given realm.- Parameters:
realmName
- the realm name to return, ornull
if the default realm should be used- Returns:
- the realm mapper returning
realmName
-
matching
static RealmMapper matching(BiPredicate<? super Principal,? super Evidence> matchRule, String realmName)
Create a realm mapper that matches when the given predicate matches.- Parameters:
matchRule
- the match rule (must not benull
)realmName
- the realm name to return, ornull
to return the default realm- Returns:
- the realm mapper (not
null
)
-
matchingPrincipal
static RealmMapper matchingPrincipal(Predicate<? super Principal> matchRule, String realmName)
Create a realm mapper that matches when the given predicate matches the principal.- Parameters:
matchRule
- the match rule (must not benull
)realmName
- the realm name to return, ornull
to return the default realm- Returns:
- the realm mapper (not
null
)
-
matchingPrincipalType
static RealmMapper matchingPrincipalType(Class<? extends Principal> principalType, String realmName)
Create a realm mapper that matches when the principal is of the given type.- Parameters:
principalType
- the principal type class (must not benull
)realmName
- the realm name to return, ornull
to return the default realm- Returns:
- the realm mapper (not
null
)
-
matchingEvidence
static RealmMapper matchingEvidence(Predicate<? super Evidence> matchRule, String realmName)
Create a realm mapper that matches when the given predicate matches the evidence.- Parameters:
matchRule
- the match rule (must not benull
)realmName
- the realm name to return, ornull
to return the default realm- Returns:
- the realm mapper (not
null
)
-
matchingEvidenceType
static RealmMapper matchingEvidenceType(Class<? extends Evidence> evidenceType, String realmName)
Create a realm mapper that matches when the evidence is of the given type.- Parameters:
evidenceType
- the evidence type class (must not benull
)realmName
- the realm name to return, ornull
to return the default realm- Returns:
- the realm mapper (not
null
)
-
aggregate
static RealmMapper aggregate(RealmMapper mapper1, RealmMapper mapper2)
Create an aggregate realm mapping strategy.- Parameters:
mapper1
- the first mapper to try (must not benull
)mapper2
- the second mapper to try (must not benull
)- Returns:
- an aggregated mapper (not
null
)
-
aggregate
static RealmMapper aggregate(RealmMapper... mappers)
Create an aggregate realm mapping strategy.- Parameters:
mappers
- the mappers to try (must not benull
)- Returns:
- an aggregated mapper (not
null
)
-
-