Hi Marc,

the PasswordModify extended request is natively supported by the LDAP API, there is no need to cast it. The class hierarchy is the following:

[[AbstractRequest]]
      ^
      |
      +-- [[AbstractExtendedReques]]
      |           ^
      |           |
      |           +-- [PasswordModifyRequestImpl]
      |
      +-- [OpaqueExtendedRequest]

It's a bbit a pity we havn't made the OpaqueExtendedRequest class extending the AbstractExtendedReques class, but anyway.

You have to check if the decoded class is not an instance of an existing class, before casting it to an OpaqueExtendedRequest. Here are the class that inherit directly from AbstractExtendedReques:

CancelRequestImpl
CertGenerationRequestImpl
EndTransactionRequestImpl
GracefulShutdownRequestImpl
PasswordModifyRequestImpl
StartTlsRequestImpl
StartTransactionRequestImpl
StoredProcedureRequestImpl
WhoAmIRequestImpl

On 06/01/2022 21:02, Marc Boorshtein wrote:

        we have replaced the ExtendedRequest/responseDecorator with the
        OpaqueExtendedRequest/Response classes.

        They have the gatValue() method that returns the byte[]
        containing the
        value:


This isn't working for me.  When I try to cast ExtendedRequest req to OpaqueExtendedRequest I get:

LDAPException: Other (80) Other
LDAPException: Server Message: OTHER: Extended operation handler for the specified EXTENSION_OID (1.3.6.1.4.1.4203.1.11.1) has failed to process your request: java.lang.ClassCastException: class org.apache.directory.api.ldap.extras.extended.pwdModify.PasswordModifyRequestImpl cannot be cast to class org.apache.directory.api.ldap.model.message.OpaqueExtendedRequest (org.apache.directory.api.ldap.extras.extended.pwdModify.PasswordModifyRequestImpl and org.apache.directory.api.ldap.model.message.OpaqueExtendedRequest are in unnamed module of loader 'app') at org.apache.directory.server.ldap.handlers.request.ExtendedRequestHandler.handle(ExtendedRequestHandler.java:122)

It doesn't look like PasswordModifyRequestImpl can be cast.  How does apacheds know to use a particular class implementation for an extended request?

Thanks
Marc

--
*Emmanuel Lécharny - CTO* 205 Promenade des Anglais – 06200 NICE
T. +33 (0)4 89 97 36 50
P. +33 (0)6 08 33 32 61
[email protected] https://www.busit.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to