0
votes

Is it possible to change UserName regex validation in WSO2IS. Because when I'm syncing users from my database to WSO2IS, some users failed due to username validation. Some user's username property not match with the validation. Below is my error response. So is it possible to change this validation.

{"schemas":["urn:ietf:params:scim:api:messages:2.0:BulkResponse"],"Operations":[{"bulkId":"qwerty1","method":"POST","response":"{"schemas":["urn:ietf:params:scim:api:messages:2.0:Error"],"scimType":"invalidValue","detail":"31301 - Username [email protected] is not valid. User name must be a non null string with following format, [a-zA-Z0-9._\\-|//]{3,30}$","status":"400"}","status":{"code":400}}]}

2
You can find the answers to this type of question easily by searching on product documentation (is.docs.wso2.com/en/latest). If you fail to find the solutions from the WSO2 IS documentation, it's better to raise those questions in the slack channel. wso2is.slack.com/join/shared_invite/…Anuradha Karunarathna

2 Answers

1
votes

You can change the username regex by adding the following config to the deployment.toml and restart the server. (Note: If [user_store] is already defined in the deployment.toml add these configs under the same tag). Add the regex values within the inverted commas as you required.

[user_store]
username_java_regex=""
username_java_script_regex=""

Refer:

  1. https://is.docs.wso2.com/en/latest/setup/working-with-properties-of-user-stores/#working-with-properties-of-user-stores
1
votes

Yes, you can change the username regex validation in WSO2IS. Since you are trying to validate the email address pattern as the username you can try using the following configuration in the [IS-Home]/repository/conf/deployment.toml file under [user_store] section.

[user_store]
username_java_regex="^[a-zA-Z0–9._-]+@[a-zA-Z0–9.-]+\\.[a-zA-Z]{2,4}$"
username_java_script_regex="^[a-zA-Z0–9._-]+@[a-zA-Z0–9.-]+\\.[a-zA-Z]{2,4}$"

If you want to validate a different regex pattern, you can add that regex pattern in the above configuration.