code: protected DsSecurity parseDsSecurity(XMLStreamReader reader) throws XMLStreamException, ParserException,
        ValidateException
     {
  
        String userName = null;
        String password = null;
        String securityDomain = null;
        Extension reauthPlugin = null;
  
        Map<String, String> expressions = new HashMap<String, String>();
  
        while (reader.hasNext())
        {
           switch (reader.nextTag())
           {
              case END_ELEMENT : {
                 if (XML.ELEMENT_SECURITY.equals(reader.getLocalName()))
                 {
                    return new DsSecurityImpl(userName, password, securityDomain, reauthPlugin,
                            !expressions.isEmpty() ? expressions : null);
                 }
                 else
                 {
                    switch (reader.getLocalName())
                    {
                       case XML.ELEMENT_PASSWORD :
                       case XML.ELEMENT_USER_NAME :
                       case XML.ELEMENT_SECURITY_DOMAIN :
                       case XML.ELEMENT_REAUTH_PLUGIN :
                          break;
                       default :
                          throw new ParserException(bundle.unexpectedEndTag(reader.getLocalName()));
                    }
                 }
                 break;
              }
              case START_ELEMENT : {
                 switch (reader.getLocalName())
                 {
                    case XML.ELEMENT_PASSWORD : {
                       password = elementAsString(reader, XML.ELEMENT_PASSWORD, expressions);
                       break;
                    }
                    case XML.ELEMENT_USER_NAME : {
                       userName = elementAsString(reader, XML.ELEMENT_USER_NAME, expressions);
                       break;
                    }
                    case XML.ELEMENT_SECURITY_DOMAIN : {
                       securityDomain = elementAsString(reader, XML.ELEMENT_SECURITY_DOMAIN, expressions);
                       break;
                    }
                    case XML.ELEMENT_REAUTH_PLUGIN : {
                       reauthPlugin = parseExtension(reader, XML.ELEMENT_REAUTH_PLUGIN);
                       break;
                    }
                    default :
                       throw new ParserException(bundle.unexpectedElement(reader.getLocalName()));
                 }
                 break;
              }
           }
        }
        throw new ParserException(bundle.unexpectedEndOfDocument());
     }
docs: Parse security
  @param reader The reader
  @return The result
  @exception XMLStreamException XMLStreamException
  @exception ParserException ParserException
  @exception ValidateException ValidateException