Java Code Examples for org.jboss.as.controller.SimpleAttributeDefinition#parseAndSetParameter()
The following examples show how to use
org.jboss.as.controller.SimpleAttributeDefinition#parseAndSetParameter() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: KeycloakSubsystemParser.java From keycloak with Apache License 2.0 | 6 votes |
void readCertificate(XMLExtendedStreamReader reader, ModelNode addKeyStore) throws XMLStreamException { for (int i = 0; i < reader.getAttributeCount(); i++) { String name = reader.getAttributeLocalName(i); String value = reader.getAttributeValue(i); SimpleAttributeDefinition attr = KeyStoreCertificateDefinition.lookup(name); if (attr == null) { throw ParseUtils.unexpectedAttribute(reader, i); } attr.parseAndSetParameter(value, addKeyStore, reader); } if (!addKeyStore.hasDefined(Constants.Model.CERTIFICATE_ALIAS)) { throw ParseUtils.missingRequired(reader, asSet(Constants.XML.CERTIFICATE_ALIAS)); } ParseUtils.requireNoContent(reader); }
Example 2
Source File: KeycloakSubsystemParser.java From keycloak with Apache License 2.0 | 6 votes |
private void readRealm(XMLExtendedStreamReader reader, List<ModelNode> list) throws XMLStreamException { String realmName = readNameAttribute(reader); ModelNode addRealm = new ModelNode(); addRealm.get(ModelDescriptionConstants.OP).set(ModelDescriptionConstants.ADD); PathAddress addr = PathAddress.pathAddress(PathElement.pathElement(ModelDescriptionConstants.SUBSYSTEM, KeycloakExtension.SUBSYSTEM_NAME), PathElement.pathElement(RealmDefinition.TAG_NAME, realmName)); addRealm.get(ModelDescriptionConstants.OP_ADDR).set(addr.toModelNode()); while (reader.hasNext() && nextTag(reader) != END_ELEMENT) { String tagName = reader.getLocalName(); SimpleAttributeDefinition def = RealmDefinition.lookup(tagName); if (def == null) throw new XMLStreamException("Unknown realm tag " + tagName); def.parseAndSetParameter(reader.getElementText(), addRealm, reader); } if (!SharedAttributeDefinitons.validateTruststoreSetIfRequired(addRealm)) { //TODO: externalize the message throw new XMLStreamException("truststore and truststore-password must be set if ssl-required is not none and disable-trust-manager is false."); } list.add(addRealm); }
Example 3
Source File: KeycloakSubsystemParser.java From keycloak with Apache License 2.0 | 6 votes |
private void readTheme(final List<ModelNode> list, final XMLExtendedStreamReader reader) throws XMLStreamException { ModelNode addThemeDefaults = new ModelNode(); addThemeDefaults.get(ModelDescriptionConstants.OP).set(ModelDescriptionConstants.ADD); PathAddress addr = PathAddress.pathAddress(PathElement.pathElement(ModelDescriptionConstants.SUBSYSTEM, KeycloakExtension.SUBSYSTEM_NAME), PathElement.pathElement(ThemeResourceDefinition.TAG_NAME, ThemeResourceDefinition.RESOURCE_NAME)); addThemeDefaults.get(ModelDescriptionConstants.OP_ADDR).set(addr.toModelNode()); list.add(addThemeDefaults); while (reader.hasNext() && nextTag(reader) != END_ELEMENT) { String tagName = reader.getLocalName(); if (MODULES.getName().equals(tagName)) { readModules(reader, addThemeDefaults); continue; } SimpleAttributeDefinition def = KeycloakExtension.THEME_DEFINITION.lookup(tagName); if (def == null) throw new XMLStreamException("Unknown theme tag " + tagName); def.parseAndSetParameter(reader.getElementText(), addThemeDefaults, reader); } }
Example 4
Source File: KeycloakSubsystemParser.java From keycloak with Apache License 2.0 | 6 votes |
void readPrivateKey(XMLExtendedStreamReader reader, ModelNode addKeyStore) throws XMLStreamException { for (int i = 0; i < reader.getAttributeCount(); i++) { String name = reader.getAttributeLocalName(i); String value = reader.getAttributeValue(i); SimpleAttributeDefinition attr = KeyStorePrivateKeyDefinition.lookup(name); if (attr == null) { throw ParseUtils.unexpectedAttribute(reader, i); } attr.parseAndSetParameter(value, addKeyStore, reader); } if (!addKeyStore.hasDefined(Constants.Model.PRIVATE_KEY_ALIAS)) { throw ParseUtils.missingRequired(reader, Constants.XML.PRIVATE_KEY_ALIAS); } if (!addKeyStore.hasDefined(Constants.Model.PRIVATE_KEY_PASSWORD)) { throw ParseUtils.missingRequired(reader, Constants.XML.PRIVATE_KEY_PASSWORD); } ParseUtils.requireNoContent(reader); }
Example 5
Source File: KeycloakSubsystemParser.java From keycloak with Apache License 2.0 | 6 votes |
void readCertificate(XMLExtendedStreamReader reader, ModelNode addKeyStore) throws XMLStreamException { for (int i = 0; i < reader.getAttributeCount(); i++) { String name = reader.getAttributeLocalName(i); String value = reader.getAttributeValue(i); SimpleAttributeDefinition attr = KeyStoreCertificateDefinition.lookup(name); if (attr == null) { throw ParseUtils.unexpectedAttribute(reader, i); } attr.parseAndSetParameter(value, addKeyStore, reader); } if (!addKeyStore.hasDefined(Constants.Model.CERTIFICATE_ALIAS)) { throw ParseUtils.missingRequired(reader, Constants.XML.CERTIFICATE_ALIAS); } ParseUtils.requireNoContent(reader); }
Example 6
Source File: KeycloakSubsystemParser.java From keycloak with Apache License 2.0 | 5 votes |
void readSingleLogout(ModelNode addIdentityProvider, XMLExtendedStreamReader reader) throws XMLStreamException { ModelNode slo = addIdentityProvider.get(Constants.Model.SINGLE_LOGOUT); for (int i = 0; i < reader.getAttributeCount(); i++) { String name = reader.getAttributeLocalName(i); String value = reader.getAttributeValue(i); SimpleAttributeDefinition attr = SingleLogoutDefinition.lookup(name); if (attr == null) { throw ParseUtils.unexpectedAttribute(reader, i); } attr.parseAndSetParameter(value, slo, reader); } ParseUtils.requireNoContent(reader); }
Example 7
Source File: KeycloakSubsystemParser.java From keycloak with Apache License 2.0 | 5 votes |
void readKeyStore(ModelNode addKey, XMLExtendedStreamReader reader) throws XMLStreamException { ModelNode addKeyStore = addKey.get(Constants.Model.KEY_STORE); for (int i = 0; i < reader.getAttributeCount(); i++) { String name = reader.getAttributeLocalName(i); String value = reader.getAttributeValue(i); SimpleAttributeDefinition attr = KeyStoreDefinition.lookup(name); if (attr == null) { throw ParseUtils.unexpectedAttribute(reader, i); } attr.parseAndSetParameter(value, addKeyStore, reader); } if (!addKeyStore.hasDefined(Constants.Model.FILE) && !addKeyStore.hasDefined(Constants.Model.RESOURCE)) { throw new XMLStreamException("KeyStore element must have 'file' or 'resource' attribute set", reader.getLocation()); } if (!addKeyStore.hasDefined(Constants.Model.PASSWORD)) { throw ParseUtils.missingRequired(reader, Constants.XML.PASSWORD); } Set<String> parsedElements = new HashSet<>(); while (reader.hasNext() && nextTag(reader) != END_ELEMENT) { String tagName = reader.getLocalName(); if (parsedElements.contains(tagName)) { // all sub-elements of the keystore type should occur only once. throw ParseUtils.unexpectedElement(reader); } if (Constants.XML.PRIVATE_KEY.equals(tagName)) { readPrivateKey(reader, addKeyStore); } else if (Constants.XML.CERTIFICATE.equals(tagName)) { readCertificate(reader, addKeyStore); } else { throw ParseUtils.unexpectedElement(reader); } parsedElements.add(tagName); } }
Example 8
Source File: KeycloakSubsystemParser.java From keycloak with Apache License 2.0 | 5 votes |
void readKeyStore(ModelNode addKey, XMLExtendedStreamReader reader) throws XMLStreamException { ModelNode addKeyStore = addKey.get(Constants.Model.KEY_STORE); for (int i = 0; i < reader.getAttributeCount(); i++) { String name = reader.getAttributeLocalName(i); String value = reader.getAttributeValue(i); SimpleAttributeDefinition attr = KeyStoreDefinition.lookup(name); if (attr == null) { throw ParseUtils.unexpectedAttribute(reader, i); } attr.parseAndSetParameter(value, addKeyStore, reader); } if (!addKeyStore.hasDefined(Constants.Model.FILE) && !addKeyStore.hasDefined(Constants.Model.RESOURCE)) { throw new XMLStreamException("KeyStore element must have 'file' or 'resource' attribute set", reader.getLocation()); } if (!addKeyStore.hasDefined(Constants.Model.PASSWORD)) { throw ParseUtils.missingRequired(reader, asSet(Constants.XML.PASSWORD)); } Set<String> parsedElements = new HashSet<>(); while (reader.hasNext() && nextTag(reader) != END_ELEMENT) { String tagName = reader.getLocalName(); if (parsedElements.contains(tagName)) { // all sub-elements of the keystore type should occur only once. throw ParseUtils.unexpectedElement(reader); } if (Constants.XML.PRIVATE_KEY.equals(tagName)) { readPrivateKey(reader, addKeyStore); } else if (Constants.XML.CERTIFICATE.equals(tagName)) { readCertificate(reader, addKeyStore); } else { throw ParseUtils.unexpectedElement(reader); } parsedElements.add(tagName); } }
Example 9
Source File: KeycloakSubsystemParser.java From keycloak with Apache License 2.0 | 5 votes |
void readKey(List<ModelNode> list, XMLExtendedStreamReader reader, PathAddress parentAddr) throws XMLStreamException { PathAddress addr = PathAddress.pathAddress(parentAddr, PathElement.pathElement(Constants.Model.KEY, "key-" + list.size())); ModelNode addKey = Util.createAddOperation(addr); list.add(addKey); for (int i = 0; i < reader.getAttributeCount(); i++) { String name = reader.getAttributeLocalName(i); String value = reader.getAttributeValue(i); SimpleAttributeDefinition attr = KeyDefinition.lookup(name); if (attr == null) { throw ParseUtils.unexpectedAttribute(reader, i); } attr.parseAndSetParameter(value, addKey, reader); } Set<String> parsedElements = new HashSet<>(); while (reader.hasNext() && nextTag(reader) != END_ELEMENT) { String tagName = reader.getLocalName(); if (parsedElements.contains(tagName)) { // all sub-elements of the key type should occur only once. throw ParseUtils.unexpectedElement(reader); } if (Constants.XML.KEY_STORE.equals(tagName)) { readKeyStore(addKey, reader); } else if (Constants.XML.PRIVATE_KEY_PEM.equals(tagName) || Constants.XML.PUBLIC_KEY_PEM.equals(tagName) || Constants.XML.CERTIFICATE_PEM.equals(tagName)) { readNoAttrElementContent(KeyDefinition.lookupElement(tagName), addKey, reader); } else { throw ParseUtils.unexpectedElement(reader); } parsedElements.add(tagName); } }
Example 10
Source File: KeycloakSubsystemParser.java From keycloak with Apache License 2.0 | 5 votes |
void readKey(List<ModelNode> list, XMLExtendedStreamReader reader, PathAddress parentAddr) throws XMLStreamException { PathAddress addr = PathAddress.pathAddress(parentAddr, PathElement.pathElement(Constants.Model.KEY, "key-" + list.size())); ModelNode addKey = Util.createAddOperation(addr); list.add(addKey); for (int i = 0; i < reader.getAttributeCount(); i++) { String name = reader.getAttributeLocalName(i); String value = reader.getAttributeValue(i); SimpleAttributeDefinition attr = KeyDefinition.lookup(name); if (attr == null) { throw ParseUtils.unexpectedAttribute(reader, i); } attr.parseAndSetParameter(value, addKey, reader); } Set<String> parsedElements = new HashSet<>(); while (reader.hasNext() && nextTag(reader) != END_ELEMENT) { String tagName = reader.getLocalName(); if (parsedElements.contains(tagName)) { // all sub-elements of the key type should occur only once. throw ParseUtils.unexpectedElement(reader); } if (Constants.XML.KEY_STORE.equals(tagName)) { readKeyStore(addKey, reader); } else if (Constants.XML.PRIVATE_KEY_PEM.equals(tagName) || Constants.XML.PUBLIC_KEY_PEM.equals(tagName) || Constants.XML.CERTIFICATE_PEM.equals(tagName)) { readNoAttrElementContent(KeyDefinition.lookupElement(tagName), addKey, reader); } else { throw ParseUtils.unexpectedElement(reader); } parsedElements.add(tagName); } }
Example 11
Source File: KeycloakSubsystemParser.java From keycloak with Apache License 2.0 | 5 votes |
void readHttpClient(final ModelNode addIdentityProvider, final XMLExtendedStreamReader reader) throws XMLStreamException { ModelNode httpClientNode = addIdentityProvider.get(Constants.Model.HTTP_CLIENT); for (int i = 0; i < reader.getAttributeCount(); i++) { String name = reader.getAttributeLocalName(i); String value = reader.getAttributeValue(i); SimpleAttributeDefinition attr = HttpClientDefinition.lookup(name); if (attr == null) { throw ParseUtils.unexpectedAttribute(reader, i); } attr.parseAndSetParameter(value, httpClientNode, reader); } ParseUtils.requireNoContent(reader); }
Example 12
Source File: KeycloakSubsystemParser.java From keycloak with Apache License 2.0 | 5 votes |
private void readDeployment(XMLExtendedStreamReader reader, List<ModelNode> resourcesToAdd) throws XMLStreamException { String name = readNameAttribute(reader); ModelNode addSecureDeployment = new ModelNode(); addSecureDeployment.get(ModelDescriptionConstants.OP).set(ModelDescriptionConstants.ADD); PathAddress addr = PathAddress.pathAddress(PathElement.pathElement(ModelDescriptionConstants.SUBSYSTEM, KeycloakExtension.SUBSYSTEM_NAME), PathElement.pathElement(SecureDeploymentDefinition.TAG_NAME, name)); addSecureDeployment.get(ModelDescriptionConstants.OP_ADDR).set(addr.toModelNode()); List<ModelNode> credentialsToAdd = new ArrayList<>(); while (reader.hasNext() && nextTag(reader) != END_ELEMENT) { String tagName = reader.getLocalName(); if (tagName.equals(CredentialDefinition.TAG_NAME)) { readCredential(reader, addr, credentialsToAdd); continue; } SimpleAttributeDefinition def = SecureDeploymentDefinition.lookup(tagName); if (def == null) throw new XMLStreamException("Unknown secure-deployment tag " + tagName); def.parseAndSetParameter(reader.getElementText(), addSecureDeployment, reader); } /** * TODO need to check realm-ref first. if (!SharedAttributeDefinitons.validateTruststoreSetIfRequired(addSecureDeployment)) { //TODO: externalize the message throw new XMLStreamException("truststore and truststore-password must be set if ssl-required is not none and disable-trust-manager is false."); } */ // Must add credentials after the deployment is added. resourcesToAdd.add(addSecureDeployment); resourcesToAdd.addAll(credentialsToAdd); }
Example 13
Source File: KeycloakSubsystemParser.java From keycloak with Apache License 2.0 | 4 votes |
void readIdentityProvider(List<ModelNode> list, XMLExtendedStreamReader reader, PathAddress parentAddr) throws XMLStreamException { String entityId = readRequiredAttribute(reader, Constants.XML.ENTITY_ID); PathAddress addr = PathAddress.pathAddress(parentAddr, PathElement.pathElement(Constants.Model.IDENTITY_PROVIDER, entityId)); ModelNode addIdentityProvider = Util.createAddOperation(addr); list.add(addIdentityProvider); for (int i = 0; i < reader.getAttributeCount(); i++) { String name = reader.getAttributeLocalName(i); String value = reader.getAttributeValue(i); if (Constants.XML.ENTITY_ID.equals(name) // don't break if encountering this noop attr from client-adapter/core keycloak_saml_adapter_1_6.xsd || "encryption".equals(name)) { continue; } SimpleAttributeDefinition attr = IdentityProviderDefinition.lookup(name); if (attr == null) { throw ParseUtils.unexpectedAttribute(reader, i); } attr.parseAndSetParameter(value, addIdentityProvider, reader); } Set<String> parsedElements = new HashSet<>(); while (reader.hasNext() && nextTag(reader) != END_ELEMENT) { String tagName = reader.getLocalName(); if (parsedElements.contains(tagName)) { // all sub-elements of the identity provider type should occur only once. throw ParseUtils.unexpectedElement(reader); } if (Constants.XML.SINGLE_SIGN_ON.equals(tagName)) { readSingleSignOn(addIdentityProvider, reader); } else if (Constants.XML.SINGLE_LOGOUT.equals(tagName)) { readSingleLogout(addIdentityProvider, reader); } else if (Constants.XML.KEYS.equals(tagName)) { readKeys(list, reader, addr); } else if (Constants.XML.HTTP_CLIENT.equals(tagName)) { readHttpClient(addIdentityProvider, reader); } else if (Constants.XML.ALLOWED_CLOCK_SKEW.equals(tagName)) { readAllowedClockSkew(addIdentityProvider, reader); } else { throw ParseUtils.unexpectedElement(reader); } parsedElements.add(tagName); } }
Example 14
Source File: KeycloakSubsystemParser.java From keycloak with Apache License 2.0 | 4 votes |
void readServiceProvider(XMLExtendedStreamReader reader, List<ModelNode> list, PathAddress parentAddr) throws XMLStreamException { String entityId = readRequiredAttribute(reader, Constants.XML.ENTITY_ID); PathAddress addr = PathAddress.pathAddress(parentAddr, PathElement.pathElement(Constants.Model.SERVICE_PROVIDER, entityId)); ModelNode addServiceProvider = Util.createAddOperation(addr); list.add(addServiceProvider); for (int i = 0; i < reader.getAttributeCount(); i++) { String name = reader.getAttributeLocalName(i); if (Constants.XML.ENTITY_ID.equals(name)) { continue; } String value = reader.getAttributeValue(i); SimpleAttributeDefinition attr = ServiceProviderDefinition.lookup(name); if (attr == null) { throw ParseUtils.unexpectedAttribute(reader, i); } attr.parseAndSetParameter(value, addServiceProvider, reader); } Set parsedElements = new HashSet<>(); while (reader.hasNext() && nextTag(reader) != END_ELEMENT) { String tagName = reader.getLocalName(); if (parsedElements.contains(tagName)) { // all sub-elements of the service provider type should occur only once. throw ParseUtils.unexpectedElement(reader); } if (Constants.XML.KEYS.equals(tagName)) { readKeys(list, reader, addr); } else if (Constants.XML.PRINCIPAL_NAME_MAPPING.equals(tagName)) { readPrincipalNameMapping(addServiceProvider, reader); } else if (Constants.XML.ROLE_IDENTIFIERS.equals(tagName)) { readRoleIdentifiers(addServiceProvider, reader); } else if (Constants.XML.ROLE_MAPPINGS_PROVIDER.equals(tagName)) { readRoleMappingsProvider(addServiceProvider, reader); } else if (Constants.XML.IDENTITY_PROVIDER.equals(tagName)) { readIdentityProvider(list, reader, addr); } else { throw ParseUtils.unexpectedElement(reader); } parsedElements.add(tagName); } }
Example 15
Source File: KeycloakSubsystemParser.java From keycloak with Apache License 2.0 | 4 votes |
void readNoAttrElementContent(SimpleAttributeDefinition attr, ModelNode model, XMLExtendedStreamReader reader) throws XMLStreamException { ParseUtils.requireNoAttributes(reader); String value = reader.getElementText(); attr.parseAndSetParameter(value, model, reader); }
Example 16
Source File: KeycloakSubsystemParser.java From keycloak with Apache License 2.0 | 4 votes |
void readNoAttrElementContent(SimpleAttributeDefinition attr, ModelNode model, XMLExtendedStreamReader reader) throws XMLStreamException { ParseUtils.requireNoAttributes(reader); String value = reader.getElementText(); attr.parseAndSetParameter(value, model, reader); }
Example 17
Source File: SocketBindingsXml.java From wildfly-core with GNU Lesser General Public License v2.1 | 4 votes |
void parseSocketBindingGroupRef(final XMLExtendedStreamReader reader, final ModelNode addOperation, final SimpleAttributeDefinition socketBindingGroup, final SimpleAttributeDefinition portOffset, final SimpleAttributeDefinition defaultInterface) throws XMLStreamException { // Handle attributes boolean gotRef = false; final int count = reader.getAttributeCount(); for (int i = 0; i < count; i++) { final String value = reader.getAttributeValue(i); if (!isNoNamespaceAttribute(reader, i)) { throw ParseUtils.unexpectedAttribute(reader, i); } else { final Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i)); switch (attribute) { case REF: { socketBindingGroup.parseAndSetParameter(value, addOperation, reader); gotRef = true; break; } case PORT_OFFSET: { portOffset.parseAndSetParameter(value, addOperation, reader); break; } case DEFAULT_INTERFACE: { if (defaultInterface == null) { throw unexpectedAttribute(reader, i); } defaultInterface.parseAndSetParameter(value, addOperation, reader); break; } default: throw unexpectedAttribute(reader, i); } } } if (!gotRef) { throw missingRequired(reader, Collections.singleton(Attribute.REF)); } // Handle elements requireNoContent(reader); }
Example 18
Source File: KeycloakSubsystemParser.java From keycloak with Apache License 2.0 | 4 votes |
void readServiceProvider(XMLExtendedStreamReader reader, List<ModelNode> list, PathAddress parentAddr) throws XMLStreamException { String entityId = readRequiredAttribute(reader, Constants.XML.ENTITY_ID); PathAddress addr = PathAddress.pathAddress(parentAddr, PathElement.pathElement(Constants.Model.SERVICE_PROVIDER, entityId)); ModelNode addServiceProvider = Util.createAddOperation(addr); list.add(addServiceProvider); for (int i = 0; i < reader.getAttributeCount(); i++) { String name = reader.getAttributeLocalName(i); if (Constants.XML.ENTITY_ID.equals(name)) { continue; } String value = reader.getAttributeValue(i); SimpleAttributeDefinition attr = ServiceProviderDefinition.lookup(name); if (attr == null) { throw ParseUtils.unexpectedAttribute(reader, i); } attr.parseAndSetParameter(value, addServiceProvider, reader); } Set<String> parsedElements = new HashSet<>(); while (reader.hasNext() && nextTag(reader) != END_ELEMENT) { String tagName = reader.getLocalName(); if (parsedElements.contains(tagName)) { // all sub-elements of the service provider type should occur only once. throw ParseUtils.unexpectedElement(reader); } if (Constants.XML.KEYS.equals(tagName)) { readKeys(list, reader, addr); } else if (Constants.XML.PRINCIPAL_NAME_MAPPING.equals(tagName)) { readPrincipalNameMapping(addServiceProvider, reader); } else if (Constants.XML.ROLE_IDENTIFIERS.equals(tagName)) { readRoleIdentifiers(addServiceProvider, reader); } else if (Constants.XML.ROLE_MAPPINGS_PROVIDER.equals(tagName)) { readRoleMappingsProvider(addServiceProvider, reader); } else if (Constants.XML.IDENTITY_PROVIDER.equals(tagName)) { readIdentityProvider(list, reader, addr); } else { throw ParseUtils.unexpectedElement(reader); } parsedElements.add(tagName); } }
Example 19
Source File: KeycloakSubsystemParser.java From keycloak with Apache License 2.0 | 4 votes |
void readIdentityProvider(List<ModelNode> list, XMLExtendedStreamReader reader, PathAddress parentAddr) throws XMLStreamException { String entityId = readRequiredAttribute(reader, Constants.XML.ENTITY_ID); PathAddress addr = PathAddress.pathAddress(parentAddr, PathElement.pathElement(Constants.Model.IDENTITY_PROVIDER, entityId)); ModelNode addIdentityProvider = Util.createAddOperation(addr); list.add(addIdentityProvider); for (int i = 0; i < reader.getAttributeCount(); i++) { String name = reader.getAttributeLocalName(i); String value = reader.getAttributeValue(i); if (Constants.XML.ENTITY_ID.equals(name) // don't break if encountering this noop attr from client-adapter/core keycloak_saml_adapter_1_6.xsd || "encryption".equals(name)) { continue; } SimpleAttributeDefinition attr = IdentityProviderDefinition.lookup(name); if (attr == null) { throw ParseUtils.unexpectedAttribute(reader, i); } attr.parseAndSetParameter(value, addIdentityProvider, reader); } Set<String> parsedElements = new HashSet<>(); while (reader.hasNext() && nextTag(reader) != END_ELEMENT) { String tagName = reader.getLocalName(); if (parsedElements.contains(tagName)) { // all sub-elements of the identity provider type should occur only once. throw ParseUtils.unexpectedElement(reader); } if (Constants.XML.SINGLE_SIGN_ON.equals(tagName)) { readSingleSignOn(addIdentityProvider, reader); } else if (Constants.XML.SINGLE_LOGOUT.equals(tagName)) { readSingleLogout(addIdentityProvider, reader); } else if (Constants.XML.KEYS.equals(tagName)) { readKeys(list, reader, addr); } else if (Constants.XML.HTTP_CLIENT.equals(tagName)) { readHttpClient(addIdentityProvider, reader); } else if (Constants.XML.ALLOWED_CLOCK_SKEW.equals(tagName)) { readAllowedClockSkew(addIdentityProvider, reader); } else { throw ParseUtils.unexpectedElement(reader); } parsedElements.add(tagName); } }
Example 20
Source File: JvmXml.java From wildfly-core with GNU Lesser General Public License v2.1 | 4 votes |
private static boolean checkParseAndSetParameter(final SimpleAttributeDefinition ad, final String value, final ModelNode operation, final XMLStreamReader reader) throws XMLStreamException { boolean alreadyExisted = operation.hasDefined(ad.getName()); ad.parseAndSetParameter(value, operation, reader); return alreadyExisted; }