public AuthXMLRequest parseXML() throws AuthException {
  try {
    debug.message("entering parseXML");
    if (xmlDocument == null) {
      return null;
    }
    authXMLRequest=new AuthXMLRequest();
    Element docElem=xmlDocument.getDocumentElement();
    if (docElem != null) {
      String temp=docElem.getAttribute("version");
      if (debug.messageEnabled()) {
        debug.message("Request Version is.. : " + temp);
      }
      if (temp != null) {
        authXMLRequest.setRequestVersion(temp);
      }
      Node requestNode=XMLUtils.getChildNode((Node)docElem,"Request");
      String authIdentifier=null;
      if (requestNode != null) {
        authIdentifier=parseNodeAttributes(requestNode,"authIdentifier");
        if (debug.messageEnabled()) {
          debug.message("AuthIdentifier is : " + authIdentifier);
        }
        authXMLRequest.setAuthIdentifier(authIdentifier);
      }
      Node appSSOTokenNode=XMLUtils.getChildNode((Node)requestNode,"AppSSOToken");
      if (appSSOTokenNode != null) {
        debug.message("Got the SSO Token node: ");
        String appSSOTokenID=XMLUtils.getValueOfValueNode(appSSOTokenNode);
        if (appSSOTokenID != null) {
          if (debug.messageEnabled()) {
            debug.message("Got the Session Id: " + appSSOTokenID);
          }
          authXMLRequest.setAppSSOTokenID(appSSOTokenID);
        }
      }
      Node newAuthContextNode=XMLUtils.getChildNode(requestNode,"NewAuthContext");
      if (newAuthContextNode != null) {
        String orgName=parseNodeAttributes(newAuthContextNode,"orgName");
        authXMLRequest.setOrgName(orgName);
        authXMLRequest.setRequestType(AuthXMLRequest.NewAuthContext);
        AuthContextLocal authContext=AuthUtils.getAuthContext(orgName,authIdentifier,false,servletReq,null,null);
        authXMLRequest.setAuthContext(authContext);
      }
      Node queryInfoNode=XMLUtils.getChildNode(requestNode,"QueryInformation");
      if (queryInfoNode != null) {
        String queryType=parseNodeAttributes(queryInfoNode,"requestedInformation");
        authXMLRequest.setRequestInformation(queryType);
        authXMLRequest.setRequestType(AuthXMLRequest.QueryInformation);
        String orgName=parseNodeAttributes(queryInfoNode,"orgName");
        AuthContextLocal authContext=null;
        if (orgName != null) {
          authContext=AuthUtils.getAuthContext(orgName,servletReq);
        }
 else {
          authContext=AuthUtils.getAuthContext(null,authIdentifier,false);
        }
        authXMLRequest.setAuthContext(authContext);
      }
      Node loginNode=XMLUtils.getChildNode(requestNode,"Login");
      if (loginNode != null) {
        debug.message("found login node !!");
        String orgName=parseNodeAttributes(loginNode,"orgName");
        authXMLRequest.setRequestType(AuthXMLRequest.Login);
        parseLoginNodeElements(loginNode,authXMLRequest);
        AuthContext.IndexType indexType=authXMLRequest.getIndexType();
        String indexTypeParam=convertIndexType(indexType);
        String indexName=authXMLRequest.getIndexName();
        if (indexType == AuthContext.IndexType.COMPOSITE_ADVICE) {
          orgName=AuthUtils.getRealmFromPolicyAdvice(indexName);
        }
        AuthContextLocal authContext=null;
        if (orgName != null) {
          authXMLRequest.setOrgName(orgName);
        }
        String hostName=parseNodeAttributes(loginNode,"hostName");
        if (hostName != null) {
          authXMLRequest.setHostName(hostName);
        }
        String localeAttr=parseNodeAttributes(loginNode,AuthXMLTags.LOCALE);
        if (localeAttr != null) {
          authXMLRequest.setLocale(localeAttr);
        }
        String forceAuth=parseNodeAttributes(loginNode,"forceAuth");
        if (forceAuth != null) {
          authXMLRequest.setForceAuth(forceAuth);
          if (debug.messageEnabled()) {
            debug.message("AuthXMLRequestParser.parseXML: " + "Got the force auth flag: " + forceAuth);
          }
        }
        boolean forceAuthBool=Boolean.parseBoolean(forceAuth);
        authContext=AuthUtils.getAuthContext(orgName,authIdentifier,false,servletReq,indexTypeParam,authXMLRequest,forceAuthBool);
        authXMLRequest.setAuthContext(authContext);
        if (localeAttr != null) {
          LoginState loginState=authContext.getLoginState();
          loginState.setRemoteLocale(localeAttr);
        }
        HttpServletRequest clientRequest=AuthXMLUtils.getRemoteRequest(XMLUtils.getChildNode(requestNode,AuthXMLTags.REMOTE_REQUEST_RESPONSE));
        HttpServletResponse clientResponse=AuthXMLUtils.getRemoteResponse(XMLUtils.getChildNode(requestNode,AuthXMLTags.REMOTE_REQUEST_RESPONSE));
        authXMLRequest.setClientRequest(clientRequest);
        authXMLRequest.setClientResponse(clientResponse);
      }
      Node submitReqNode=XMLUtils.getChildNode(requestNode,"SubmitRequirements");
      if (submitReqNode != null) {
        authXMLRequest.setRequestType(AuthXMLRequest.SubmitRequirements);
        AuthContextLocal authContext=AuthUtils.getAuthContext(servletReq,authIdentifier);
        authXMLRequest.setAuthContext(authContext);
        Callback[] callbacks=AuthUtils.getRecdCallback(authContext);
        parseSubmitReqElements(submitReqNode,authXMLRequest,callbacks);
        String localeStr=authXMLRequest.getLocale();
        LoginState loginState=authContext.getLoginState();
        loginState.setRemoteLocale(localeStr);
        HttpServletRequest clientRequest=AuthXMLUtils.getRemoteRequest(XMLUtils.getChildNode(requestNode,AuthXMLTags.REMOTE_REQUEST_RESPONSE));
        HttpServletResponse clientResponse=AuthXMLUtils.getRemoteResponse(XMLUtils.getChildNode(requestNode,AuthXMLTags.REMOTE_REQUEST_RESPONSE));
        authXMLRequest.setClientRequest(clientRequest);
        authXMLRequest.setClientResponse(clientResponse);
      }
      Node logoutNode=XMLUtils.getChildNode(requestNode,"Logout");
      if (logoutNode != null) {
        authXMLRequest.setRequestType(AuthXMLRequest.Logout);
      }
      Node abortNode=XMLUtils.getChildNode(requestNode,"Abort");
      if (abortNode != null) {
        authXMLRequest.setRequestType(AuthXMLRequest.Abort);
        AuthContextLocal authContext=AuthUtils.getAuthContext(null,authIdentifier,true);
        authXMLRequest.setAuthContext(authContext);
      }
    }
  }
 catch (  AuthException e) {
    throw e;
  }
catch (  Exception e) {
    debug.message("Error in parseXML: : ",e);
  }
  return authXMLRequest;
}

