private <T, Q> IAsyncResultHandler<T> successHandler(final IAsyncResultHandler<Q> errorHandler,
            final IAsyncHandler<T> successHandler) {
        return new IAsyncResultHandler<T>() {

            @Override
            public void handle(IAsyncResult<T> result) {
                if (result.isError()) {
                    errorHandler.handle(AsyncResultImpl.<Q>create(result.getError()));
                } else {
                    successHandler.handle(result.getResult());
                }
            }
        };
    }
Formats the configured DN by replacing any properties it finds.
@param dnPattern
@param username
@param request
gateway/engine/policies/src/main/java/io/apiman/gateway/engine/policies/auth/LDAPIdentityValidator.java