Java Code Examples for org.jboss.staxmapper.XMLExtendedStreamWriter#writeAttribute()

The following examples show how to use org.jboss.staxmapper.XMLExtendedStreamWriter#writeAttribute() . 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 vote down vote up
private void writeSecureResource(String tagName, List<SimpleAttributeDefinition> attributes, XMLExtendedStreamWriter writer, SubsystemMarshallingContext context) throws XMLStreamException {
    if (!context.getModelNode().get(tagName).isDefined()) {
        return;
    }
    for (Property deployment : context.getModelNode().get(tagName).asPropertyList()) {
        writer.writeStartElement(tagName);
        writer.writeAttribute("name", deployment.getName());
        ModelNode deploymentElements = deployment.getValue();
        for (AttributeDefinition element : attributes) {
            element.marshallAsElement(deploymentElements, writer);
        }

        ModelNode credentials = deploymentElements.get(CredentialDefinition.TAG_NAME);
        if (credentials.isDefined()) {
            writeCredentials(writer, credentials);
        }

        ModelNode redirectRewriteRule = deploymentElements.get(RedirecRewritetRuleDefinition.TAG_NAME);
        if (redirectRewriteRule.isDefined()) {
            writeRedirectRules(writer, redirectRewriteRule);
        }

        writer.writeEndElement();
    }
}
 
Example 2
Source File: RemotingSubsystemXMLPersister.java    From wildfly-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
private void writeLocalOutboundConnection(final XMLExtendedStreamWriter writer, final String connectionName, final ModelNode model) throws XMLStreamException {
    // <local-outbound-connection>
    writer.writeStartElement(Element.LOCAL_OUTBOUND_CONNECTION.getLocalName());

    writer.writeAttribute(Attribute.NAME.getLocalName(), connectionName);

    final String outboundSocketRef = model.get(OUTBOUND_SOCKET_BINDING_REF).asString();
    writer.writeAttribute(Attribute.OUTBOUND_SOCKET_BINDING_REF.getLocalName(), outboundSocketRef);

    // write the connection-creation-options if any
    if (model.hasDefined(PROPERTY)) {
        writeProperties(writer, model.get(PROPERTY));
    }

    // </local-outbound-connection>
    writer.writeEndElement();
}
 
Example 3
Source File: KeycloakSubsystemParser.java    From keycloak with Apache License 2.0 6 votes vote down vote up
void writeRoleIdentifiers(XMLExtendedStreamWriter writer, ModelNode model) throws XMLStreamException {
    ModelNode value = model.get(Constants.Model.ROLE_ATTRIBUTES);
    if (!value.isDefined()) {
        return;
    }

    List<ModelNode> items = value.asList();
    if (items.size() == 0) {
        return;
    }

    writer.writeStartElement(Constants.XML.ROLE_IDENTIFIERS);
    for (ModelNode item : items) {
        writer.writeStartElement(Constants.XML.ATTRIBUTE);
        writer.writeAttribute("name", item.asString());
        writer.writeEndElement();
    }
    writer.writeEndElement();
}
 
Example 4
Source File: ThreadsParser.java    From wildfly-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
private void writeQueuelessThreadPool(final XMLExtendedStreamWriter writer, final Property property, final String elementName,
                                      final boolean includeName, final boolean blocking) throws XMLStreamException {
    writer.writeStartElement(elementName);
    ModelNode node = property.getValue();
    if (includeName) {
        writer.writeAttribute(Attribute.NAME.getLocalName(), property.getName());
    }
    writeCountElement(PoolAttributeDefinitions.MAX_THREADS, node, writer);

    writeTime(writer, node, Element.KEEPALIVE_TIME);
    writeRef(writer, node, Element.THREAD_FACTORY, THREAD_FACTORY);
    if (!blocking) {
        writeRef(writer, node, Element.HANDOFF_EXECUTOR, HANDOFF_EXECUTOR);
    }
    writer.writeEndElement();
}
 
