@Override public Promise<Result> apply(UserProfile profile) throws Throwable { if (profile != null) { logger.debug("authorizerName: {}", authorizerName); if (authorizationChecker.isAuthorized(context, profile, authorizerName, config.getAuthorizers())) { logger.debug("authenticated and authorized -> grant access"); // when called from Scala if (delegate == null) { return Promise.pure(null); } else { return delegate.call(ctx); } } else { logger.debug("forbidden"); return forbidden(context, currentClients, profile); } } else { if (startAuthentication(context, currentClients)) { logger.debug("Starting authentication"); saveRequestedUrl(context, currentClients); return Promise.promise(() -> redirectToIdentityProvider(context, currentClients)); } else { logger.debug("unauthorized"); return unauthorized(context, currentClients); } } } });
logger.debug("useSession: {}", useSession); final Promise<UserProfile> promiseProfile = Promise.promise(() -> {