public void registerKeycloakDeployment(KeycloakDeployment keycloakDeployment) { nodesRegistrationManagement.tryRegister(keycloakDeployment); }
@Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { HttpFacade facade = new SimpleHttpFacade((HttpServletRequest)request, (HttpServletResponse)response); nodesRegistrationManagement.tryRegister(deploymentContext.resolveDeployment(facade)); PreAuthActionsHandler handler = preAuthActionsHandlerFactory.createPreAuthActionsHandler(facade); if (handler.handleRequest()) { log.debug("Pre-auth filter handled request: {}", ((HttpServletRequest) request).getRequestURI()); } else { chain.doFilter(request, response); } }
@Override public AuthenticationMechanismOutcome authenticate(HttpServerExchange exchange, SecurityContext securityContext) { UndertowHttpFacade facade = createFacade(exchange); KeycloakDeployment deployment = deploymentContext.resolveDeployment(facade); if (!deployment.isConfigured()) { return AuthenticationMechanismOutcome.NOT_ATTEMPTED; } nodesRegistrationManagement.tryRegister(deployment); RequestAuthenticator authenticator = createRequestAuthenticator(deployment, exchange, securityContext, facade); return keycloakAuthenticate(exchange, securityContext, authenticator); }
@Override public void filter(ContainerRequestContext containerRequestContext) throws IOException { SecurityContext securityContext = containerRequestContext.getSecurityContext(); JaxrsHttpFacade facade = new JaxrsHttpFacade(containerRequestContext, securityContext); if (handlePreauth(facade)) { return; } KeycloakDeployment resolvedDeployment = deploymentContext.resolveDeployment(facade); nodesRegistrationManagement.tryRegister(resolvedDeployment); bearerAuthentication(facade, containerRequestContext, resolvedDeployment); }
@Override public AuthenticationMechanismOutcome authenticate(HttpServerExchange exchange, SecurityContext securityContext) { UndertowHttpFacade facade = createFacade(exchange); KeycloakDeployment deployment = deploymentContext.resolveDeployment(facade); if (!deployment.isConfigured()) { return AuthenticationMechanismOutcome.NOT_ATTEMPTED; } nodesRegistrationManagement.tryRegister(deployment); RequestAuthenticator authenticator = createRequestAuthenticator(deployment, exchange, securityContext, facade); return keycloakAuthenticate(exchange, securityContext, authenticator); }
@Override public void filter(ContainerRequestContext request) throws IOException { SecurityContext securityContext = getRequestSecurityContext(request); JaxrsHttpFacade facade = new JaxrsHttpFacade(request, securityContext); if (handlePreauth(facade)) { return; } KeycloakDeployment resolvedDeployment = deploymentContext.resolveDeployment(facade); nodesRegistrationManagement.tryRegister(resolvedDeployment); bearerAuthentication(facade, request, resolvedDeployment); }
@Override public AuthenticationMechanismOutcome authenticate(HttpServerExchange exchange, SecurityContext securityContext) { UndertowHttpFacade facade = createFacade(exchange); KeycloakDeployment deployment = deploymentContext.resolveDeployment(facade); if (!deployment.isConfigured()) { return AuthenticationMechanismOutcome.NOT_ATTEMPTED; } nodesRegistrationManagement.tryRegister(deployment); AdapterTokenStore tokenStore = getTokenStore(exchange, facade, deployment, securityContext); RequestAuthenticator authenticator = new UndertowRequestAuthenticator(facade, deployment, confidentialPort, securityContext, exchange, tokenStore); return keycloakAuthenticate(exchange, securityContext, authenticator); }
@Override public AuthenticationMechanismOutcome authenticate(HttpServerExchange exchange, SecurityContext securityContext) { UndertowHttpFacade facade = createFacade(exchange); KeycloakDeployment deployment = deploymentContext.resolveDeployment(facade); if (!deployment.isConfigured()) { return AuthenticationMechanismOutcome.NOT_ATTEMPTED; } nodesRegistrationManagement.tryRegister(deployment); AdapterTokenStore tokenStore = getTokenStore(exchange, facade, deployment, securityContext); RequestAuthenticator authenticator = new UndertowRequestAuthenticator(facade, deployment, confidentialPort, securityContext, exchange, tokenStore); return keycloakAuthenticate(exchange, securityContext, authenticator); }
nodesRegistrationManagement.tryRegister(deployment); OIDCFilterSessionStore tokenStore = new OIDCFilterSessionStore(request, facade, 100000, deployment, idMapper); tokenStore.checkCurrentToken();
return new DeferredAuthentication(this); AdapterTokenStore tokenStore = getTokenStore(request, facade, deployment); nodesRegistrationManagement.tryRegister(deployment);
return new DeferredAuthentication(this); AdapterTokenStore tokenStore = getTokenStore(request, facade, deployment); nodesRegistrationManagement.tryRegister(deployment);
protected boolean authenticateInternal(Request request, HttpServletResponse response, Object loginConfig) throws IOException { CatalinaHttpFacade facade = new OIDCCatalinaHttpFacade(request, response); KeycloakDeployment deployment = deploymentContext.resolveDeployment(facade); if (deployment == null || !deployment.isConfigured()) { //needed for the EAP6/AS7 adapter relying on the tomcat core adapter facade.getResponse().sendError(401); return false; } AdapterTokenStore tokenStore = getTokenStore(request, facade, deployment); nodesRegistrationManagement.tryRegister(deployment); CatalinaRequestAuthenticator authenticator = createRequestAuthenticator(request, facade, deployment, tokenStore); AuthOutcome outcome = authenticator.authenticate(); if (outcome == AuthOutcome.AUTHENTICATED) { if (facade.isEnded()) { return false; } return true; } AuthChallenge challenge = authenticator.getChallenge(); if (challenge != null) { challenge.challenge(facade); } return false; }
protected boolean authenticateInternal(Request request, HttpServletResponse response, Object loginConfig) throws IOException { CatalinaHttpFacade facade = new OIDCCatalinaHttpFacade(request, response); KeycloakDeployment deployment = deploymentContext.resolveDeployment(facade); if (deployment == null || !deployment.isConfigured()) { //needed for the EAP6/AS7 adapter relying on the tomcat core adapter facade.getResponse().sendError(401); return false; } AdapterTokenStore tokenStore = getTokenStore(request, facade, deployment); nodesRegistrationManagement.tryRegister(deployment); CatalinaRequestAuthenticator authenticator = createRequestAuthenticator(request, facade, deployment, tokenStore); AuthOutcome outcome = authenticator.authenticate(); if (outcome == AuthOutcome.AUTHENTICATED) { if (facade.isEnded()) { return false; } return true; } AuthChallenge challenge = authenticator.getChallenge(); if (challenge != null) { challenge.challenge(facade); } return false; }