Regex Username Transformer
Description
This username transformer transforms a user name with a regular expression (regex). Specifically, it searches for the specified pattern and replaces all matches with the replacement string (using the method
replaceAll(replacement)). May be used by
Authentication Flow Kerberos SPNEGO Extractor Basic Auth Request Authentication SSI Passwordless Authentication Step SSI Authentication Step OTP Check via RADIUS Step Administrators Configuration Admin SSO Ticket Request Authentication One-Shot Authentication Flow Basic Auth HTTP Header Extractor OAuth 2.0/OIDC Authorization Server Adminapp REST API Configuration SAML 2.0 Flow SP Authenticator-based One-Shot Target Application Certificate Authenticator Kerberos User Definition Session-less REST Endpoints Transaction Approval Flow RADIUS Authenticator SSO Ticket Request Authentication Radius Authentication Service Public Self-Service Flow Credential Data Certificate Matcher Client Certificate (X.509) Request Authentication
Properties
Regex (
regex) Description
Regular expression to match the input user name or part of it. The expression '(.+)' matches the whole string and saves it as a group which can be referenced as '$1' in the replacement expression.
Notice: To match any string, always use "(.+)", and never "(.*)" since the latter also matches against the empty string and thus the replacement will be applied twice.
- To add the prefix 'SubjectEmail:', use Regex='^(.+)$' and Replacement='SubjectEmail:$1'.
- To remove all whitespace from the user name, use Regex='\s' and Replacement=''.
- To remove the domain part of an email address, use Regex='@.*$' and Replacement=''.
Attributes
RegEx
Mandatory
Replacement (
replacement) Description
The expression to replace the matched text with. The first matching group of the regex is denoted '$1'.
Attributes
String
Optional
Stop After Successful Transformation (
stopAfterSuccessfulTransformation) Description
With this flag the chaining of username transformers can be interrupted. If it is enabled and the regular expression matched the user name (no matter whether the replacement actually resulted in a different username), following username transformers are not executed.
Attributes
Boolean
Optional
Default value
false
YAML Template (with default values)
type: RegexUsernameTransformer
id: RegexUsernameTransformer-xxxxxx
displayName:
comment:
properties:
regex:
replacement:
stopAfterSuccessfulTransformation: false