Package org.wildfly.security.auth.util
Class RegexNameValidatingRewriter
java.lang.Object
org.wildfly.security.auth.util.RegexNameValidatingRewriter
- All Implemented Interfaces:
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
ConstructorsConstructorDescriptionRegexNameValidatingRewriter(Pattern pattern, boolean match) Construct a new instance. -
Method Summary
Modifier and TypeMethodDescriptionGet the pattern.booleanisMatch()Get the match flag.rewriteName(String original) Rewrite a name.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.wildfly.security.auth.server.NameRewriter
asPrincipalRewriter
-
Constructor Details
-
RegexNameValidatingRewriter
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 valid (must not benull)match-trueif the pattern must match,falseif the pattern must not match
-
-
Method Details
-
rewriteName
Description copied from interface:NameRewriterRewrite a name. Must not returnnull.- Specified by:
rewriteNamein interfaceNameRewriter- Parameters:
original- the original name (must not benull)- Returns:
- the rewritten name, or
nullif the name is invalid
-
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
-