use of javax.security.auth.message.config.ClientAuthConfig in project Payara by payara.
the class PipeHelper method getClientAuthContext.
@Override
public ClientAuthContext getClientAuthContext(MessageInfo info, Subject subject) throws AuthException {
ClientAuthConfig clientConfig = (ClientAuthConfig) getAuthConfig(false);
if (clientConfig == null) {
return null;
}
addModel(info, map);
return clientConfig.getAuthContext(clientConfig.getAuthContextID(info), subject, map);
}
use of javax.security.auth.message.config.ClientAuthConfig in project Payara by payara.
the class PipeHelper method getSessionToken.
public void getSessionToken(Map m, MessageInfo info, Subject s) throws AuthException {
ClientAuthConfig c = (ClientAuthConfig) getAuthConfig(false);
if (c != null) {
m.putAll(map);
addModel(info, map);
c.getAuthContext(c.getAuthContextID(info), s, m);
}
}
use of javax.security.auth.message.config.ClientAuthConfig in project Payara by payara.
the class PipeHelper method getSessionToken.
public void getSessionToken(Map<String, Object> map, MessageInfo info, Subject subject) throws AuthException {
ClientAuthConfig clientAuthConfig = (ClientAuthConfig) getAuthConfig(false);
if (clientAuthConfig != null) {
map.putAll(map);
addModel(info, map);
clientAuthConfig.getAuthContext(clientAuthConfig.getAuthContextID(info), subject, map);
}
}
use of javax.security.auth.message.config.ClientAuthConfig in project jbossws-cxf by jbossws.
the class DefaultJASPIAuthenticationProvider method enableClientAuthentication.
public boolean enableClientAuthentication(Object target, Map<String, String> properties) {
if (!(target instanceof Client)) {
Loggers.ROOT_LOGGER.cannotEnableJASPIAuthentication(target.getClass().getSimpleName());
return false;
}
Client client = (Client) target;
String securityDomain = properties.get(JaspiClientAuthenticator.JASPI_SECURITY_DOMAIN);
if (securityDomain == null) {
return false;
}
ApplicationPolicy appPolicy = SecurityConfiguration.getApplicationPolicy(securityDomain);
if (appPolicy == null) {
Loggers.ROOT_LOGGER.noApplicationPolicy(securityDomain);
return false;
}
BaseAuthenticationInfo bai = appPolicy.getAuthenticationInfo();
if (bai == null || bai instanceof AuthenticationInfo) {
Loggers.ROOT_LOGGER.noJaspiApplicationPolicy(securityDomain);
return false;
}
JASPIAuthenticationInfo jai = (JASPIAuthenticationInfo) bai;
String contextRoot = client.getEndpoint().getEndpointInfo().getName().toString();
String appId = "localhost " + contextRoot;
AuthConfigFactory factory = AuthConfigFactory.getFactory();
Properties props = new Properties();
AuthConfigProvider provider = new JBossWSAuthConfigProvider(props, factory);
provider = factory.getConfigProvider(JBossWSAuthConstants.SOAP_LAYER, appId, null);
JBossCallbackHandler callbackHandler = new JBossCallbackHandler();
try {
ClientAuthConfig clientConfig = provider.getClientAuthConfig("soap", appId, callbackHandler);
JaspiClientAuthenticator clientAuthenticator = new JaspiClientAuthenticator(clientConfig, securityDomain, jai);
client.getInInterceptors().add(new JaspiClientInInterceptor(clientAuthenticator));
client.getOutInterceptors().add(new JaspiClientOutInterceptor(clientAuthenticator));
} catch (Exception e) {
Loggers.DEPLOYMENT_LOGGER.cannotCreateServerAuthContext(securityDomain, e);
}
return false;
}
Aggregations