public AuthXMLRequest parseXML ( ) throws AuthException { try { debug . message ( "entering parseXML" ) ; if ( xmlDocument == null ) { return null ; } authXMLRequest = new AuthXMLRequest ( ) ; Element docElem = xmlDocument . getDocumentElement ( ) ; if ( docElem != null ) { String temp = docElem . getAttribute ( "version" ) ; if ( debug . messageEnabled ( ) ) { debug . message ( "Request Version is.. : " + temp ) ; } if ( temp != null ) { authXMLRequest . setRequestVersion ( temp ) ; } Node requestNode = XMLUtils . getChildNode ( ( Node ) docElem , "Request" ) ; String authIdentifier = null ; if ( requestNode != null ) { authIdentifier = parseNodeAttributes ( requestNode , "authIdentifier" ) ; if ( debug . messageEnabled ( ) ) { debug . message ( "AuthIdentifier is : " + authIdentifier ) ; } authXMLRequest . setAuthIdentifier ( authIdentifier ) ; } Node appSSOTokenNode = XMLUtils . getChildNode ( ( Node ) requestNode , "AppSSOToken" ) ; if ( appSSOTokenNode != null ) { debug . message ( "Got the SSO Token node: " ) ; String appSSOTokenID = XMLUtils . getValueOfValueNode ( appSSOTokenNode ) ; if ( appSSOTokenID != null ) { if ( debug . messageEnabled ( ) ) { debug . message ( "Got the Session Id: " + appSSOTokenID ) ; } authXMLRequest . setAppSSOTokenID ( appSSOTokenID ) ; } } Node newAuthContextNode = XMLUtils . getChildNode ( requestNode , "NewAuthContext" ) ; if ( newAuthContextNode != null ) { String orgName = parseNodeAttributes ( newAuthContextNode , "orgName" ) ; authXMLRequest . setOrgName ( orgName ) ; authXMLRequest . setRequestType ( AuthXMLRequest . NewAuthContext ) ; AuthContextLocal authContext = AuthUtils . getAuthContext ( orgName , authIdentifier , false , servletReq , null , null ) ; authXMLRequest . setAuthContext ( authContext ) ; } Node queryInfoNode = XMLUtils . getChildNode ( requestNode , "QueryInformation" ) ; if ( queryInfoNode != null ) { String queryType = parseNodeAttributes ( queryInfoNode , "requestedInformation" ) ; authXMLRequest . setRequestInformation ( queryType ) ; authXMLRequest . setRequestType ( AuthXMLRequest . QueryInformation ) ; String orgName = parseNodeAttributes ( queryInfoNode , "orgName" ) ; AuthContextLocal authContext = null ; if ( orgName != null ) { authContext = AuthUtils . getAuthContext ( orgName , servletReq ) ; } else { authContext = AuthUtils . getAuthContext ( null , authIdentifier , false ) ; } authXMLRequest . setAuthContext ( authContext ) ; } Node loginNode = XMLUtils . getChildNode ( requestNode , "Login" ) ; if ( loginNode != null ) { debug . message ( "found login node !!" ) ; String orgName = parseNodeAttributes ( loginNode , "orgName" ) ; authXMLRequest . setRequestType ( AuthXMLRequest . Login ) ; parseLoginNodeElements ( loginNode , authXMLRequest ) ; AuthContext . IndexType indexType = authXMLRequest . getIndexType ( ) ; String indexTypeParam = convertIndexType ( indexType ) ; String indexName = authXMLRequest . getIndexName ( ) ; if ( indexType == AuthContext . IndexType . COMPOSITE_ADVICE ) { orgName = AuthUtils . getRealmFromPolicyAdvice ( indexName ) ; } AuthContextLocal authContext = null ; if ( orgName != null ) { authXMLRequest . setOrgName ( orgName ) ; } String hostName = parseNodeAttributes ( loginNode , "hostName" ) ; if ( hostName != null ) { authXMLRequest . setHostName ( hostName ) ; } String localeAttr = parseNodeAttributes ( loginNode , AuthXMLTags . LOCALE ) ; if ( localeAttr != null ) { authXMLRequest . setLocale ( localeAttr ) ; } String forceAuth = parseNodeAttributes ( loginNode , "forceAuth" ) ; if ( forceAuth != null ) { authXMLRequest . setForceAuth ( forceAuth ) ; if ( debug . messageEnabled ( ) ) { debug . message ( "AuthXMLRequestParser.parseXML: " + "Got the force auth flag: " + forceAuth ) ; } } boolean forceAuthBool = Boolean . parseBoolean ( forceAuth ) ; authContext = AuthUtils . getAuthContext ( orgName , authIdentifier , false , servletReq , indexTypeParam , authXMLRequest , forceAuthBool ) ; authXMLRequest . setAuthContext ( authContext ) ; if ( localeAttr != null ) { LoginState loginState = authContext . getLoginState ( ) ; loginState . setRemoteLocale ( localeAttr ) ; } HttpServletRequest clientRequest = AuthXMLUtils . getRemoteRequest ( XMLUtils . getChildNode ( requestNode , AuthXMLTags . REMOTE_REQUEST_RESPONSE ) ) ; HttpServletResponse clientResponse = AuthXMLUtils . getRemoteResponse ( XMLUtils . getChildNode ( requestNode , AuthXMLTags . REMOTE_REQUEST_RESPONSE ) ) ; authXMLRequest . setClientRequest ( clientRequest ) ; authXMLRequest . setClientResponse ( clientResponse ) ; } Node submitReqNode = XMLUtils . getChildNode ( requestNode , "SubmitRequirements" ) ; if ( submitReqNode != null ) { authXMLRequest . setRequestType ( AuthXMLRequest . SubmitRequirements ) ; AuthContextLocal authContext = AuthUtils . getAuthContext ( servletReq , authIdentifier ) ; authXMLRequest . setAuthContext ( authContext ) ; Callback [ ] callbacks = AuthUtils . getRecdCallback ( authContext ) ; parseSubmitReqElements ( submitReqNode , authXMLRequest , callbacks ) ; String localeStr = authXMLRequest . getLocale ( ) ; LoginState loginState = authContext . getLoginState ( ) ; loginState . setRemoteLocale ( localeStr ) ; HttpServletRequest clientRequest = AuthXMLUtils . getRemoteRequest ( XMLUtils . getChildNode ( requestNode , AuthXMLTags . REMOTE_REQUEST_RESPONSE ) ) ; HttpServletResponse clientResponse = AuthXMLUtils . getRemoteResponse ( XMLUtils . getChildNode ( requestNode , AuthXMLTags . REMOTE_REQUEST_RESPONSE ) ) ; authXMLRequest . setClientRequest ( clientRequest ) ; authXMLRequest . setClientResponse ( clientResponse ) ; } Node logoutNode = XMLUtils . getChildNode ( requestNode , "Logout" ) ; if ( logoutNode != null ) { authXMLRequest . setRequestType ( AuthXMLRequest . Logout ) ; } Node abortNode = XMLUtils . getChildNode ( requestNode , "Abort" ) ; if ( abortNode != null ) { authXMLRequest . setRequestType ( AuthXMLRequest . Abort ) ; AuthContextLocal authContext = AuthUtils . getAuthContext ( null , authIdentifier , true ) ; authXMLRequest . setAuthContext ( authContext ) ; } } } catch ( AuthException e ) { throw e ; } catch ( Exception e ) { debug . message ( "Error in parseXML: : " , e ) ; } return authXMLRequest ; }
parses the authentication request xml document .
