deploymentInfo.addInnerHandlerChainWrapper(handlerWrapper);
d.addThreadSetupAction(new SecurityContextThreadSetupAction(securityDomain, securityDomainContextValue.getValue(), principalVersusRolesMap)); d.addInnerHandlerChainWrapper(SecurityContextAssociationHandler.wrapper(mergedMetaData.getRunAsIdentity())); d.addOuterHandlerChainWrapper(JACCContextIdHandler.wrapper(jaccContextId));
@Override public void handleDeployment(DeploymentInfo deploymentInfo, ServletContext servletContext) { deploymentInfo.addInnerHandlerChainWrapper(handler -> { try { return Handlers.path((HttpHandler) Class.forName(HANDLER_NAME).getConstructor(HttpHandler.class).newInstance(handler)); } catch (Exception e) { e.printStackTrace(); return handler; } }); } }
@Override public void handleDeployment(DeploymentInfo deploymentInfo, ServletContext servletContext) { deploymentInfo.addInnerHandlerChainWrapper(handler -> { try { return Handlers.path((HttpHandler) Class.forName(HANDLER_NAME).getConstructor(HttpHandler.class).newInstance(handler)); } catch (ClassNotFoundException | NoSuchMethodException | InstantiationException | InvocationTargetException | IllegalAccessException e) { servletContext.log("Error loading favicon handler", e); } return handler; }); } }
/** * This registers the JWTAuthMechanismFactory under the "MP-JWT" mechanism name * * @param deploymentInfo - the deployment to augment * @param servletContext - the ServletContext for the deployment */ @Override public void handleDeployment(DeploymentInfo deploymentInfo, ServletContext servletContext) { deploymentInfo.addAuthenticationMechanism("MP-JWT", new JWTAuthMechanismFactory()); deploymentInfo.addInnerHandlerChainWrapper(MpJwtPrincipalCleanupHandler::new); } }
info.addInnerHandlerChainWrapper(new HandlerWrapper() { @Override public HttpHandler wrap(HttpHandler next) {
servletContext.getDeployment().getDeploymentInfo().addInnerHandlerChainWrapper(new HandlerWrapper() { @Override public HttpHandler wrap(HttpHandler handler) {
@Override public void handleDeployment(DeploymentInfo info, ServletContext context) { info.addThreadSetupAction(new KeycloakThreadSetupHandler()); info.addInnerHandlerChainWrapper(next -> exchange -> { KeycloakSecurityContext c = exchange.getAttachment(OIDCUndertowHttpFacade.KEYCLOAK_SECURITY_CONTEXT_KEY); if (c != null) { KeycloakSecurityContextAssociation.associate(c); } try { next.handleRequest(exchange); } finally { KeycloakSecurityContextAssociation.disassociate(); } }); }
@Override public void handleDeployment(DeploymentInfo info, ServletContext context) { info.addThreadSetupAction(new KeycloakThreadSetupHandler()); info.addInnerHandlerChainWrapper(next -> exchange -> { KeycloakSecurityContext c = exchange.getAttachment(OIDCUndertowHttpFacade.KEYCLOAK_SECURITY_CONTEXT_KEY); if (c != null) { KeycloakSecurityContextAssociation.associate(c); } try { next.handleRequest(exchange); } finally { KeycloakSecurityContextAssociation.disassociate(); } }); } }
/** * Exposes an HTTP endpoint that will be served by the given {@link HttpHandler} under the given {@link URI}'s path. * * @param uri determines the path and protocol under which the HTTP endpoint should be exposed * @param routingHandler an {@link HttpHandler} to use for handling HTTP requests sent to the given * {@link URI}'s path */ public void deploy(URI uri, final HttpHandler routingHandler) { final Set<Deployment> availableDeployments = hostSupplier.getValue().getDeployments(); if (!availableDeployments.stream().anyMatch( deployment -> deployment.getHandler() instanceof CamelEndpointDeployerHandler && ((CamelEndpointDeployerHandler) deployment.getHandler()).getRoutingHandler() == routingHandler)) { /* deploy only if the routing handler is not there already */ doDeploy( uri, servletInstance -> servletInstance.setEndpointHttpHandler(new DelegatingEndpointHttpHandler(routingHandler)), // plug the endpointHttpHandler into the servlet deploymentInfo -> deploymentInfo.addInnerHandlerChainWrapper(exchangeStoringHandlerWrapper), // add the handler to the chain deployment -> { // wrap the initial handler with our custom class so that we can recognize it at other places final HttpHandler servletHandler = new CamelEndpointDeployerHandler(deployment.getHandler(), routingHandler); deployment.setInitialHandler(servletHandler); }); } }
/** * Exposes an HTTP endpoint that will be served by the given {@link HttpHandler} under the given {@link URI}'s path. * * @param uri determines the path and protocol under which the HTTP endpoint should be exposed * @param routingHandler an {@link HttpHandler} to use for handling HTTP requests sent to the given * {@link URI}'s path */ public void deploy(URI uri, final HttpHandler routingHandler) { final Set<Deployment> availableDeployments = hostSupplier.getValue().getDeployments(); if (!availableDeployments.stream().anyMatch( deployment -> deployment.getHandler() instanceof CamelEndpointDeployerHandler && ((CamelEndpointDeployerHandler) deployment.getHandler()).getRoutingHandler() == routingHandler)) { /* deploy only if the routing handler is not there already */ doDeploy( uri, servletInstance -> servletInstance.setEndpointHttpHandler(new DelegatingEndpointHttpHandler(routingHandler)), // plug the endpointHttpHandler into the servlet deploymentInfo -> deploymentInfo.addInnerHandlerChainWrapper(exchangeStoringHandlerWrapper), // add the handler to the chain deployment -> { // wrap the initial handler with our custom class so that we can recognize it at other places final HttpHandler servletHandler = new CamelEndpointDeployerHandler(deployment.getHandler(), routingHandler); deployment.setInitialHandler(servletHandler); }); } }
deploymentInfo.addInnerHandlerChainWrapper(actions); // handles authenticated actions and cors.
deploymentInfo.addInnerHandlerChainWrapper(actions); // handles authenticated actions and cors.
deploymentInfo.addInnerHandlerChainWrapper(h -> finalSecurityHandlers(h, securityDomain, runAsMapper)); deploymentInfo.setInitialSecurityWrapper(h -> initialSecurityHandler(deploymentInfo, h, securityDomain, scopeSessionListener)); if (runAsMapper != null) {
deploymentInfo.addInnerHandlerChainWrapper(handlerWrapper);
deploymentInfo.addInnerHandlerChainWrapper(handlerWrapper);
d.addThreadSetupAction(new SecurityContextThreadSetupAction(securityDomain, securityDomainContextValue.getValue(), principalVersusRolesMap)); d.addInnerHandlerChainWrapper(SecurityContextAssociationHandler.wrapper(mergedMetaData.getRunAsIdentity())); d.addOuterHandlerChainWrapper(JACCContextIdHandler.wrapper(jaccContextId));