use of org.apache.directory.api.ldap.extras.extended.pwdModify.PasswordModifyResponseImpl in project directory-ldap-api by apache.
the class ApiLdapExtrasCodecApiOsgiTest method useBundleClasses.
@Override
protected void useBundleClasses() throws Exception {
SynchronizationModeEnum.REFRESH_AND_PERSIST.getValue();
new AdDirSyncImpl().getOid();
new AdShowDeletedImpl().getOid();
new AdPolicyHintsImpl().getOid();
new ChangeNotificationsImpl().getOid();
new PermissiveModifyImpl().getOid();
new PasswordPolicyImpl().getOid();
new PasswordPolicyResponseImpl().getGraceAuthNRemaining();
new SyncDoneValueImpl().getOid();
new SyncRequestValueImpl().getOid();
new SyncStateValueImpl(true).getCookie();
new VirtualListViewRequestImpl().getOid();
new VirtualListViewResponseImpl().getOid();
new PasswordModifyRequestImpl().getUserIdentity();
new PasswordModifyResponseImpl(5).setResponseName("foo");
new WhoAmIRequestImpl();
new WhoAmIResponseImpl().setDn(new Dn("uid=admin,ou=system"));
new StartTlsRequestImpl();
new StartTlsResponseImpl();
new StartTransactionRequestImpl();
new StartTransactionResponseImpl();
}
use of org.apache.directory.api.ldap.extras.extended.pwdModify.PasswordModifyResponseImpl in project directory-ldap-api by apache.
the class PasswordModifyFactory method newResponse.
/**
* {@inheritDoc}
*/
@Override
public PasswordModifyResponse newResponse(byte[] encodedValue) throws DecoderException {
PasswordModifyResponseDecorator response = new PasswordModifyResponseDecorator(codec, new PasswordModifyResponseImpl());
response.setResponseValue(encodedValue);
return response;
}
use of org.apache.directory.api.ldap.extras.extended.pwdModify.PasswordModifyResponseImpl in project directory-ldap-api by apache.
the class PasswordModifyFactory method decorate.
/**
* {@inheritDoc}
*/
@Override
public PasswordModifyResponseDecorator decorate(ExtendedResponse decoratedResponse) {
if (decoratedResponse instanceof PasswordModifyResponseDecorator) {
return (PasswordModifyResponseDecorator) decoratedResponse;
}
if (decoratedResponse instanceof PasswordModifyResponse) {
return new PasswordModifyResponseDecorator(codec, (PasswordModifyResponse) decoratedResponse);
}
// It's an opaque extended operation
@SuppressWarnings("unchecked") ExtendedResponseDecorator<ExtendedResponse> response = (ExtendedResponseDecorator<ExtendedResponse>) decoratedResponse;
// Decode the response, as it's an opaque operation
Asn1Decoder decoder = new Asn1Decoder();
byte[] value = response.getResponseValue();
PasswordModifyResponseContainer container = new PasswordModifyResponseContainer();
PasswordModifyResponse pwdModifyResponse;
if (value != null) {
ByteBuffer buffer = ByteBuffer.wrap(value);
try {
decoder.decode(buffer, container);
pwdModifyResponse = container.getPwdModifyResponse();
// Now, update the created response with what we got from the extendedResponse
pwdModifyResponse.getLdapResult().setResultCode(response.getLdapResult().getResultCode());
pwdModifyResponse.getLdapResult().setDiagnosticMessage(response.getLdapResult().getDiagnosticMessage());
pwdModifyResponse.getLdapResult().setMatchedDn(response.getLdapResult().getMatchedDn());
pwdModifyResponse.getLdapResult().setReferral(response.getLdapResult().getReferral());
} catch (DecoderException de) {
StringWriter sw = new StringWriter();
de.printStackTrace(new PrintWriter(sw));
String stackTrace = sw.toString();
// Error while decoding the value.
pwdModifyResponse = new PasswordModifyResponseImpl(decoratedResponse.getMessageId(), ResultCodeEnum.OPERATIONS_ERROR, stackTrace);
}
} else {
pwdModifyResponse = new PasswordModifyResponseImpl();
// Now, update the created response with what we got from the extendedResponse
pwdModifyResponse.getLdapResult().setResultCode(response.getLdapResult().getResultCode());
pwdModifyResponse.getLdapResult().setDiagnosticMessage(response.getLdapResult().getDiagnosticMessage());
pwdModifyResponse.getLdapResult().setMatchedDn(response.getLdapResult().getMatchedDn());
pwdModifyResponse.getLdapResult().setReferral(response.getLdapResult().getReferral());
}
PasswordModifyResponseDecorator decorated = new PasswordModifyResponseDecorator(codec, pwdModifyResponse);
Control ppolicyControl = response.getControl(PasswordPolicy.OID);
if (ppolicyControl != null) {
decorated.addControl(ppolicyControl);
}
return decorated;
}
Aggregations