Le 28/12/15 19:03, NIEROBBY a écrit :
>
>
> I am trying to customize passwordValidator but it is not working.
>
> What I did:
>
> 1) Create a new class inherited from PasswordValidator ( Just copy 
> DefaultPasswordValidator and did some changes )

That's the way to go.
> 2) First, I tried to put this class in lib/ext folder, but got ClassNotFound 
> error, so I have to it in apacheds-service-2.0.0-M20.jar,
> with same folder as DefaultPasswordValidator, this time no error thrown.
Ok. We ahve to figure out why your class has not been loaded outside of
the jar...
> 3) When input some password of an entry, it does not validate from my new 
> Validator. 

The validator gets loaded when the PasswordPolicy gets initializaed. The
PasswordPolicy configuration contains a field ads-pwdValidator that
should contain the FQCN of your class. So to speak, something like :
"org.apache.directory.server.core.api.authn.ppolicy.MyPasswordValidator"

The key here is to check the configuration and see if it gets loaded.
You can verify using Studio.
> 4) I also tried to disable defaultPasswordValidator, but I am not able to 
> connect apache ds after it is disabled.
>
> I got confused:
>
> 1) DefaultPasswordValidator is must enable?
PasswordPolicy *must* be enabled :

    public static PasswordPolicyConfiguration createPwdPolicyConfig(
PasswordPolicyBean passwordPolicyBean )
    {
        if ( ( passwordPolicyBean == null ) ||
passwordPolicyBean.isDisabled() )
        {
            return null;
        }

> 2) All password validator will be validated in chain, or only one of them 
> take effect?

The one associated with the PasswordPolicy that you are depending on.
> 3) How to make my customize validator work?
Assuming that the passwordPolicy is enabled, that should work.

Feel free to ask if you have still some issues...

Reply via email to