A custom password validator (custom password policy extension) implementation to validate password against a set of commonly used dictionary values and username.
Simple put, the custom password validator (countersign validator) throws an error if the password is same as the useranem, and if the password contains any of the following strings ...
- admin
- password
- root
- 123
Build the project by running ...
mvn clean package
After a successful build, copy the countersign-validator-1.0.0.jar
artifact from the target
folder and paste it inside <IS HOME>/repository/components/dropins
folder. And specify the deployed password validator as an extension inside the <IS HOME>/repository/conf/identity/identity-mgt.properties
file.
Simply add the following lines at the end of the identity-mgt.properties
file to use the custom password validator implementation
Password.policy.extensions.1=com.athiththan.sample.CountersignValidator
Password.policy.extensions.1.faultMsg="Validation failed :: according to Countersign Validator"
Navigate to <IS HOME>/repository/conf/identity/identity.xml
and enable the following EventListener
to enable=true
<EventListener type="org.wso2.carbon.user.core.listener.UserOperationEventListener"
name="org.wso2.carbon.identity.mgt.IdentityMgtEventListener"
orderId="50" enable="true"/>
Start your WSO2 Identity Server by executing the command from your <IS HOME>/bin
folder
sh wso2server.sh
or
wso2is-5.5.0
Navigate to the Carbon Management console
and login as admin using admin
for both the username and password.
Navigate to Main -> Identity -> Users and Roles -> Add -> Add New User
and provide
- your favourite string as both username and password
- enter any username and enter a password containing any above mentioned strings
click finish and see the prompted error messages.