That's excellent!!! Been going nuts with this password policy stuff. Thank you! 


Regards,
Carlo Accorsi



-----Original Message-----
From: Emmanuel Lécharny [mailto:[email protected]] 
Sent: Friday, June 22, 2012 5:15 PM
To: [email protected]
Subject: Re: 2 issues with Password policy response warnings / types

Le 6/22/12 10:54 PM, [email protected] 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