private void bind(final LDAPIdentitySource config, final LdapConfigBean ldapConfigBean, final ILdapComponent ldapComponent,
            final IPolicyContext context, final IAsyncResultHandler<ILdapResult> handler) {
        // If no role extraction is needed, just do a fast and simple BIND & exit
        if (!config.isExtractRoles()) {
            ldapComponent.bind(ldapConfigBean, handler);
        } else { // Otherwise open up longer-lived connection and query role info.
            ldapComponent.connect(ldapConfigBean, successHandler(handler, new IAsyncHandler<ILdapClientConnection>() {
                @Override // Extract the roles.
                public void handle(final ILdapClientConnection connection) {
                    extractRoles(connection, ldapConfigBean.getBindDn(), config, context, handler);
                }
            }));
        }
    }
@see io.apiman.gateway.engine.policies.auth.IIdentityValidator#validate(java.lang.String, java.lang.String, io.apiman.gateway.engine.beans.ApiRequest, io.apiman.gateway.engine.policy.IPolicyContext, java.lang.Object, io.apiman.gateway.engine.async.IAsyncResultHandler)
gateway/engine/policies/src/main/java/io/apiman/gateway/engine/policies/auth/LDAPIdentityValidator.java