Re: Ldap API Custom Controls

2017-09-04 Thread Chris Pike
Thanks for the suggestions and code examples. I'll work on adding this new 
control and let you know if I have any issues.

~Chris Pike



- Original Message -
From: "Emmanuel Lécharny" 
To: "api" 
Sent: Monday, September 4, 2017 3:46:49 AM
Subject: Re: Ldap API Custom Controls

Le 04/09/2017 à 09:16, Radovan Semancik a écrit :
> On 09/04/2017 09:02 AM, Emmanuel Lécharny wrote:
>> Actually, the tricky part is the grammar, which is a state engine
>> description.
>
> Oh, that is usually not that difficult either. Most of those "custom"
> controls are very simple. Just a couple of fields. Complex data
> structures seem to be very rare. If you start with existing control
> that is somehow similar it is not difficult to implement a new control.

FTR, the code I provided yesterday night in one of my previous mail took
me around 30 mins, all included. For a more complex control, like
syncrepl, that would have takne a bit more time, mainly because you want
to add unit tests to cover teh various cases.

Now, I think that we should provide a bit of documentation about how to
implement a control...

-- 
Emmanuel Lecharny

Symas.com
directory.apache.org


Re: Ldap API Custom Controls

2017-09-04 Thread Radovan Semancik

On 09/04/2017 09:02 AM, Emmanuel Lécharny wrote:

Actually, the tricky part is the grammar, which is a state engine
description.


Oh, that is usually not that difficult either. Most of those "custom" 
controls are very simple. Just a couple of fields. Complex data 
structures seem to be very rare. If you start with existing control that 
is somehow similar it is not difficult to implement a new control.


--
Radovan Semancik
Software Architect
evolveum.com



Re: Ldap API Custom Controls

2017-09-04 Thread Emmanuel Lécharny


Le 04/09/2017 à 08:49, Radovan Semancik a écrit :
> Hi,
>
> I have implemented a couple of controls myself. Perhaps the best
> approach is to do it right in the Apache Directory API source code.
> And contribute it back, of course :-)
> Start from any existing control. E.g. you can have a look at my AD
> DirSync control
> (org.apache.directory.api.ldap.extras.controls.ad.AdDirSync). It is
> enough to have some basic idea how LDAP protocol works and how the API
> works. Most of the work is mostly copy There are 3-4 classes to
> create. It is not difficult to figure out.

Actually, the tricky part is the grammar, which is a state engine
description.

-- 
Emmanuel Lecharny

Symas.com
directory.apache.org



Re: Ldap API Custom Controls

2017-09-04 Thread Radovan Semancik

Hi,

I have implemented a couple of controls myself. Perhaps the best 
approach is to do it right in the Apache Directory API source code. And 
contribute it back, of course :-)
Start from any existing control. E.g. you can have a look at my AD 
DirSync control 
(org.apache.directory.api.ldap.extras.controls.ad.AdDirSync). It is 
enough to have some basic idea how LDAP protocol works and how the API 
works. Most of the work is mostly copy There are 3-4 classes to 
create. It is not difficult to figure out.


--
Radovan Semancik
Software Architect
evolveum.com



On 09/03/2017 08:57 PM, Chris Pike wrote:

Trying to get Active Directory to honor password history when changing a 
password.

https://blogs.technet.microsoft.com/fieldcoding/2013/01/09/resetting-passwords-honoring-password-history-or-whats-happening-under-the-hood-when-changing-resetting-passwords/


- Original Message -
From: Emmanuel Lecharny 
To: api@directory.apache.org
Sent: Sun, 03 Sep 2017 14:38:26 -0400 (EDT)
Subject: Re: Ldap API Custom Controls

It's a bit tricky...

What control do you want to implement? Do you have a description ?

Le dim. 3 sept. 2017 à 15:58, Chris Pike  a écrit :


Hi,

I am trying to add a custom control. I started by creating a class that
implements "org.apache.directory.api.ldap.model.message.Control" and
passing an instance into my request. This didn't seem to work, I'm guessing
because the value for the control is not passed.

When looking at some of the other controls, I found a bunch of Decorator
and Factory classes in another package. Do I need to implement those types
of classes as well? If so, how do I register them? Is there a full example
of creating a custom control somewhere?

Thanks for any help you can provide.

~Chris Pike