Example 5
Source File: ThreadsParser.java    From wildfly-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
private void writeUnboundedQueueThreadPoolInternal(final XMLExtendedStreamWriter writer, final Property property,
                                                   final String elementName, final boolean includeName,
                                                   final boolean supportsCoreThreads) throws XMLStreamException {
    writer.writeStartElement(elementName);
    ModelNode node = property.getValue();
    if (includeName) {
        writer.writeAttribute(Attribute.NAME.getLocalName(), property.getName());
    }
    writeCountElement(PoolAttributeDefinitions.MAX_THREADS, node, writer);

    if(supportsCoreThreads) {
        writeCountElement(PoolAttributeDefinitions.CORE_THREADS, node, writer);
    }

    writeTime(writer, node, Element.KEEPALIVE_TIME);
    writeRef(writer, node, Element.THREAD_FACTORY, THREAD_FACTORY);

    writer.writeEndElement();
}
 
Example 6
Source File: KeycloakSubsystemParser.java    From keycloak with Apache License 2.0 6 votes vote down vote up
void writeIdentityProvider(XMLExtendedStreamWriter writer, ModelNode model) throws XMLStreamException {
    if (!model.isDefined()) {
        return;
    }

    for (Property idp : model.asPropertyList()) {
        writer.writeStartElement(Constants.XML.IDENTITY_PROVIDER);
        writer.writeAttribute(Constants.XML.ENTITY_ID, idp.getName());

        ModelNode idpAttributes = idp.getValue();
        for (SimpleAttributeDefinition attr : IdentityProviderDefinition.ATTRIBUTES) {
            attr.getAttributeMarshaller().marshallAsAttribute(attr, idpAttributes, false, writer);
        }

        writeSingleSignOn(writer, idpAttributes.get(Constants.Model.SINGLE_SIGN_ON));
        writeSingleLogout(writer, idpAttributes.get(Constants.Model.SINGLE_LOGOUT));
        writeKeys(writer, idpAttributes.get(Constants.Model.KEY));
        writeHttpClient(writer, idpAttributes.get(Constants.Model.HTTP_CLIENT));
        writeAllowedClockSkew(writer, idpAttributes.get(Constants.Model.ALLOWED_CLOCK_SKEW));
        writer.writeEndElement();
    }
}
 
Example 7
Source File: KeycloakSubsystemParser.java    From keycloak with Apache License 2.0 5 votes vote down vote up
public void writeSecureDeployment(XMLExtendedStreamWriter writer, ModelNode model) throws XMLStreamException {
    if (!model.get(Constants.Model.SECURE_DEPLOYMENT).isDefined()) {
        return;
    }

    for (Property sp : model.get(Constants.Model.SECURE_DEPLOYMENT).asPropertyList()) {
        writer.writeStartElement(Constants.XML.SECURE_DEPLOYMENT);
        writer.writeAttribute(Constants.XML.NAME, sp.getName());

        writeSps(writer, sp.getValue());
        writer.writeEndElement();
    }
}
 
Example 8
Source File: KeycloakSubsystemParser.java    From keycloak with Apache License 2.0 5 votes vote down vote up
void writeRoleMappingsProvider(final XMLExtendedStreamWriter writer, final ModelNode model) throws XMLStreamException {
    ModelNode providerId = model.get(Constants.Model.ROLE_MAPPINGS_PROVIDER_ID);
    if (!providerId.isDefined()) {
        return;
    }
    writer.writeStartElement(Constants.XML.ROLE_MAPPINGS_PROVIDER);
    writer.writeAttribute(Constants.XML.ID, providerId.asString());
    ServiceProviderDefinition.ROLE_MAPPINGS_PROVIDER_CONFIG.marshallAsElement(model, false, writer);
    writer.writeEndElement();
}
 
Example 9
Source File: ManagementXml_5.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
private void writePlugIn_Authorization(XMLExtendedStreamWriter writer, ModelNode plugIn) throws XMLStreamException {
    writer.writeStartElement(Element.PLUG_IN.getLocalName());
    AbstractPlugInAuthResourceDefinition.NAME.marshallAsAttribute(plugIn, writer);
    if (plugIn.hasDefined(PROPERTY)) {
        writer.writeStartElement(PROPERTIES);
        ModelNode properties = plugIn.get(PROPERTY);
        for (String current : properties.keys()) {
            writer.writeEmptyElement(PROPERTY);
            writer.writeAttribute(Attribute.NAME.getLocalName(), current);
            PropertyResourceDefinition.VALUE.marshallAsAttribute(properties.get(current), writer);
        }
        writer.writeEndElement();
    }
    writer.writeEndElement();
}
 
