Skip to main content

Custom Password policy handler in Identityserver 4

Many organizations keep their own password policies accordingly. When we provide the software solutions for this kind of companies we have to inherit the company password policy throughout the application.

In identity server we have the facility to maintain the standard password policy in Startup. cs file as below


you can control limited attributes using this function. But when it comes to a large scale to maintain the password policy we can use the below steps.

Add  PasswordPolicyHandlerService class in startup.cs file.




 In the PasswordPolicyHandlerService file inside the ValidateAsync method, you can customize your password policy as you prefer. But make sure to pass the relevant users to the method. Here I have used ApplicationUser.

Thanks,
Happy coding 😊

Comments

Post a Comment