webservices/wsstar/wsstarpolicy/inc/policynormalizer.h
changeset 0 62f9d29f7211
equal deleted inserted replaced
-1:000000000000 0:62f9d29f7211
       
     1 /*
       
     2 * Copyright (c) 2006-2006 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: Header declaration
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 
       
    23  
       
    24 
       
    25 #ifndef POLICY_NORMALIZER_H
       
    26 #define POLICY_NORMALIZER_H
       
    27 
       
    28 #include <e32std.h>
       
    29 #include "SenDomFragment.h"
       
    30 #include "SenPointerMap.h"
       
    31 
       
    32 // FORWARD DECLARATIONS
       
    33 class CPolicyNormalizer;
       
    34 class CPolicyRegistry;
       
    35 class CWSPolicy;
       
    36 typedef RSenPointerMap<TDesC8, CSenElement> RPolicyMap;
       
    37 // CONSTANTS
       
    38 
       
    39 
       
    40 // INCLUDES
       
    41 namespace  WSPolicy
       
    42     {
       
    43     
       
    44 	_LIT8( KAndCompositeAssertion , "All");             // Tag name of AndComposteAssertion
       
    45 	_LIT8( KXorCompositeAssertion , "ExactlyOne");      // Tag name of XorCompositeAssertion
       
    46 	_LIT8( KWsPolicy , "Policy");                       // Tag name of Policy
       
    47 	_LIT8( KWsPolicyPrefix , "wsp");                    // Prefix of WS-Policy namespace
       
    48 	_LIT8( KWsuNsPrefix , "wsu");                       // Prefix of WSU namespace
       
    49 	_LIT8( KWsPolicyReference , "PolicyReference");     // Tag name of PolicyReference
       
    50 	_LIT8( KWspOptinal , "wsp:Optional");             // Tag name of Optional Attribute
       
    51 	_LIT8( KWspOptinalTrue , "true");             // Tag name of Optional Attribute TRUE
       
    52 	_LIT8( KWspOptinalFalse , "false");             // Tag name of Optional Attribute FALSE
       
    53 	_LIT8( KWsPolicyNsUri , "http://schemas.xmlsoap.org/ws/2004/09/policy"); // Namespace of WS-Policy
       
    54     
       
    55     _LIT8( KWsuPrefix , "wsu"); // Namespace of WSU	
       
    56 	_LIT8( KWsuNsUri , "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"); // Namespace of WSU
       
    57 	_LIT8( KXmlNsUri , "http://www.w3.org/XML/1998/namespace"); // XML namespace
       
    58 	
       
    59 	_LIT8( KWsuId , "wsu:Id");                       // Prefix ID
       
    60 	_LIT8( KId , "Id");                       // Prefix ID
       
    61 	_LIT8( KName, "Name"); 
       
    62 	_LIT8( KWsSecuritypolicyPrefix , "sp");                    // Prefix of WS-Security Policy namespace
       
    63 	_LIT8( KWsSecurityPolicyNsUri , "http://schemas.xmlsoap.org/ws/2005/07/securitypolicy"); // Namespace of WS-Security Policy
       
    64 	
       
    65 	_LIT8( KUri , "URI");                       // PolicyReference URI
       
    66     }
       
    67 
       
    68 namespace  MSWSPolicy
       
    69 {
       
    70  	_LIT8( KMetaDataValidity, "metadatavalidity");
       
    71 	_LIT8( KMetaDataNsUri, "http://schemas.live.com/mws/2005/08/core");
       
    72 	_LIT8( KExpiry, "Expiry");
       
    73 	_LIT8(KMetaDataLocalName, "MetadataEndpoint");    
       
    74 }
       
    75 
       
    76 
       
    77 /**
       
    78  * Class:   CPolicyNormalizer
       
    79  * Description: This class creates an instance of PolicyNormalizer. The DOM of policy is created by calling ReadL(TDesC8& aXmlDesc) method of the 
       
    80  * class. Then The DOM tree can be normalized as described in WS-Policy specification.
       
    81  */
       
    82 class CPolicyNormalizer : public CSenDomFragment
       
    83     {
       
    84 
       
    85 public:
       
    86     static CPolicyNormalizer* NewL();
       
    87     static CPolicyNormalizer* NewLC();
       
    88     ~CPolicyNormalizer();
       
    89     
       
    90     void ReadFileL(TFileName aPath);
       
    91     TInt ReadL(TDesC8& aXmlDesc);
       
    92     
       
    93     CSenElement* NormalizeL(CPolicyRegistry* aRegistry);
       
    94     CSenElement* NormalizedPolicy() {return  iNewPolicy; }
       
    95 private:       
       
    96 
       
    97     CPolicyNormalizer();
       
    98     void ConstructL();
       
    99     void WriteL(CSenElement* aXml);
       
   100     void WriteAllL(CSenElement* aXml);
       
   101 
       
   102     TBool ValidateElementNsL(CSenElement* aAssertion);
       
   103     TBool IsOptionalL(CSenElement* aAssertion);               //codescannerwarnings
       
   104 
       
   105     CSenElement* ProcessPolicyReferenceL(CSenElement* aPolicy, CPolicyRegistry* aRegistry);
       
   106     TInt ReplacePolicyReferenceL(CSenElement* aReferenceElement, CSenElement* aReferredPolicy);	//codescannerwarnings
       
   107     TPtrC8 GetReferenceUriL(CSenElement* aReference);          //codescannerwarnings
       
   108     
       
   109     CSenElement* ProcessXORTermL(CSenElement* aAssertion, CSenElement* aNormalAssertion);
       
   110     CSenElement* ProcessANDTermL(CSenElement* aAssertion, CSenElement* aNormalAssertion);
       
   111     CSenElement* ProcessPolicyTermL(CSenElement* aAssertion, CSenElement* aNormalAssertion);
       
   112     CSenElement* ProcessAssertionTermL(CSenElement* aAssertion, CSenElement* aNormalAssertion);
       
   113     CSenElement* ProcessOptionalElement(CSenElement* aAssertion, CSenElement* aNormalAssertion);
       
   114     
       
   115     
       
   116     CSenElement* AddAndElementL(CSenElement* aAssertion);
       
   117     CSenElement* AddXorElementL(CSenElement* aAssertion);
       
   118     CSenElement* AddPolicyElementL(CSenElement* aAssertion);
       
   119     
       
   120     CSenElement* CopySenElementL(CSenElement* aSource,CSenElement* aDestination);
       
   121     TBool CopySenElementWithoutOptionL(CSenElement* aSource,CSenElement* aDestination);	//codescannerwarnings
       
   122     
       
   123     CSenElement* ProcessLogicL(CSenElement* aTerm);     //codescannerwarnings
       
   124     CSenElement* ProcessXorCollapseLogicL(CSenElement* aParent, CSenElement* aChild);  //codescannerwarnings
       
   125     CSenElement* ProcessAndCollapseLogic(CSenElement* aParent, CSenElement* aChild);
       
   126     CSenElement* ProcessAndAndLogicL(CSenElement* aFirstTerm, CSenElement* aSecondTerm ); //codescannerwarnings
       
   127     
       
   128     CSenElement* ProcessAssertionBranchingL(CSenElement* aPolicy);    //codescannerwarnings
       
   129     CSenElement* DuplicateAssertionBranchL(CSenElement* aParent, CSenElement* aDuplicatingPolicy);   //codescannerwarnings
       
   130     
       
   131     TInt HasChildL(CSenElement* aTerm);  //codescannerwarnings
       
   132     CSenElement* FindRootAssertionL(CSenElement* aElement);  //codescannerwarnings
       
   133     TBool IsChildOfElement(CSenElement* aParent, CSenElement* aChild);
       
   134     CSenElement* DeleteAsertionIndexL(CSenElement* aAssertion, CSenElement* anewAssertion, TInt aIndx);  //codescannerwarnings
       
   135 
       
   136     HBufC*        iPath;
       
   137     CSenElement* iNewPolicy;
       
   138     RPointerArray<CSenElement> iOrphanElements;
       
   139     TInt count;
       
   140 
       
   141     };
       
   142 #endif // POLICY_NORMALIZER_H
       
   143 // END OF FILE