← Back to plugin index

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)).
Type name
RegexUsernameTransformer
Class
com.airlock.iam.core.misc.impl.authen.RegexUsernameTransformer
May be used by
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.

Examples:
  • 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