Example 10
Source File: RemotingSubsystemXMLPersister.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
private void writeRemoteOutboundConnection(final XMLExtendedStreamWriter writer, final String connectionName, final ModelNode model) throws XMLStreamException {
    // <remote-outbound-connection>
    writer.writeStartElement(Element.REMOTE_OUTBOUND_CONNECTION.getLocalName());

    writer.writeAttribute(Attribute.NAME.getLocalName(), connectionName);

    final String outboundSocketRef = model.get(OUTBOUND_SOCKET_BINDING_REF).asString();
    writer.writeAttribute(Attribute.OUTBOUND_SOCKET_BINDING_REF.getLocalName(), outboundSocketRef);

    if (model.hasDefined(CommonAttributes.USERNAME)) {
        writer.writeAttribute(Attribute.USERNAME.getLocalName(), model.require(CommonAttributes.USERNAME).asString());
    }

    if (model.hasDefined(CommonAttributes.SECURITY_REALM)) {
        writer.writeAttribute(Attribute.SECURITY_REALM.getLocalName(), model.require(SECURITY_REALM).asString());
    }

    if (model.hasDefined(CommonAttributes.PROTOCOL)) {
        writer.writeAttribute(Attribute.PROTOCOL.getLocalName(), model.require(PROTOCOL).asString());
    }
    if (model.hasDefined(CommonAttributes.AUTHENTICATION_CONTEXT)) {
        writer.writeAttribute(Attribute.AUTHENTICATION_CONTEXT.getLocalName(), model.require(AUTHENTICATION_CONTEXT).asString());
    }
    // write the connection-creation-options if any
    if (model.hasDefined(PROPERTY)) {
        writeProperties(writer, model.get(PROPERTY));
    }

    // </remote-outbound-connection>
    writer.writeEndElement();
}
 
Example 11
Source File: DomainXml_14.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
private void writeHostExcludes(XMLExtendedStreamWriter writer, ModelNode modelNode) throws XMLStreamException {
    writer.writeStartElement(Element.HOST_EXCLUDES.getLocalName());
    for (String exclude : modelNode.keys()) {
        writer.writeStartElement(Element.HOST_EXCLUDE.getLocalName());
        writer.writeAttribute(Attribute.NAME.getLocalName(), exclude);
        ModelNode excludeNode = modelNode.get(exclude);
        HostExcludeResourceDefinition.ACTIVE_SERVER_GROUPS.getMarshaller()
                .marshall(HostExcludeResourceDefinition.ACTIVE_SERVER_GROUPS, excludeNode, false, writer);
        HostExcludeResourceDefinition.ACTIVE_SOCKET_BINDING_GROUPS.getMarshaller()
                .marshall(HostExcludeResourceDefinition.ACTIVE_SOCKET_BINDING_GROUPS, excludeNode, false, writer);
        if (HostExcludeResourceDefinition.HOST_RELEASE.isMarshallable(excludeNode)) {
            writer.writeEmptyElement(Element.HOST_RELEASE.getLocalName());
            HostExcludeResourceDefinition.HOST_RELEASE.marshallAsAttribute(excludeNode, writer);
        } else {
            writer.writeStartElement(Element.HOST_API_VERSION.getLocalName());
            HostExcludeResourceDefinition.MANAGEMENT_MAJOR_VERSION.marshallAsAttribute(excludeNode, writer);
            HostExcludeResourceDefinition.MANAGEMENT_MINOR_VERSION.marshallAsAttribute(excludeNode, writer);
            HostExcludeResourceDefinition.MANAGEMENT_MICRO_VERSION.marshallAsAttribute(excludeNode, writer);
            writer.writeEndElement();
        }

        if (HostExcludeResourceDefinition.EXCLUDED_EXTENSIONS.isMarshallable(excludeNode)) {
            writer.writeStartElement(Element.EXCLUDED_EXTENSIONS.getLocalName());
            for (ModelNode ext : excludeNode.get(HostExcludeResourceDefinition.EXCLUDED_EXTENSIONS.getName()).asList()) {
                if (ext.isDefined()) {
                    writer.writeEmptyElement(Element.EXTENSION.getLocalName());
                    writer.writeAttribute(Attribute.MODULE.getLocalName(), ext.asString());
                }
            }
            writer.writeEndElement();
        }

        writer.writeEndElement();
    }
    writer.writeEndElement();
}
 
