webservices/wsstar/wsstarplugin/inc/wsstarpolicy.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 
       
    26  
       
    27 
       
    28 #ifndef WS_STAR_POLICY_H
       
    29 #define WS_STAR_POLICY_H
       
    30 
       
    31 // INCLUDES
       
    32 #include <e32std.h>
       
    33 #include "MSenServiceDescription.h"
       
    34 #include "wsstarservicesession.h"
       
    35 #include "MSenServicePolicy.h"
       
    36 // CONSTANTS
       
    37 namespace WSPolicy
       
    38     {
       
    39     // Common
       
    40     
       
    41     // Enveloper layer
       
    42     _LIT8( KSoap12, "SOAP12");
       
    43     
       
    44     // Addressing layer
       
    45     _LIT8( KAddressing, "Addressing");
       
    46 
       
    47     // Trust layer
       
    48     _LIT8( KClientEntropy , "ClientEntropy");
       
    49     _LIT8( KTokenType,          "TokenType");
       
    50     _LIT8( KPassportExtensions , "PassportExtensions");
       
    51     // Way of authentication with STS
       
    52     _LIT8( KUsernameTokenOverTLS , "UsernameTokenOverTLS");
       
    53     _LIT8( KSAMLTokenTypeValue, "http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV1.1");
       
    54     
       
    55     // Serializer layer
       
    56     _LIT8( KMTOM , "MTOM");
       
    57     _LIT8( KCluster, "Cluster");
       
    58     
       
    59     _LIT8(KIssuedToken, "IssuedToken");
       
    60     _LIT8( KRPSCluster, "RPSCluster");
       
    61     _LIT8(KRequestSecurityTokenTemplate, "RequestSecurityTokenTemplate");
       
    62     _LIT8(KAddress, "Address");
       
    63     
       
    64     _LIT8(KSignedParts, "SignedParts");
       
    65     _LIT8(KName, "Name");
       
    66     _LIT8(KDictionaries, "Dictionaries");
       
    67     _LIT8(KDictionary, "Dictionary");
       
    68     _LIT8(KMobileService, "MobileService");
       
    69     _LIT8(KMwsType, "mws:Type");
       
    70     _LIT8(KMwsId, "mws:Id");
       
    71     _LIT8( KAppInfo,"AppInfo" );
       
    72     _LIT8( KClientPolicy,"ClientPolicy" );
       
    73     }
       
    74 
       
    75 
       
    76 /**
       
    77  * Class:       
       
    78  */
       
    79 class CWSStarPolicy : public CBase
       
    80     {
       
    81     public:
       
    82         /*
       
    83         static CWSStarPolicy* NewL();
       
    84         static CWSStarPolicy* NewLC();
       
    85         ~CWSStarPolicy();
       
    86         void SetPolicy(CSenElement* aPolicy);
       
    87         */
       
    88 
       
    89         /**
       
    90         *   static TBool CheckL(const TDesC8& aKey, MSenServiceDescription* aSD);
       
    91         *   
       
    92         *   This method can be used to find the Client policy elements.
       
    93         *   it simply try to find an element in the policy and if the element is found
       
    94         *   then return the ETrue else EFalse.
       
    95         *   @param: aKey is the name of property/element 
       
    96         *   @param: aSD, The ServiceDescription from which this element should be checked
       
    97 
       
    98         *   @return TBool
       
    99         */
       
   100         static TBool CheckPolicyValueL(const TDesC8& aKey, MSenServiceDescription* aSD);
       
   101 
       
   102             
       
   103         /**
       
   104         *   static HBufC8* GetValueL(const TDesC8& aKey, MSenServiceDescription* aSD);
       
   105         *   
       
   106         *   This method can be used to find the Client policy elements and their properties.
       
   107         *   It simply try to find an element in the policy and if the element is found
       
   108         *   then return the Element's contents.
       
   109         *   
       
   110         *   @param: aKey is the name of property/element 
       
   111         *   @param: aSD, The ServiceDescription from which this element should be checked
       
   112         *   
       
   113         *   @return HBufC*: Ownership is transferred
       
   114         */
       
   115 
       
   116 
       
   117         static HBufC8* GetPolicyValueL(const TDesC8& aKey, MSenServiceDescription* aSD);
       
   118         /**
       
   119         *   static HBufC8* GetValueL(const TDesC8& aKey, const TDesC8& aSubKey, MSenHandlerContext& aCtx);
       
   120         *   
       
   121         *   This method can be used to find the "Service Policy" assertions and their properties.
       
   122         *   It simply try to find an element in the Policy and if the element is found
       
   123         *   then return the Element's contents. If element has no contents then return the whole Element
       
   124         *   excluding the element name 
       
   125         *   
       
   126         *   @param: aKey is the name of property/element 
       
   127         *   @param: aSubKey is the name of property/element present in "aKey" Element
       
   128         *   @param: aCtx, The Context of PolicyHanlder which owns the Policy
       
   129         *   
       
   130         *   @return HBufC*: Ownership is transferred
       
   131         */    
       
   132         static HBufC8* GetPolicyValueL(const TDesC8& aKey, const TDesC8& aSubKey, MSenHandlerContext& aCtx, MSenServiceDescription* aSD);
       
   133         static HBufC8* GetPolicyValueL(const TDesC8& aTokenType, const TDesC8& aKey, const TDesC8& aSubKey, MSenHandlerContext& aCtx, MSenServiceDescription* aSD, RPointerArray<CSenElement>& aElements);
       
   134         static HBufC8* GetPolicyValueL(const TDesC8& aTokenType, const TDesC8& aKey, const TDesC8& aSubKey, MSenHandlerContext& aCtx, MSenServiceDescription* aSD);
       
   135         static HBufC8* GetPolicyValueL(const TDesC8& aKey, const TDesC8& aSubKey, MSenHandlerContext& aCtx, MSenServiceDescription* aSD, RPointerArray<CSenElement>& aElements);
       
   136         static HBufC8* GetPolicyValueL(const TDesC8& aKey, const TDesC8& aSubKey, CWSStarPlugin& aWSStarPlugin, MSenServiceDescription* aSD);
       
   137         /**
       
   138         *   static void GetValueL(const TDesC8& aKey, const TDesC8& aSubKey, MSenHandlerContext& aCtx, RArray<TPtrC8>& aList);
       
   139         *   
       
   140         *   This method can be used to find the "Service Policy" assertions and their properties.
       
   141         *   It simply try to find an element in the Policy and if the element is found
       
   142         *   then return the Element's contents in form of list
       
   143         *   
       
   144         *   @param: aKey is the name of property/element 
       
   145         *   @param: aSubKey is the name of property/element present in "aKey" Element
       
   146         *   @param: aCtx, The Context of PolicyHanlder which owns the Policy
       
   147         *   @param: aList, The list of properties for which the Elements will be searched
       
   148         *   one example of this method is to get the list of SignedElements/EncryptedElements  
       
   149         */    
       
   150 
       
   151 
       
   152         static void GetPolicyValueL(const TDesC8& aKey, const TDesC8& aSubKey, MSenHandlerContext& aCtx, MSenServiceDescription* aSD, RPointerArray<HBufC8>& aList);
       
   153         
       
   154         
       
   155         /**
       
   156         *   static void GetValueL(const TDesC8& aKey, const TDesC8& aSubKey, MSenHandlerContext& aCtx, RArray<TPtrC8>& aList);
       
   157         *   
       
   158         *   This method can be used to find the "Service Policy" assertions and their properties.
       
   159         *   It simply try to find an element in the Policy and if the element is found
       
   160         *   then return the Element's contents in form of list
       
   161         *   
       
   162         *   @param: aKey is the name of property/element 
       
   163         *   @param: aSubKey is the name of property/element present in "aKey" Element
       
   164         *   @param: aPolicyHandler, PolicyHanlder which owns the Policy
       
   165         *   @param: aList, The list of properties for which the Elements will be searched
       
   166         *
       
   167         *   one example of this method is to get the list of SignedElements/EncryptedElements  
       
   168         *   Attetntion: in case (signed/encrypted elements) array is list of pairs [localname, namespace]
       
   169         */    
       
   170         
       
   171         static void GetPolicyValueL(const TDesC8& aKey, const TDesC8& aSubKey, CWSStarPolicyHandler* aPolicyHandler, MSenServiceDescription* aSD, RPointerArray<HBufC8>& aList);
       
   172         
       
   173         
       
   174         /**
       
   175         *   static TPtrC8 GetAttributeValueL(const TDesC8& aAttribute, CSenElement* aElement);
       
   176         *   
       
   177         *   This method can be used to find the attribute value of an Attibute from any Elements
       
   178         *   It simply try to find the attribute in an element and then return the value of the Attirbute
       
   179         *   
       
   180         *   @param: aAttribute is the name of property
       
   181         *   @param: aElement is the element where the attribute will eb searched
       
   182         *   
       
   183         *   @return TPtrC8: return pointer to the Value of attribute
       
   184         *                    KNullDesC8() if no value is found   
       
   185         */    
       
   186 
       
   187 
       
   188         static TPtrC8 GetAttributeValueL(const TDesC8& aAttribute, CSenElement* aElement);
       
   189         /**
       
   190         *   static TPtrC8 GetNSPrefixL(const TDesC8& aNamespaceUri, CSenElement* aElement);
       
   191         *   
       
   192         *   This method can be used to find the namespace prefix for a namespace URi from the element
       
   193         *   
       
   194         *   @param: aNamespaceUri is the nameSpace URI
       
   195         *   @param: aElement is the element where the NsURI will be searched
       
   196         *   
       
   197         *   @return TPtrC8: return pointer to the Prefix of namespace URI
       
   198         *                    KNullDesC8() if no value is found   
       
   199         */    
       
   200 
       
   201         static TPtrC8 GetNSPrefixL(const TDesC8& aNamespaceUri, CSenElement* aElement);
       
   202         static CSenElement* SearchForElementL(CSenElement* aPolicy, TPtrC8 aKey);	//codescannerwarnings
       
   203         static TInt SearchForElementsL(CSenElement* aPolicy, TPtrC8 aKey, RPointerArray<CSenElement>& aElements);
       
   204         static CSenElement* GetElementL(const TDesC8& aKey, const TDesC8& aSubKey, MSenHandlerContext& aCtx, MSenServiceDescription* aSD);
       
   205         static void GetPolicyValueL(const TDesC8& aKey, const TDesC8& aSubKey,MSenServiceDescription* aSD,RPointerArray<CSenElement>& aElements);
       
   206 
       
   207         
       
   208     protected:
       
   209         static TInt ChildCountL(CSenElement* aTerm);	//codescannerwarnings
       
   210         
       
   211         
       
   212         static CSenElement* GetPolicyL(MSenHandlerContext& aCtx, MSenServiceDescription* aSD);	//codescannerwarnings
       
   213 
       
   214     private:
       
   215         /**
       
   216         * Hide default C++ constructor.
       
   217         */
       
   218         CWSStarPolicy() { }
       
   219 
       
   220         /**
       
   221         * Prohibit copy constructor if not deriving from CBase.
       
   222         */
       
   223         CWSStarPolicy( const CWSStarPolicy& );
       
   224 
       
   225         /**
       
   226         * Prohibit assignment operator if not deriving from CBase.
       
   227         */
       
   228         CWSStarPolicy& operator=( const CWSStarPolicy& );
       
   229         
       
   230         static void GetValueL(const TDesC8& aKey, const TDesC8& aSubKey, CSenElement* aPolicy, RPointerArray<HBufC8>& aList);
       
   231 
       
   232     };
       
   233     
       
   234     
       
   235 struct SoapHeader
       
   236     {
       
   237 	TPtrC8 iName;
       
   238 	TPtrC8 iNsUri;
       
   239 	TPtrC8 iNsPrefix;
       
   240     };
       
   241 
       
   242 class CEncryptedSignedPartsI : public CBase
       
   243     {
       
   244     public:
       
   245         static CEncryptedSignedPartsI* NewL(CSenElement* aAssertion);
       
   246         static CEncryptedSignedPartsI* NewLC(CSenElement*  aAssertion);
       
   247         virtual ~CEncryptedSignedPartsI();
       
   248 
       
   249         TBool IsEqualEncryptedSignedParts(CEncryptedSignedPartsI* aAssertion);
       
   250         
       
   251         void  ElementsL(RPointerArray<HBufC8>& aElements);	//codescannerwarnings
       
   252         TBool Header();
       
   253         TBool Body();
       
   254     private:
       
   255         void ConstructL(CSenElement*  aAssertion);
       
   256         CEncryptedSignedPartsI(); 
       
   257 
       
   258     private: // Data
       
   259         TBool iHeader;
       
   260         TBool iBody;
       
   261         RArray<SoapHeader> iHeaders;  
       
   262         
       
   263     };
       
   264 #endif // WS_STAR_POLICY_H
       
   265 
       
   266 // END OF FILE
       
   267 
       
   268