directory-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <Carlo.Acco...@ibs-ag.com>
Subject RE: 2 issues with Password policy response warnings / types
Date Sat, 23 Jun 2012 09:35:03 GMT
That's excellent!!! Been going nuts with this password policy stuff. Thank you! 


Regards,
Carlo Accorsi



-----Original Message-----
From: Emmanuel Lécharny [mailto:elecharny@gmail.com] 
Sent: Friday, June 22, 2012 5:15 PM
To: users@directory.apache.org
Subject: Re: 2 issues with Password policy response warnings / types

Le 6/22/12 10:54 PM, Carlo.Accorsi@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

Mime
View raw message