List<Interceptor> interceptorList = service.getInterceptors();
if ( dsBuilder.authenticators().length != 0 )
{
AuthenticationInterceptor authenticationInterceptor = null;
for ( Interceptor interceptor : interceptorList )
{
if ( interceptor instanceof AuthenticationInterceptor )
{
authenticationInterceptor = ( AuthenticationInterceptor ) interceptor;
break;
}
}
if ( authenticationInterceptor == null )
{
throw new IllegalStateException(
"authentication interceptor not found" );
}
Set<Authenticator> authenticators = new HashSet<Authenticator>();
for ( CreateAuthenticator createAuthenticator : dsBuilder
.authenticators() )
{
Authenticator auth = createAuthenticator.type().newInstance();
if ( auth instanceof DelegatingAuthenticator )
{
DelegatingAuthenticator dauth = ( DelegatingAuthenticator ) auth;
dauth.setDelegateHost( createAuthenticator.delegateHost() );
dauth.setDelegatePort( createAuthenticator.delegatePort() );
dauth.setDelegateSsl( createAuthenticator.delegateSsl() );
dauth.setDelegateTls( createAuthenticator.delegateTls() );
dauth.setDelegateBaseDn( createAuthenticator.delegateBaseDn() );
dauth.setDelegateSslTrustManagerFQCN( createAuthenticator.delegateSslTrustManagerFQCN() );
dauth.setDelegateTlsTrustManagerFQCN( createAuthenticator.delegateTlsTrustManagerFQCN() );
}
authenticators.add( auth );
}
authenticationInterceptor.setAuthenticators( authenticators );
authenticationInterceptor.init( service );
}
service.setInterceptors( interceptorList );
SchemaManager schemaManager = service.getSchemaManager();