connector/src/main/java/org/jboss/as/connector/deployers/ds/DsXmlParser.java
@Override
    protected DsSecurity parseDsSecurity(XMLStreamReader reader) throws XMLStreamException, ParserException,
            ValidateException {

        String userName = null;
        String password = null;
        String securityDomain = null;
        boolean elytronEnabled = false;
        String authenticationContext = null;
        Extension reauthPlugin = null;

        while (reader.hasNext()) {
            switch (reader.nextTag()) {
                case END_ELEMENT: {
                    if (DataSource.Tag.forName(reader.getLocalName()) ==
                            DataSource.Tag.SECURITY) {

                        return new DsSecurityImpl(userName, password,elytronEnabled? authenticationContext: securityDomain,
                                elytronEnabled, null, reauthPlugin);
                    } else {
                        if (DsSecurity.Tag.forName(reader.getLocalName()) == DsSecurity.Tag.UNKNOWN) {
                            throw new ParserException(bundle.unexpectedEndTag(reader.getLocalName()));
                        }
                    }
                    break;
                }
                case START_ELEMENT: {
                    DsSecurity.Tag tag = DsSecurity.Tag.forName(reader.getLocalName());
                    switch (tag) {
                        case PASSWORD: {
                            password = elementAsString(reader);
                            boolean resolved = false;
                            if (propertyReplacer != null && password != null && password.trim().length() != 0) {
                                String resolvedPassword = propertyReplacer.replaceProperties(password);
                                if (resolvedPassword != null) {
                                    password = resolvedPassword;
                                    resolved = true;
                                }
                            }
                            // Previous releases directly passed the text into PropertyResolver, which would not
                            // deal properly with ${ and }, :defaultValue etc. But it would resolve e.g. "sys.prop.foo"
                            // to "123" if there was a system property "sys.prop.foo". So, to avoid breaking folks
                            // who learned to use that behavior, pass any unresolved password in to the PropertyResolver
                            if (!resolved && propertyResolver != null && password != null && password.trim().length() != 0) {
                                String resolvedPassword = propertyResolver.resolve(password);
                                if (resolvedPassword != null) {
                                    password = resolvedPassword;
                                }
                            }
                            break;
                        }
                        case USER_NAME: {
                            userName = elementAsString(reader);
                            break;
                        }
                        case SECURITY_DOMAIN: {
                            securityDomain = elementAsString(reader);
                            break;
                        }
                        case ELYTRON_ENABLED: {
                            Boolean value = elementAsBoolean(reader);
                            elytronEnabled = value == null? true : value;
                            break;
                        }
                        case AUTHENTICATION_CONTEXT: {
                            authenticationContext = elementAsString(reader);
                            break;
                        }
                        case REAUTH_PLUGIN: {
                            reauthPlugin = parseExtension(reader, tag.getLocalName());
                            break;
                        }
                        default:
                            throw new ParserException(bundle.unexpectedElement(reader.getLocalName()));
                    }
                    break;
                }
            }
        }
        throw new ParserException(bundle.unexpectedEndOfDocument());
    }
@Override
    protected DsSecurity parseDsSecurity(XMLStreamReader reader) throws XMLStreamException, ParserException,
            ValidateException {

        String userName = null;
        String password = null;
        String securityDomain = null;
        boolean elytronEnabled = false;
        String authenticationContext = null;
        Extension reauthPlugin = null;

        while (reader.hasNext()) {
            switch (reader.nextTag()) {
                case END_ELEMENT: {
                    if (DataSource.Tag.forName(reader.getLocalName()) ==
                            DataSource.Tag.SECURITY) {

                        return new DsSecurityImpl(userName, password,elytronEnabled? authenticationContext: securityDomain,
                                elytronEnabled, null, reauthPlugin);
                    } else {
                        if (DsSecurity.Tag.forName(reader.getLocalName()) == DsSecurity.Tag.UNKNOWN) {
                            throw new ParserException(bundle.unexpectedEndTag(reader.getLocalName()));
                        }
                    }
                    break;
                }
                case START_ELEMENT: {
                    DsSecurity.Tag tag = DsSecurity.Tag.forName(reader.getLocalName());
                    switch (tag) {
                        case PASSWORD: {
                            password = elementAsString(reader);
                            boolean resolved = false;
                            if (propertyReplacer != null && password != null && password.trim().length() != 0) {
                                String resolvedPassword = propertyReplacer.replaceProperties(password);
                                if (resolvedPassword != null) {
                                    password = resolvedPassword;
                                    resolved = true;
                                }
                            }
                            // Previous releases directly passed the text into PropertyResolver, which would not
                            // deal properly with ${ and }, :defaultValue etc. But it would resolve e.g. "sys.prop.foo"
                            // to "123" if there was a system property "sys.prop.foo". So, to avoid breaking folks
                            // who learned to use that behavior, pass any unresolved password in to the PropertyResolver
                            if (!resolved && propertyResolver != null && password != null && password.trim().length() != 0) {
                                String resolvedPassword = propertyResolver.resolve(password);
                                if (resolvedPassword != null) {
                                    password = resolvedPassword;
                                }
                            }
                            break;
                        }
                        case USER_NAME: {
                            userName = elementAsString(reader);
                            break;
                        }
                        case SECURITY_DOMAIN: {
                            securityDomain = elementAsString(reader);
                            break;
                        }
                        case ELYTRON_ENABLED: {
                            Boolean value = elementAsBoolean(reader);
                            elytronEnabled = value == null? true : value;
                            break;
                        }
                        case AUTHENTICATION_CONTEXT: {
                            authenticationContext = elementAsString(reader);
                            break;
                        }
                        case REAUTH_PLUGIN: {
                            reauthPlugin = parseExtension(reader, tag.getLocalName());
                            break;
                        }
                        default:
                            throw new ParserException(bundle.unexpectedElement(reader.getLocalName()));
                    }
                    break;
                }
            }
        }
        throw new ParserException(bundle.unexpectedEndOfDocument());
    }
