[ 
https://issues.apache.org/jira/browse/DIRAPI-387?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17705224#comment-17705224
 ] 

Emmanuel Lécharny commented on DIRAPI-387:
------------------------------------------

Thanks !

Yep, in this very case, we don't have any {{LdapExcveption}} to propagate:

{code}
LdapConnectionTemplate.java:212:

...return authenticateConnection( connection, userDn, password );
{code}

{code}
LdapConnectionTemplate.java:228:

    private PasswordWarning authenticateConnection( final LdapConnection 
connection,
        final Dn userDn, final char[] password ) throws PasswordException
    {
        return passwordPolicyResponder.process(
            new PasswordPolicyOperation()
            {
                @Override
                public ResultResponse process() throws LdapException
                {
                ...
                }
            } );
    }
{code}

{code}
AbstractPasswordPolicyResponder.java:121:

    /**
     * {@inheritDoc}
     */
    @Override
    public final PasswordWarning process( PasswordPolicyOperation operation )
        throws PasswordException
    {
        try
        {
            ResultResponse response = operation.process();
            PasswordPolicyResponse passwordPolicyResponse = getPasswordPolicy( 
response );
            ResultCodeEnum resultCode = 
response.getLdapResult().getResultCode();
            
            if ( resultCode == ResultCodeEnum.SUCCESS )
            {
                return success( passwordPolicyResponse );
            }
            else
            {
                throw fail( response, passwordPolicyResponse, resultCode ); 
<<----
            }
        }
{code}

{code}
AbstractPasswordPolicyResponder.java:80:

    protected PasswordException fail( ResultResponse resultResponse, 
            PasswordPolicyResponse passwordPolicyResponse, ResultCodeEnum 
resultCode )
    {
        PasswordException exception = new PasswordException();
        exception.setResultCode( resultCode );
        
        if ( passwordPolicyResponse != null
            && passwordPolicyResponse.getPasswordPolicyError() != null )
        {
            exception.setPasswordPolicyError( 
passwordPolicyResponse.getPasswordPolicyError() );
        }
        return exception;
    }
{code}

So bottom line: we return the information we get from the server...

> More info on PasswordException
> ------------------------------
>
>                 Key: DIRAPI-387
>                 URL: https://issues.apache.org/jira/browse/DIRAPI-387
>             Project: Directory Client API
>          Issue Type: Improvement
>            Reporter: Natan Abolafya
>            Priority: Minor
>         Attachments: debug.png
>
>
> It would be nice to get more info on PasswordException.
> Here is a response coming from Active Directory.
>  
> {code:java}
> Message ID : 7
>     BindResponse
>         Ldap Result
>             Result code : (INVALID_CREDENTIALS) invalidCredentials
>             Matched Dn : ''
>             Diagnostic message : '80090308: LdapErr: DSID-0C090446, comment: 
> AcceptSecurityContext error, data 533, v4563 '
> ){code}
>  
>  
> The information in Diagnostic message can be quite useful sometimes. In this 
> case, the "data 533" means the account is disabled which would be quite 
> useful information for diagnostics. I am attaching how the exception looks 
> like on debugger also.
>  
> Normal LdapExceptions have this information but not the PasswordException. It 
> would be really nice to add it.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to