Example 12
Source File: LoggingSubsystemWriter.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
private void writeConsoleHandler(final XMLExtendedStreamWriter writer, final ModelNode model, final String name)
        throws XMLStreamException {
    writer.writeStartElement(Element.CONSOLE_HANDLER.getLocalName());
    writer.writeAttribute(HANDLER_NAME.getXmlName(), name);
    AUTOFLUSH.marshallAsAttribute(model, writer);
    ENABLED.marshallAsAttribute(model, false, writer);
    writeCommonHandler(writer, model);
    TARGET.marshallAsElement(model, writer);
    writer.writeEndElement();
}
 
Example 13
Source File: LoggingSubsystemWriter.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
private void writeFileHandler(final XMLExtendedStreamWriter writer, final ModelNode model, final String name) throws XMLStreamException {
    writer.writeStartElement(Element.FILE_HANDLER.getLocalName());
    writer.writeAttribute(Attribute.NAME.getLocalName(), name);
    AUTOFLUSH.marshallAsAttribute(model, writer);
    ENABLED.marshallAsAttribute(model, false, writer);
    writeCommonHandler(writer, model);
    FILE.marshallAsElement(model, writer);
    APPEND.marshallAsElement(model, writer);

    writer.writeEndElement();
}
 
Example 14
Source File: LoggingSubsystemWriter.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
private void writeCustomHandler(final XMLExtendedStreamWriter writer, final ModelNode model, final String name)
        throws XMLStreamException {
    writer.writeStartElement(Element.CUSTOM_HANDLER.getLocalName());
    writer.writeAttribute(HANDLER_NAME.getXmlName(), name);
    CLASS.marshallAsAttribute(model, writer);
    MODULE.marshallAsAttribute(model, writer);
    ENABLED.marshallAsAttribute(model, false, writer);
    writeCommonHandler(writer, model);
    PROPERTIES.marshallAsElement(model, writer);

    writer.writeEndElement();
}
 
Example 15
Source File: LoggingSubsystemWriter.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
private void writePeriodicRotatingFileHandler(final XMLExtendedStreamWriter writer, final ModelNode model, final String name) throws XMLStreamException {
    writer.writeStartElement(Element.PERIODIC_ROTATING_FILE_HANDLER.getLocalName());
    writer.writeAttribute(HANDLER_NAME.getXmlName(), name);
    AUTOFLUSH.marshallAsAttribute(model, writer);
    ENABLED.marshallAsAttribute(model, false, writer);
    writeCommonHandler(writer, model);
    FILE.marshallAsElement(model, writer);
    SUFFIX.marshallAsElement(model, writer);
    APPEND.marshallAsElement(model, writer);

    writer.writeEndElement();
}
 
Example 16
Source File: LoggingSubsystemWriter.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
private void writePeriodicSizeRotatingFileHandler(final XMLExtendedStreamWriter writer, final ModelNode model, final String name) throws XMLStreamException {
    writer.writeStartElement(Element.PERIODIC_SIZE_ROTATING_FILE_HANDLER.getLocalName());
    writer.writeAttribute(HANDLER_NAME.getXmlName(), name);
    AUTOFLUSH.marshallAsAttribute(model, writer);
    ENABLED.marshallAsAttribute(model, false, writer);
    ROTATE_ON_BOOT.marshallAsAttribute(model, false, writer);
    writeCommonHandler(writer, model);
    FILE.marshallAsElement(model, writer);
    ROTATE_SIZE.marshallAsElement(model, writer);
    MAX_BACKUP_INDEX.marshallAsElement(model, writer);
    SUFFIX.marshallAsElement(model, writer);
    APPEND.marshallAsElement(model, writer);

    writer.writeEndElement();
}
 
Example 17
Source File: LoggingSubsystemWriter.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
private void writeFilterElement(final XMLExtendedStreamWriter writer, final ModelNode model, final String name) throws XMLStreamException {
    writer.writeStartElement(Element.FILTER.getLocalName());
    writer.writeAttribute(NAME.getXmlName(), name);
    CLASS.marshallAsAttribute(model, writer);
    MODULE.marshallAsAttribute(model, writer);
    FilterResourceDefinition.CONSTRUCTOR_PROPERTIES.marshallAsElement(model, writer);
    PROPERTIES.marshallAsElement(model, writer);
    writer.writeEndElement();
}
 
Example 18
Source File: WriteUtils.java    From wildfly-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
public static void writeAttribute(XMLExtendedStreamWriter writer, Attribute attribute, String value)
        throws XMLStreamException {
    writer.writeAttribute(attribute.getLocalName(), value);
}
 
