The debugger tells me that api request controls are loaded in 
[StockCodecFactoryUtil](https://github.com/apache/directory-ldap-api/blob/master/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/StockCodecFactoryUtil.java)

So, I added my RelaxControl into the api code space, and added this blurb to 
StockCodecFactoryUtil class:

```
ControlFactory<RelaxControl> relaxControlFactory = new RelaxControlFactory( 
apiService );
requestControlFactories.put( relaxControlFactory.getOid(), relaxControlFactory 
);
```

Once registered the control is found by the runtime and things become … well 
Relaxed ;-)

—
Shawn

> On Jun 23, 2021, at 3:04 PM, Shawn McKinney <smckin...@apache.org> wrote:
> 
> Onto the next problem…
> 
> As described back in April on this ML:
> 
> [Relax Control and password 
> policies](http://mail-archives.apache.org/mod_mbox/directory-api/202104.mbox/%3CECC48E64-6CF9-40B7-8BC4-FCE60E40684E%40apache.org%3E)
> 
> I added support to use the Relax Control to the fortress core code base.
> 
> Moving onto 2.x API this control this code is now broken.
> 
> Specifically, I get this error when adding the control to an ldap request:
> 
> ```
> : ERR_08002_CANNOT_FIND_CONTROL_FACTORY failed to find a control factory for 
> control OID: 1.3.6.1.4.1.4203.666.5.12 
> 2021-06-23 14:36:023 WARN  LdapNetworkConnection:2478 - 
> org.apache.directory.api.asn1.EncoderException: 
> ERR_08002_CANNOT_FIND_CONTROL_FACTORY failed to find a control factory for 
> control OID: 1.3.6.1.4.1.4203.666.5.12
> org.apache.mina.filter.codec.ProtocolEncoderException: 
> org.apache.directory.api.asn1.EncoderException: 
> ERR_08002_CANNOT_FIND_CONTROL_FACTORY failed to find a control factory for 
> control OID: 1.3.6.1.4.1.4203.666.5.12
> ```
> 
> Revisiting this example:
> http://directory.apache.org/api/internal-design-guide/13-controls.html
> 
> I noticed that the decorator and factory classes weren’t implemented in my 
> solution.  Actually, as I recall, I did add them, but realized they weren’t 
> needed (with 1.x) and so I removed them.
> 
> I’ve since readded them:
> 
> 1. 
> [RelaxControlFactory](https://github.com/apache/directory-fortress-core/blob/FC-238/src/main/java/org/apache/directory/fortress/core/ldap/RelaxControlFactory.java)
> 2. 
> [RelaxControlDecorator](https://github.com/apache/directory-fortress-core/blob/FC-238/src/main/java/org/apache/directory/fortress/core/ldap/RelaxControlDecorator.java)
> 
> To the existing two:
> 
> 3. 
> [RelaxControl](https://github.com/apache/directory-fortress-core/blob/FC-238/src/main/java/org/apache/directory/fortress/core/ldap/RelaxControl.java)
> 
> 4. 
> [RelaxControlImpl](https://github.com/apache/directory-fortress-core/blob/FC-238/src/main/java/org/apache/directory/fortress/core/ldap/RelaxControlImpl.java)
> 
> During the readding of the decorator and factory, I also noticed that the 
> example implentation referenced above does not match its associated 
> interfaces, i.e. has changed since 1.x.  
> 
> So, I hacked a bit more to get my code to compile knowing that it's probably 
> not right and guess what -- it isn’t.
> 
> Same error as above.  
> 
> Any help getting past this one is appreciated.
> 
> Still poking around 2.0 codebase to find viable example (for 2.0), and will 
> keep looking.
> 
> Thanks
> 
> —
> Shawn
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: api-unsubscr...@directory.apache.org
For additional commands, e-mail: api-h...@directory.apache.org

Reply via email to