Le 6/22/12 10:54 PM, carlo.acco...@ibs-ag.com a écrit :
Thanks that's great!    
There is also a class that handle all the decoding and creates a plain Java object with all the expected data :

        DefaultLdapCodecService codec = new DefaultLdapCodecService();

PasswordPolicyDecorator control = new PasswordPolicyDecorator( codec, true );

        // bb contains the received bytes :
        ByteBuffer bb = ByteBuffer.allocate( 0xA );

        bb.put( new byte[]
            {
                0x30, 0x08,
                  ( byte ) 0xA0, 0x03, // timeBeforeExpiration
                    ( byte ) 0x80, 0x01, 0x01,
                  ( byte ) 0x81, 0x01, 0x01 // ppolicyError
        } );

        bb.flip();

PasswordPolicy passwordPolicy = ( PasswordPolicy ) control.decode( bb.array() );


Here, you can no do :

        if ( passwordPolicy.hasResponse() )
        {
int expiration = passwordPolicy.getResponse().getTimeBeforeExpiration(); int error = passwordPolicy.getResponse().getPasswordPolicyError().getValue();
        }


--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com

Reply via email to