protected void handleAuthActions(JaxrsHttpFacade facade, KeycloakDeployment deployment) { AuthenticatedActionsHandler authActionsHandler = new AuthenticatedActionsHandler(deployment, facade); if (authActionsHandler.handledRequest()) { // Send response now (if not already sent) if (!facade.isResponseFinished()) { facade.getResponse().end(); } } }
public boolean handledRequest() { log.debugv("AuthenticatedActionsValve.invoke {0}", facade.getRequest().getURI()); if (corsRequest()) return true; String requestUri = facade.getRequest().getURI(); if (requestUri.endsWith(AdapterConstants.K_QUERY_BEARER_TOKEN)) { queryBearerToken(); return true; } if (!isAuthorized()) { return true; } return false; }
protected void queryBearerToken() { log.debugv("queryBearerToken {0}",facade.getRequest().getURI()); if (abortTokenResponse()) return; facade.getResponse().setStatus(200); facade.getResponse().setHeader("Content-Type", "text/plain"); try { facade.getResponse().getOutputStream().write(facade.getSecurityContext().getTokenString().getBytes()); } catch (IOException e) { throw new RuntimeException(e); } facade.getResponse().end(); }
private void handleAuthActions(JaxrsHttpFacade facade, KeycloakDeployment deployment) { AuthenticatedActionsHandler authActionsHandler = new AuthenticatedActionsHandler(deployment, facade); if (authActionsHandler.handledRequest()) { if (!facade.isResponseFinished()) { facade.getResponse().end(); } } } }
@Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain filterChain) throws IOException, ServletException { if (request.getAttribute(FILTER_APPLIED) != null) { filterChain.doFilter(request, response); return; } request.setAttribute(FILTER_APPLIED, Boolean.TRUE); KeycloakSecurityContext keycloakSecurityContext = getKeycloakPrincipal(); if (keycloakSecurityContext instanceof RefreshableKeycloakSecurityContext) { HttpFacade facade = new SimpleHttpFacade((HttpServletRequest) request, (HttpServletResponse) response); KeycloakDeployment deployment = resolveDeployment(request, response); AuthenticatedActionsHandler actions = new AuthenticatedActionsHandler(deployment, OIDCHttpFacade.class.cast(facade)); if (actions.handledRequest()) { return; } } filterChain.doFilter(request, response); }
@Override public void handleRequest(HttpServerExchange exchange) throws Exception { OIDCUndertowHttpFacade facade = new OIDCUndertowHttpFacade(exchange); KeycloakDeployment deployment = deploymentContext.resolveDeployment(facade); if (deployment != null && deployment.isConfigured()) { AuthenticatedActionsHandler handler = new AuthenticatedActionsHandler(deployment, facade); if (handler.handledRequest()) return; } next.handleRequest(exchange); } }
@Override public void handleRequest(HttpServerExchange exchange) throws Exception { OIDCUndertowHttpFacade facade = new OIDCUndertowHttpFacade(exchange); KeycloakDeployment deployment = deploymentContext.resolveDeployment(facade); if (deployment != null && deployment.isConfigured()) { AuthenticatedActionsHandler handler = new AuthenticatedActionsHandler(deployment, facade); if (handler.handledRequest()) return; } next.handleRequest(exchange); } }
@Override public void invoke(Request request, Response response) throws IOException, ServletException { log.debugv("AuthenticatedActionsValve.invoke {0}", request.getRequestURI()); CatalinaHttpFacade facade = new OIDCCatalinaHttpFacade(request, response); KeycloakDeployment deployment = deploymentContext.resolveDeployment(facade); if (deployment != null && deployment.isConfigured()) { AuthenticatedActionsHandler handler = new AuthenticatedActionsHandler(deployment, new OIDCCatalinaHttpFacade(request, response)); if (handler.handledRequest()) { return; } } getNext().invoke(request, response); } }
@Override public void invoke(Request request, Response response) throws IOException, ServletException { log.debugv("AuthenticatedActionsValve.invoke {0}", request.getRequestURI()); CatalinaHttpFacade facade = new OIDCCatalinaHttpFacade(request, response); KeycloakDeployment deployment = deploymentContext.resolveDeployment(facade); if (deployment != null && deployment.isConfigured()) { AuthenticatedActionsHandler handler = new AuthenticatedActionsHandler(deployment, new OIDCCatalinaHttpFacade(request, response)); if (handler.handledRequest()) { return; } } getNext().invoke(request, response); } }
return; AuthenticatedActionsHandler actions = new AuthenticatedActionsHandler(deployment, facade); if (actions.handledRequest()) { return; } else {
AuthenticatedActionsHandler authenticatedActionsHandler = new AuthenticatedActionsHandler(deployment, facade); if (authenticatedActionsHandler.handledRequest()) { return Authentication.SEND_SUCCESS;
AuthenticatedActionsHandler authenticatedActionsHandler = new AuthenticatedActionsHandler(deployment, facade); if (authenticatedActionsHandler.handledRequest()) { return Authentication.SEND_SUCCESS;
return; AuthenticatedActionsHandler actions = new AuthenticatedActionsHandler(deployment, facade); if (actions.handledRequest()) { return; } else {
AuthenticatedActionsHandler actions = new AuthenticatedActionsHandler(deployment, facade); if (actions.handledRequest()) { return;