@ Override protected DsSecurity parseDsSecurity ( XMLStreamReader reader ) throws XMLStreamException , ParserException , ValidateException { String userName = null ; String password = null ; String securityDomain = null ; boolean elytronEnabled = false ; String authenticationContext = null ; Extension reauthPlugin = null ; while ( reader . hasNext ( ) ) { switch ( reader . nextTag ( ) ) { case END_ELEMENT : { if ( DataSource . Tag . forName ( reader . getLocalName ( ) ) == DataSource . Tag . SECURITY ) { return new DsSecurityImpl ( userName , password , elytronEnabled ? authenticationContext : securityDomain , elytronEnabled , null , reauthPlugin ) ; } else { if ( DsSecurity . Tag . forName ( reader . getLocalName ( ) ) == DsSecurity . Tag . UNKNOWN ) { throw new ParserException ( bundle . unexpectedEndTag ( reader . getLocalName ( ) ) ) ; } } break ; } case START_ELEMENT : { DsSecurity . Tag tag = DsSecurity . Tag . forName ( reader . getLocalName ( ) ) ; switch ( tag ) { case PASSWORD : { password = elementAsString ( reader ) ; boolean resolved = false ; if ( propertyReplacer != null && password != null && password . trim ( ) . length ( ) != 0 ) { String resolvedPassword = propertyReplacer . replaceProperties ( password ) ; if ( resolvedPassword != null ) { password = resolvedPassword ; resolved = true ; } } // Previous releases directly passed the text into PropertyResolver, which would not // deal properly with ${ and }, :defaultValue etc. But it would resolve e.g. "sys.prop.foo" // to "123" if there was a system property "sys.prop.foo". So, to avoid breaking folks // who learned to use that behavior, pass any unresolved password in to the PropertyResolver if ( ! resolved && propertyResolver != null && password != null && password . trim ( ) . length ( ) != 0 ) { String resolvedPassword = propertyResolver . resolve ( password ) ; if ( resolvedPassword != null ) { password = resolvedPassword ; } } break ; } case USER_NAME : { userName = elementAsString ( reader ) ; break ; } case SECURITY_DOMAIN : { securityDomain = elementAsString ( reader ) ; break ; } case ELYTRON_ENABLED : { Boolean value = elementAsBoolean ( reader ) ; elytronEnabled = value == null ? true : value ; break ; } case AUTHENTICATION_CONTEXT : { authenticationContext = elementAsString ( reader ) ; break ; } case REAUTH_PLUGIN : { reauthPlugin = parseExtension ( reader , tag . getLocalName ( ) ) ; break ; } default : throw new ParserException ( bundle . unexpectedElement ( reader . getLocalName ( ) ) ) ; } break ; } } } throw new ParserException ( bundle . unexpectedEndOfDocument ( ) ) ; }
Parse security

@param reader The reader
@return The result
@throws javax.xml.stream.XMLStreamException
XMLStreamException
@throws org.jboss.jca.common.metadata.ParserException
ParserException
@throws org.jboss.jca.common.api.validator.ValidateException
ValidateException
Parse security