}
}
}
private void parseGlobalAuthorization(XMLExtendedStreamReader reader, ConfigurationBuilderHolder holder) throws XMLStreamException {
GlobalAuthorizationConfigurationBuilder builder = holder.getGlobalConfigurationBuilder().security().authorization().enable();
for (int i = 0; i < reader.getAttributeCount(); i++) {
String value = replaceProperties(reader.getAttributeValue(i));
Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i));
switch (attribute) {
case AUDIT_LOGGER: {
builder.auditLogger(Util.<AuditLogger>getInstance(value, holder.getClassLoader()));
break;
}
default: {
throw ParseUtils.unexpectedAttribute(reader, i);
}
}
}
PrincipalRoleMapper roleMapper = null;
while (reader.hasNext() && (reader.nextTag() != XMLStreamConstants.END_ELEMENT)) {
Element element = Element.forName(reader.getLocalName());
switch (element) {
case IDENTITY_ROLE_MAPPER:
if (roleMapper != null) {
throw ParseUtils.unexpectedElement(reader);
}
ParseUtils.requireNoAttributes(reader);
ParseUtils.requireNoContent(reader);
roleMapper = new IdentityRoleMapper();
break;
case COMMON_NAME_ROLE_MAPPER:
if (roleMapper != null) {
throw ParseUtils.unexpectedElement(reader);
}
ParseUtils.requireNoAttributes(reader);
ParseUtils.requireNoContent(reader);
roleMapper = new CommonNameRoleMapper();
break;
case CLUSTER_ROLE_MAPPER:
if (roleMapper != null) {
throw ParseUtils.unexpectedElement(reader);
}
ParseUtils.requireNoAttributes(reader);
ParseUtils.requireNoContent(reader);
roleMapper = new ClusterRoleMapper();
break;
case CUSTOM_ROLE_MAPPER:
if (roleMapper != null) {
throw ParseUtils.unexpectedElement(reader);
}
roleMapper = parseCustomMapper(reader, holder);
break;
case ROLE: {
parseGlobalRole(reader, builder);
break;
}
default: {
throw ParseUtils.unexpectedElement(reader);
}
}
}
if (roleMapper != null) {
builder.principalRoleMapper(roleMapper);
}
}