Package org.wildfly.security.auth.util
Class RegexNameRewriter
- java.lang.Object
-
- org.wildfly.security.auth.util.RegexNameRewriter
-
- All Implemented Interfaces:
NameRewriter
public final class RegexNameRewriter extends Object implements NameRewriter
A simple regular expression-based name rewriter.
-
-
Field Summary
-
Fields inherited from interface org.wildfly.security.auth.server.NameRewriter
IDENTITY_REWRITER
-
-
Constructor Summary
Constructors Constructor Description RegexNameRewriter(Pattern pattern, String replacement, boolean replaceAll)
Construct a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Pattern
getPattern()
Get the pattern.String
getReplacement()
Get the replacement string.String
rewriteName(String original)
Rewrite a name.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.wildfly.security.auth.server.NameRewriter
asPrincipalRewriter
-
-
-
-
Constructor Detail
-
RegexNameRewriter
public RegexNameRewriter(Pattern pattern, String replacement, boolean replaceAll)
Construct a new instance.- Parameters:
pattern
- the substitution patternreplacement
- the replacement stringreplaceAll
-true
to replace all occurrences of the pattern;false
to replace only the first occurrence
-
-
Method Detail
-
rewriteName
public String rewriteName(String original)
Rewrite a name. Must not returnnull
.- Specified by:
rewriteName
in interfaceNameRewriter
- Parameters:
original
- the original name- Returns:
- the rewritten name
-
getPattern
public Pattern getPattern()
Get the pattern.- Returns:
- the pattern
-
getReplacement
public String getReplacement()
Get the replacement string.- Returns:
- the replacement string
-
-