Hi
In a net 3.5 csharp application I need to know in advance if an AD password will meet configured complexity requirements. How can you do that?
TIA
Hi
In a net 3.5 csharp application I need to know in advance if an AD password will meet configured complexity requirements. How can you do that?
TIA
These links may point you in the right track:
Change user password in ADS and check the domain password policy (C#)?
User Management with Active Directory—Managing Passwords for ADAM Users
Determining Domain-Wide Account Policies (this one appears to have what you need)
If you want to fetch the requirements from AD, then the links in @Leniel Macaferi's answer should help.
If you already know the expected requirements and your app is accepting the proposed password as a string, you can make the tests yourself. Some common requirements and ways to calculate them include:
[a-z]
, [A-Z]
, [0-9]
, [~!@#$%^&*()-_\+=<,>\.\?\/]
; for each one that matches, add 1 to your counter. If the count at the end is less than your requirements, the password fails. (You could even be extra nice to the user and suggest one of the categories they missed, if you kept boolean variables for the categories they used and didn't use.)