use of org.infinispan.server.security.ElytronRESPAuthenticator in project infinispan by infinispan.
the class EndpointConfigurationBuilder method enableImplicitAuthentication.
private void enableImplicitAuthentication(SecurityConfiguration security, String securityRealmName, RespServerConfigurationBuilder builder) {
// Set the security realm only if it has not been set already
org.infinispan.server.resp.configuration.AuthenticationConfigurationBuilder authentication = builder.authentication();
if (!authentication.hasSecurityRealm()) {
authentication.securityRealm(securityRealmName);
}
ServerSecurityRealm securityRealm = security.realms().getRealm(authentication.securityRealm()).serverSecurityRealm();
if (securityRealm.hasFeature(ServerSecurityRealm.Feature.PASSWORD)) {
authentication.authenticator(new ElytronRESPAuthenticator(authentication.securityRealm()));
} else {
throw Server.log.respEndpointRequiresRealmWithPassword();
}
}
use of org.infinispan.server.security.ElytronRESPAuthenticator in project infinispan by infinispan.
the class RespServerConfigurationParser method parseAuthentication.
private void parseAuthentication(ConfigurationReader reader, ServerConfigurationBuilder serverBuilder, AuthenticationConfigurationBuilder builder, String securityRealmName) {
if (securityRealmName == null) {
securityRealmName = serverBuilder.endpoints().current().securityRealm();
}
for (int i = 0; i < reader.getAttributeCount(); i++) {
ParseUtils.requireNoNamespaceAttribute(reader, i);
String value = reader.getAttributeValue(i);
Attribute attribute = Attribute.forName(reader.getAttributeName(i));
switch(attribute) {
case SECURITY_REALM:
{
builder.securityRealm(value);
securityRealmName = value;
break;
}
default:
{
throw ParseUtils.unexpectedAttribute(reader, i);
}
}
}
ParseUtils.requireNoContent(reader);
if (securityRealmName == null) {
throw Server.log.authenticationWithoutSecurityRealm();
}
builder.authenticator(new ElytronRESPAuthenticator(securityRealmName));
}
Aggregations