Package org.wildfly.security.auth.util
Class RegexNameValidatingRewriter
- java.lang.Object
-
- org.wildfly.security.auth.util.RegexNameValidatingRewriter
-
- All Implemented Interfaces:
NameRewriter
public final class RegexNameValidatingRewriter extends Object implements NameRewriter
A regular expression-based name validation rewriter. Always returns the original name if the name is valid.- Author:
- David M. Lloyd
-
-
Field Summary
-
Fields inherited from interface org.wildfly.security.auth.server.NameRewriter
IDENTITY_REWRITER
-
-
Constructor Summary
Constructors Constructor Description RegexNameValidatingRewriter(Pattern pattern, boolean match)
Construct a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Pattern
getPattern()
Get the pattern.boolean
isMatch()
Get the match flag.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
-
RegexNameValidatingRewriter
public RegexNameValidatingRewriter(Pattern pattern, boolean match)
Construct a new instance. The pattern is a partial pattern; if the whole string is to be matched, then the appropriate regex anchors should be used.- Parameters:
pattern
- the pattern that the name must match (or not match) in order to be considered validmatch
-true
if the pattern must match,false
if the pattern must not match
-
-
Method Detail
-
rewriteName
public String rewriteName(String original)
Description copied from interface:NameRewriter
Rewrite a name. Must not returnnull
.- Specified by:
rewriteName
in interfaceNameRewriter
- Parameters:
original
- the original name (must not benull
)- Returns:
- the rewritten name, or
null
if the name is invalid
-
getPattern
public Pattern getPattern()
Get the pattern.- Returns:
- the pattern
-
isMatch
public boolean isMatch()
Get the match flag. If the flag istrue
, the pattern must match; iffalse
, the pattern must not match.- Returns:
- the match flag
-
-