use of org.wildfly.extension.undertow.security.jaspi.JASPICSecureResponseHandler in project wildfly by wildfly.
the class UndertowDeploymentInfoService method handleJASPIMechanism.
/**
* <p>Adds to the deployment the {@link org.wildfly.extension.undertow.security.jaspi.JASPICAuthenticationMechanism}, if necessary. The handler will be added if the security domain
* is configured with JASPI authentication.</p>
*
* @param deploymentInfo
*/
private void handleJASPIMechanism(final DeploymentInfo deploymentInfo) {
if (securityDomain == null) {
return;
}
ApplicationPolicy applicationPolicy = SecurityConfiguration.getApplicationPolicy(this.securityDomain);
if (applicationPolicy != null && JASPIAuthenticationInfo.class.isInstance(applicationPolicy.getAuthenticationInfo())) {
String authMethod = null;
LoginConfig loginConfig = deploymentInfo.getLoginConfig();
if (loginConfig != null && loginConfig.getAuthMethods().size() > 0) {
authMethod = loginConfig.getAuthMethods().get(0).getName();
}
deploymentInfo.setJaspiAuthenticationMechanism(new JASPICAuthenticationMechanism(securityDomain, authMethod));
deploymentInfo.setSecurityContextFactory(new JASPICSecurityContextFactory(this.securityDomain));
deploymentInfo.addOuterHandlerChainWrapper(next -> new JASPICSecureResponseHandler(next));
}
}
Aggregations