Package org.apache.directory.api.ldap.extras.extended

Examples of org.apache.directory.api.ldap.extras.extended.PwdModifyResponse


        PwdModifyRequestImpl pwdModifyRequest = new PwdModifyRequestImpl();
        pwdModifyRequest.setUserIdentity( Strings.getBytesUtf8( "cn=User3,ou=system" ) );
        pwdModifyRequest.setNewPassword( Strings.getBytesUtf8( "secret3Bis" ) );

        // Send the request
        PwdModifyResponse pwdModifyResponse = ( PwdModifyResponse ) adminConnection.extended( pwdModifyRequest );

        assertEquals( ResultCodeEnum.SUCCESS, pwdModifyResponse.getLdapResult().getResultCode() );

        // Now try to bind with the new password
        LdapConnection userConnection = getNetworkConnectionAs( ldapServer, "cn=User3,ou=system", "secret3Bis" );

        Entry entry = userConnection.lookup( "cn=User3,ou=system" );
View Full Code Here


        byte[] value = response.getResponseValue();
        ByteBuffer buffer = ByteBuffer.wrap( value );

        PasswordModifyResponseContainer container = new PasswordModifyResponseContainer();
        PwdModifyResponse pwdModifyResponse = null;
       
        try
        {
            decoder.decode( buffer, container );

            pwdModifyResponse = container.getPwdModifyResponse();

            // Now, update the created response with what we got from the extendedResponse
            pwdModifyResponse.getLdapResult().setResultCode( response.getLdapResult().getResultCode() );
            pwdModifyResponse.getLdapResult().setDiagnosticMessage( response.getLdapResult().getDiagnosticMessage() );
            pwdModifyResponse.getLdapResult().setMatchedDn( response.getLdapResult().getMatchedDn() );
            pwdModifyResponse.getLdapResult().setReferral( response.getLdapResult().getReferral() );
        }
        catch ( DecoderException de )
        {
            StringWriter sw = new StringWriter();
            de.printStackTrace( new PrintWriter( sw ) );
View Full Code Here

    public Asn1Object decode( byte[] stream ) throws DecoderException
    {
        ByteBuffer bb = ByteBuffer.wrap( stream );
        PasswordModifyResponseContainer container = new PasswordModifyResponseContainer();
        decoder.decode( bb, container );
        PwdModifyResponse pwdModifyResponse = container.getPwdModifyResponse();

        // Clean the container for the next decoding
        container.clean();

        return ( ( PasswordModifyResponseDecorator ) pwdModifyResponse ).getPasswordModifyResponse();
View Full Code Here

        {
            de.printStackTrace();
            fail( de.getMessage() );
        }

        PwdModifyResponse pwdModifyResponse = container.getPwdModifyResponse();
        assertNull( pwdModifyResponse.getGenPassword() );

        // Check the length
        assertEquals( 0x02, ( ( PasswordModifyResponseDecorator ) pwdModifyResponse ).getPasswordModifyResponse()
            .computeLength() );
View Full Code Here

        {
            de.printStackTrace();
            fail( de.getMessage() );
        }

        PwdModifyResponse pwdModifyResponse = container.getPwdModifyResponse();
        assertNotNull( pwdModifyResponse.getGenPassword() );
        assertEquals( 0, pwdModifyResponse.getGenPassword().length );

        // Check the length
        assertEquals( 0x04, ( ( PasswordModifyResponseDecorator ) pwdModifyResponse ).getPasswordModifyResponse()
            .computeLength() );
View Full Code Here

        {
            de.printStackTrace();
            fail( de.getMessage() );
        }

        PwdModifyResponse pwdModifyResponse = container.getPwdModifyResponse();
        assertNotNull( pwdModifyResponse.getGenPassword() );
        assertEquals( "abcd", Strings.utf8ToString( pwdModifyResponse.getGenPassword() ) );

        // Check the length
        assertEquals( 0x08, ( ( PasswordModifyResponseDecorator ) pwdModifyResponse ).getPasswordModifyResponse()
            .computeLength() );
View Full Code Here

        // Now change the password
        PwdModifyRequestImpl pwdModifyRequest = new PwdModifyRequestImpl();
        pwdModifyRequest.setNewPassword( Strings.getBytesUtf8( "secret1Bis" ) );

        // Send the request
        PwdModifyResponse pwdModifyResponse = ( PwdModifyResponse ) userConnection.extended( pwdModifyRequest );

        assertEquals( ResultCodeEnum.SUCCESS, pwdModifyResponse.getLdapResult().getResultCode() );

        // Now try to bind with the new password
        userConnection = getNetworkConnectionAs( ldapServer, "cn=User1,ou=system", "secret1Bis" );

        Entry entry = userConnection.lookup( "cn=User1,ou=system" );
View Full Code Here

        pwdModifyRequest.setUserIdentity( Strings.getBytesUtf8( "cn=User2,ou=system" ) );
        pwdModifyRequest.setOldPassword( Strings.getBytesUtf8( "secret2" ) );
        pwdModifyRequest.setNewPassword( Strings.getBytesUtf8( "secret2Bis" ) );

        // Send the request
        PwdModifyResponse pwdModifyResponse = ( PwdModifyResponse ) anonymousConnection.extended( pwdModifyRequest );

        assertEquals( ResultCodeEnum.SUCCESS, pwdModifyResponse.getLdapResult().getResultCode() );

        // Check that we can now bind using the new credentials
        userConnection = getNetworkConnectionAs( ldapServer, "cn=User2,ou=system", "secret2Bis" );

        entry = userConnection.lookup( "cn=User2,ou=system" );
View Full Code Here

        pwdModifyRequest.setUserIdentity( Strings.getBytesUtf8( "cn=User3,ou=system" ) );
        pwdModifyRequest.setOldPassword( Strings.getBytesUtf8( "secret3" ) );
        pwdModifyRequest.setNewPassword( Strings.getBytesUtf8( "secret3Bis" ) );

        // Send the request
        PwdModifyResponse pwdModifyResponse = ( PwdModifyResponse ) anonymousConnection.extended( pwdModifyRequest );

        assertEquals( ResultCodeEnum.SUCCESS, pwdModifyResponse.getLdapResult().getResultCode() );

        // Check that we can now bind using the new credentials
        userConnection = getNetworkConnectionAs( ldapServer, "cn=User3,ou=system", "secret3Bis" );

        entry = userConnection.lookup( "cn=User3,ou=system" );
View Full Code Here

        PwdModifyRequestImpl pwdModifyRequest = new PwdModifyRequestImpl();
        pwdModifyRequest.setUserIdentity( Strings.getBytesUtf8( "cn=User4,ou=system" ) );
        pwdModifyRequest.setNewPassword( Strings.getBytesUtf8( "secret4Bis" ) );

        // Send the request
        PwdModifyResponse pwdModifyResponse = ( PwdModifyResponse ) adminConnection.extended( pwdModifyRequest );

        assertEquals( ResultCodeEnum.SUCCESS, pwdModifyResponse.getLdapResult().getResultCode() );

        // Now try to bind with the new password
        LdapConnection userConnection = getNetworkConnectionAs( ldapServer, "cn=User4,ou=system", "secret4Bis" );

        Entry entry = userConnection.lookup( "cn=User4,ou=system" );
View Full Code Here

TOP

Related Classes of org.apache.directory.api.ldap.extras.extended.PwdModifyResponse

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.