use of org.wildfly.elytron.web.undertow.server.ElytronHttpExchange in project wildfly by wildfly.
the class HttpInvokerHostService method secureAccess.
private static HttpHandler secureAccess(HttpHandler domainHandler, final HttpAuthenticationFactory httpAuthenticationFactory) {
domainHandler = new AuthenticationCallHandler(domainHandler);
domainHandler = new AuthenticationConstraintHandler(domainHandler);
Supplier<List<HttpServerAuthenticationMechanism>> mechanismSupplier = () -> httpAuthenticationFactory.getMechanismNames().stream().map(s -> {
try {
return httpAuthenticationFactory.createMechanism(s);
} catch (Exception e) {
return null;
}
}).collect(Collectors.toList());
domainHandler = ElytronContextAssociationHandler.builder().setNext(domainHandler).setMechanismSupplier(mechanismSupplier).setHttpExchangeSupplier(h -> new ElytronHttpExchange(h) {
@Override
public void authenticationComplete(SecurityIdentity securityIdentity, String mechanismName) {
super.authenticationComplete(securityIdentity, mechanismName);
h.putAttachment(ElytronIdentityHandler.IDENTITY_KEY, securityIdentity);
}
}).build();
return domainHandler;
}
Aggregations