Example 19
Source File: DeploymentScannerParser_1_0.java    From wildfly-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
/** {@inheritDoc} */
@Override
public void writeContent(XMLExtendedStreamWriter writer, SubsystemMarshallingContext context) throws XMLStreamException {
    context.startSubsystemElement(Namespace.CURRENT.getUriString(), false);
    ModelNode scanners = context.getModelNode();
    for (final Property list : scanners.asPropertyList()) {
        final ModelNode node = list.getValue();

        for (final Property scanner : node.asPropertyList()) {

            writer.writeEmptyElement(CommonAttributes.DEPLOYMENT_SCANNER);
            writer.writeAttribute(CommonAttributes.NAME, scanner.getName());
            ModelNode configuration = scanner.getValue();
            if (configuration.hasDefined(PATH)) {
                writer.writeAttribute(PATH, configuration.get(PATH)
                        .asString());
            }
            if (configuration.hasDefined(CommonAttributes.SCAN_ENABLED)) {
                writer.writeAttribute(CommonAttributes.SCAN_ENABLED,
                        configuration.get(CommonAttributes.SCAN_ENABLED).asString());
            }
            if (configuration.hasDefined(CommonAttributes.SCAN_INTERVAL)) {
                writer.writeAttribute(CommonAttributes.SCAN_INTERVAL,
                        configuration.get(CommonAttributes.SCAN_INTERVAL).asString());
            }
            if (configuration.hasDefined(CommonAttributes.RELATIVE_TO)) {
                writer.writeAttribute(CommonAttributes.RELATIVE_TO,
                        configuration.get(CommonAttributes.RELATIVE_TO).asString());
            }
            if (configuration.hasDefined(CommonAttributes.AUTO_DEPLOY_ZIPPED)) {
                if (!configuration.get(CommonAttributes.AUTO_DEPLOY_ZIPPED).asBoolean()) {
                    writer.writeAttribute(CommonAttributes.AUTO_DEPLOY_ZIPPED, Boolean.FALSE.toString());
                }
            }
            if (configuration.hasDefined(CommonAttributes.AUTO_DEPLOY_EXPLODED)) {
                if (configuration.get(CommonAttributes.AUTO_DEPLOY_EXPLODED).asBoolean()) {
                    writer.writeAttribute(CommonAttributes.AUTO_DEPLOY_EXPLODED, Boolean.TRUE.toString());
                }
            }
            if (configuration.hasDefined(CommonAttributes.DEPLOYMENT_TIMEOUT)) {
                writer.writeAttribute(CommonAttributes.DEPLOYMENT_TIMEOUT, configuration.get(CommonAttributes.DEPLOYMENT_TIMEOUT).asString());
            }
        }
        writer.writeEndElement();
    }
}
 
