Package org.wildfly.security.auth.server
Interface NameRewriter
- 
- All Known Implementing Classes:
- CaseNameRewriter,- MutableNameRewriter,- RegexNameRewriter,- RegexNameValidatingRewriter
 - 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 NameRewriter 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 SummaryFields Modifier and Type Field Description static NameRewriterIDENTITY_REWRITERThe simple identity name rewriter, which does no rewriting.
 - 
Method SummaryAll Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description static 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>asPrincipalRewriter()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 NameRewriterconstant(String name)Create a name rewriter which always returns the same name.StringrewriteName(String original)Rewrite a name.
 
- 
- 
- 
Field Detail- 
IDENTITY_REWRITERstatic final NameRewriter IDENTITY_REWRITER The simple identity name rewriter, which does no rewriting.
 
- 
 - 
Method Detail- 
rewriteNameString rewriteName(String original) Rewrite a name. Must not returnnull.- Parameters:
- original- the original name (must not be- null)
- Returns:
- the rewritten name, or nullif the name is invalid
 
 - 
asPrincipalRewriterdefault UnaryOperator<Principal> asPrincipalRewriter() Get this name rewriter as a principal rewriter that applies only toNamePrincipalinstances.- Returns:
- the principal rewriter (not null)
 
 - 
chainstatic NameRewriter chain(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. If any rewriter returnsnull, thennullis returned.- Parameters:
- rewriter1- the first name rewriter (must not be- null)
- rewriter2- the second name rewriter (must not be- null)
- Returns:
- the name rewriter (not null)
 
 - 
chainstatic NameRewriter chain(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. If any rewriter returnsnull, thennullis returned.- Parameters:
- nameRewriters- the name rewriters (must not be- null, cannot have- nullelements)
- Returns:
- the name rewriter (not null)
 
 - 
aggregatestatic NameRewriter aggregate(NameRewriter rewriter1, NameRewriter rewriter2) 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 be- null)
- rewriter2- the second name rewriter (must not be- null)
- Returns:
- the name rewriter (not null)
 
 - 
aggregatestatic NameRewriter aggregate(NameRewriter... nameRewriters) 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 be- null, cannot have- nullelements)
- Returns:
- the name rewriter (not null)
 
 - 
constantstatic NameRewriter constant(String name) Create a name rewriter which always returns the same name.- Parameters:
- name- the name to return
- Returns:
- the name
 
 
- 
 
-