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 RealmMapperDEFAULT_REALM_MAPPERA 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 RealmMapperaggregate(RealmMapper... mappers)Create an aggregate realm mapping strategy.static RealmMapperaggregate(RealmMapper mapper1, RealmMapper mapper2)Create an aggregate realm mapping strategy.StringgetRealmMapping(Principal principal, Evidence evidence)Get the realm mapping.static RealmMappermatching(BiPredicate<? super Principal,? super Evidence> matchRule, String realmName)Create a realm mapper that matches when the given predicate matches.static RealmMappermatchingEvidence(Predicate<? super Evidence> matchRule, String realmName)Create a realm mapper that matches when the given predicate matches the evidence.static RealmMappermatchingEvidenceType(Class<? extends Evidence> evidenceType, String realmName)Create a realm mapper that matches when the evidence is of the given type.static RealmMappermatchingPrincipal(Predicate<? super Principal> matchRule, String realmName)Create a realm mapper that matches when the given predicate matches the principal.static RealmMappermatchingPrincipalType(Class<? extends Principal> principalType, String realmName)Create a realm mapper that matches when the principal is of the given type.static RealmMappersingle(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. Returnnullif the default realm should be used.- 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
-
single
static RealmMapper single(String realmName)
Create a realm mapper that always maps to the given realm.- Parameters:
realmName- the realm name to return, ornullif 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, ornullto 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, ornullto 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, ornullto 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, ornullto 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, ornullto 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)
-
-