Example 20
Source File: ManagementXml_5.java    From wildfly-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
private void writeAuthentication(XMLExtendedStreamWriter writer, ModelNode realm) throws XMLStreamException {
    writer.writeStartElement(Element.AUTHENTICATION.getLocalName());
    ModelNode authentication = realm.require(AUTHENTICATION);

    if (authentication.hasDefined(TRUSTSTORE)) {
        ModelNode truststore = authentication.require(TRUSTSTORE);
        boolean hasCredential = truststore.hasDefined(KeystoreAttributes.KEYSTORE_PASSWORD_CREDENTIAL_REFERENCE.getName());
        if(hasCredential) {
                writer.writeStartElement(Element.TRUSTSTORE.getLocalName());
            } else {
                writer.writeEmptyElement(Element.TRUSTSTORE.getLocalName());
            }
        KeystoreAttributes.KEYSTORE_PROVIDER.marshallAsAttribute(truststore, writer);
        KeystoreAttributes.KEYSTORE_PATH.marshallAsAttribute(truststore, writer);
        KeystoreAttributes.KEYSTORE_RELATIVE_TO.marshallAsAttribute(truststore, writer);
        KeystoreAttributes.KEYSTORE_PASSWORD.marshallAsAttribute(truststore, writer);
        KeystoreAttributes.KEYSTORE_PASSWORD_CREDENTIAL_REFERENCE.marshallAsElement(truststore, writer);
        if (hasCredential) {
            writer.writeEndElement();
        }
    }

    if (authentication.hasDefined(LOCAL)) {
        ModelNode local = authentication.require(LOCAL);
        writer.writeStartElement(Element.LOCAL.getLocalName());
        LocalAuthenticationResourceDefinition.DEFAULT_USER.marshallAsAttribute(local, writer);
        LocalAuthenticationResourceDefinition.ALLOWED_USERS.marshallAsAttribute(local, writer);
        LocalAuthenticationResourceDefinition.SKIP_GROUP_LOADING.marshallAsAttribute(local, writer);
        writer.writeEndElement();
    }

    if (authentication.hasDefined(KERBEROS)) {
        ModelNode kerberos = authentication.require(KERBEROS);
        writer.writeEmptyElement(Element.KERBEROS.getLocalName());
        KerberosAuthenticationResourceDefinition.REMOVE_REALM.marshallAsAttribute(kerberos, writer);
    }

    if (authentication.hasDefined(JAAS)) {
        ModelNode jaas = authentication.get(JAAS);
        writer.writeStartElement(Element.JAAS.getLocalName());
        JaasAuthenticationResourceDefinition.NAME.marshallAsAttribute(jaas, writer);
        JaasAuthenticationResourceDefinition.ASSIGN_GROUPS.marshallAsAttribute(jaas, writer);
        writer.writeEndElement();
    } else if (authentication.hasDefined(LDAP)) {
        ModelNode userLdap = authentication.get(LDAP);
        writer.writeStartElement(Element.LDAP.getLocalName());
        LdapAuthenticationResourceDefinition.CONNECTION.marshallAsAttribute(userLdap, writer);
        LdapAuthenticationResourceDefinition.BASE_DN.marshallAsAttribute(userLdap, writer);
        LdapAuthenticationResourceDefinition.RECURSIVE.marshallAsAttribute(userLdap, writer);
        LdapAuthenticationResourceDefinition.USER_DN.marshallAsAttribute(userLdap, writer);
        LdapAuthenticationResourceDefinition.ALLOW_EMPTY_PASSWORDS.marshallAsAttribute(userLdap, writer);
        LdapAuthenticationResourceDefinition.USERNAME_LOAD.marshallAsAttribute(userLdap, writer);

        writeLdapCacheIfDefined(writer, userLdap);

        if (LdapAuthenticationResourceDefinition.USERNAME_FILTER.isMarshallable(userLdap)) {
            writer.writeEmptyElement(Element.USERNAME_FILTER.getLocalName());
            LdapAuthenticationResourceDefinition.USERNAME_FILTER.marshallAsAttribute(userLdap, writer);
        } else if (LdapAuthenticationResourceDefinition.ADVANCED_FILTER.isMarshallable(userLdap)) {
            writer.writeEmptyElement(Element.ADVANCED_FILTER.getLocalName());
            LdapAuthenticationResourceDefinition.ADVANCED_FILTER.marshallAsAttribute(userLdap, writer);
        }
        writer.writeEndElement();
    } else if (authentication.hasDefined(PROPERTIES)) {
        ModelNode properties = authentication.require(PROPERTIES);
        writer.writeEmptyElement(Element.PROPERTIES.getLocalName());
        PropertiesAuthenticationResourceDefinition.PATH.marshallAsAttribute(properties, writer);
        PropertiesAuthenticationResourceDefinition.RELATIVE_TO.marshallAsAttribute(properties, writer);
        PropertiesAuthenticationResourceDefinition.PLAIN_TEXT.marshallAsAttribute(properties, writer);
    } else if (authentication.has(USERS)) {
        ModelNode userDomain = authentication.get(USERS);
        ModelNode users = userDomain.hasDefined(USER) ? userDomain.require(USER) : new ModelNode().setEmptyObject();
        writer.writeStartElement(Element.USERS.getLocalName());
        for (String userName : users.keys()) {
            ModelNode currentUser = users.get(userName);
            writer.writeStartElement(Element.USER.getLocalName());
            writer.writeAttribute(Attribute.USERNAME.getLocalName(), userName);
            UserResourceDefinition.PASSWORD.marshallAsElement(currentUser, writer);
            UserResourceDefinition.CREDENTIAL_REFERENCE.marshallAsElement(currentUser, writer);
            writer.writeEndElement();
        }
        writer.writeEndElement();
    } else if (authentication.hasDefined(PLUG_IN)) {
        writePlugIn_Authentication(writer, authentication.get(PLUG_IN));
    }

    writer.writeEndElement();
}