use of org.apache.directory.api.ldap.extras.extended.startTls.StartTlsRequestImpl 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.startTls.StartTlsRequestImpl in project directory-ldap-api by apache.
the class LdapNetworkConnection method startTls.
/**
* Sends the StartTLS extended request to server and adds a security layer
* upon receiving a response with successful result. Note that we will use
* the default LDAP connection.
*
* @throws LdapException If the StartTLS operation failed
*/
public void startTls() throws LdapException {
try {
if (config.isUseSsl()) {
throw new LdapException("Cannot use TLS when the useSsl flag is set true in the configuration");
}
// try to connect, if we aren't already connected.
connect();
checkSession();
IoFilter sslFilter = ldapSession.getFilterChain().get(SSL_FILTER_KEY);
if (sslFilter != null) {
if (LOG.isDebugEnabled()) {
LOG.debug(I18n.msg(I18n.MSG_03222_LDAP_ALREADY_USING_START_TLS));
}
return;
}
ExtendedResponse resp = extended(new StartTlsRequestImpl());
LdapResult result = resp.getLdapResult();
if (result.getResultCode() == ResultCodeEnum.SUCCESS) {
addSslFilter();
} else {
throw new LdapOperationException(result.getResultCode(), result.getDiagnosticMessage());
}
} catch (LdapException e) {
throw e;
} catch (Exception e) {
throw new LdapException(e);
}
}
Aggregations