@Test public void indirectClientIsFirstClientAvailable(final TestContext testContext) { final Async async = testContext.async(); final CompletableFuture<HttpAction> future = authenticator.authenticate(webContext, Arrays.asList(getIndirectClient())); final CompletableFuture<String> requestedUrlFuture = future.thenCompose(a -> { assertThat(a, is(notNullValue())); assertThat(a.getCode(), is(HttpConstants.TEMP_REDIRECT)); assertThat(responseHeaders.get(HttpConstants.LOCATION_HEADER), is(AUTH_REDIRECT_URL)); return webContext.getSessionStore().get(webContext, Pac4jConstants.REQUESTED_URL); }); assertSuccessfulEvaluation(requestedUrlFuture, s -> { assertThat(s, is(MockAsyncWebContextBuilder.DEFAULT_FULL_REQUEST_URL)); }, async); }
public final <U extends CommonProfile> CompletableFuture<HttpAction> authenticate(final C context, final List<AsyncClient<? extends Credentials, U>> currentClients) { if (startAuthentication(context, currentClients)) { logger.debug("Starting authentication"); return indirectAuthenticationInitiator.initiateIndirectFlow(context, currentClients); } else { logger.debug("unauthorized"); return CompletableFuture.completedFuture(unauthorized(context, currentClients)); } }
AsyncDirectAuthFailedAuthenticator { public final <U extends CommonProfile> CompletableFuture<HttpAction> authenticate(final C context, final List<AsyncClient<? extends Credentials, U>> currentClients) { if (startAuthentication(context, currentClients)) { logger.debug("Starting authentication"); return indirectAuthenticationInitiator.initiateIndirectFlow(context, currentClients); } else { logger.debug("unauthorized"); return CompletableFuture.completedFuture(unauthorized(context, currentClients)); } } }
AsyncDirectAuthFailedAuthenticator { public final <U extends CommonProfile> CompletableFuture<HttpAction> authenticate(final C context, final List<AsyncClient<? extends Credentials, U>> currentClients) { if (startAuthentication(context, currentClients)) { logger.debug("Starting authentication"); return indirectAuthenticationInitiator.initiateIndirectFlow(context, currentClients); } else { logger.debug("unauthorized"); return CompletableFuture.completedFuture(unauthorized(context, currentClients)); } }  }
AsyncDirectAuthFailedAuthenticator { public final <U extends CommonProfile> CompletableFuture<HttpAction> authenticate(final C context, final List<AsyncClient<? extends Credentials, U>> currentClients) { if (startAuthentication(context, currentClients)) { logger.debug("Starting authentication"); return indirectAuthenticationInitiator.initiateIndirectFlow(context, currentClients); } else { logger.debug("unauthorized"); return CompletableFuture.completedFuture(unauthorized(context, currentClients)); } }  final CompletableFuture<HttpAction> authenticate(final C context, final List<AsyncClient<? extends Credentials, U>> currentClients); }
AsyncDirectAuthFailedAuthenticator { public final <U extends CommonProfile> CompletableFuture<HttpAction> authenticate(final C context, final List<AsyncClient<? extends Credentials, U>> currentClients) { if (startAuthentication(context, currentClients)) { logger.debug("Starting authentication"); return indirectAuthenticationInitiator.initiateIndirectFlow(context, currentClients); } else { logger.debug("unauthorized"); return CompletableFuture.completedFuture(unauthorized(context, currentClients)); } }  final CompletableFuture<HttpAction> authenticate(final C context, final List<AsyncClient<? extends Credentials, U>> currentClients);  }