Package org.wildfly.security.auth.server
Interface NameRewriter
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
A name rewriter. Name rewriters transform names from one form to another for various purposes, including (but
not limited to):
- Normalizing case
- Trimming extra whitespace
- Mapping one naming scheme to another (e.g. "user@realm" to/from "realm/user" or similar)
- Removing a realm component (e.g. "user@realm" to "user")
null, the name is not valid according to the rules of the rewriter.- Author:
- David M. Lloyd
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final NameRewriterThe simple identity name rewriter, which does no rewriting. -
Method Summary
Modifier and TypeMethodDescriptionstatic NameRewriteraggregate(NameRewriter... nameRewriters) Create a name rewriter which aggregates the given name rewriters; the first rewriter which successfully rewrites the name is used.static NameRewriteraggregate(NameRewriter rewriter1, NameRewriter rewriter2) Create a name rewriter which aggregates the given name rewriters; the first rewriter which successfully rewrites the name is used.default UnaryOperator<Principal>Get this name rewriter as a principal rewriter that applies only toNamePrincipalinstances.static NameRewriterchain(NameRewriter... nameRewriters) Create a name rewriter which chains the given name rewriters; the name will be rewritten through the given rewriters in order and then returned.static NameRewriterchain(NameRewriter rewriter1, NameRewriter rewriter2) Create a name rewriter which chains the given name rewriters; the name will be rewritten through the given rewriters in order and then returned.static NameRewriterCreate a name rewriter which always returns the same name.rewriteName(String original) Rewrite a name.
-
Field Details
-
IDENTITY_REWRITER
The simple identity name rewriter, which does no rewriting.
-
-
Method Details
-
rewriteName
Rewrite a name. Must not returnnull.- Parameters:
original- the original name (must not benull)- Returns:
- the rewritten name, or
nullif the name is invalid
-
asPrincipalRewriter
Get this name rewriter as a principal rewriter that applies only toNamePrincipalinstances.- Returns:
- the principal rewriter (not
null)
-
chain
Create a name rewriter which chains the given name rewriters; the name will be rewritten through the given rewriters in order and then returned. If any rewriter returnsnull, thennullis returned.- Parameters:
rewriter1- the first name rewriter (must not benull)rewriter2- the second name rewriter (must not benull)- Returns:
- the name rewriter (not
null)
-
chain
Create a name rewriter which chains the given name rewriters; the name will be rewritten through the given rewriters in order and then returned. If any rewriter returnsnull, thennullis returned.- Parameters:
nameRewriters- the name rewriters (must not benull, cannot havenullelements)- Returns:
- the name rewriter (not
null)
-
aggregate
Create a name rewriter which aggregates the given name rewriters; the first rewriter which successfully rewrites the name is used. If all the rewriters returnnull, thennullis returned.- Parameters:
rewriter1- the first name rewriter (must not benull)rewriter2- the second name rewriter (must not benull)- Returns:
- the name rewriter (not
null)
-
aggregate
Create a name rewriter which aggregates the given name rewriters; the first rewriter which successfully rewrites the name is used. If all the rewriters returnnull, thennullis returned.- Parameters:
nameRewriters- the name rewriters (must not benull, cannot havenullelements)- Returns:
- the name rewriter (not
null)
-
constant
Create a name rewriter which always returns the same name.- Parameters:
name- the name to return- Returns:
- the name
-