webservices/wsstar/wsstarplugin/inc/wsstarcobrandingclient.h
changeset 0 62f9d29f7211
equal deleted inserted replaced
-1:000000000000 0:62f9d29f7211
       
     1 /*
       
     2 * Copyright (c) 2009 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:    
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 #ifndef CO_BRANDING_CLIENT_H
       
    22 #define CO_BRANDING_CLIENT_H
       
    23 
       
    24 // INCLUDES
       
    25 #include <e32base.h>
       
    26 #include <flogger.h>
       
    27 #include <e32math.h>
       
    28 
       
    29 #include "wsstarsessionvalidator.h"
       
    30 #include "seninternalserviceconsumer.h"
       
    31 #include "SenXmlElement.h"
       
    32 #include "sentransportbase.h"
       
    33 #include "wsstarhandlercontext.h"
       
    34 
       
    35 
       
    36 
       
    37 /**
       
    38  * Class: CWSStarCoBrandingClient
       
    39  *
       
    40  * Description: Consumer which communicate with real STS.
       
    41  * Client will try obtain credentail based on WS-Trust specification.
       
    42  */
       
    43 class CWSStarCoBrandingClient : public CSenInternalServiceConsumer
       
    44     {
       
    45 public: // Constructors and destructor
       
    46 
       
    47     /**
       
    48     * Standard 2 phase constructor
       
    49     * @param aSIF SIF implementation used in contructor of internal consumer
       
    50     * @param aLogger logger used for logs in debug mode
       
    51     * @return new instance of trust client
       
    52     */
       
    53     static CWSStarCoBrandingClient* NewL(    CSIF& aSIF,
       
    54                                                     RFileLogger& aLogger);
       
    55     /**
       
    56     * Standard 2 phase constructor
       
    57     * @since Series60 4.0
       
    58     * @param aSIF SIF implementation used in contructor of internal consumer
       
    59     * @param aLogger logger used for logs in debug mode
       
    60     * @return new instance of trust client which is pushed into CleanupStack
       
    61     */
       
    62     static CWSStarCoBrandingClient* NewLC(CSIF& aSIF,
       
    63                                                     RFileLogger& aLogger);
       
    64 
       
    65     /**
       
    66     * Normal destructor. Destroy STS session.
       
    67     */
       
    68     ~CWSStarCoBrandingClient();
       
    69     
       
    70     
       
    71     void SetStatus(TInt aStatus);
       
    72     /**
       
    73     * Sets identyProvider for trust client
       
    74     * @param aIdentityProvider identity provider representation of STS
       
    75     */
       
    76     void SetAccount(CSenIdentityProvider* aIdentityProvicer);
       
    77     
       
    78 //-----derived from CSenWSDescription, 
       
    79     //in fact we expose info from stssession which is holded by that client.
       
    80     // Method have to overwrited becouse of core, which use those methods during registering
       
    81     TPtrC8 Endpoint();
       
    82     TPtrC8 Contract();
       
    83     TPtrC8 ProviderID();
       
    84     TPtrC8 FrameworkId();
       
    85     MSenServicePolicy* ServicePolicy();
       
    86     TInt IapId(TUint32& aCurrentIapId);
       
    87     void WriteAsXMLToL(RWriteStream& aWriteStream);
       
    88     
       
    89     /**
       
    90     * Getter for validate session (not STS session)
       
    91     */
       
    92     virtual CSenServiceSession* ServiceSession();
       
    93     
       
    94     /**
       
    95     * Getter for transport (used coreManger as Factory for transport)
       
    96     */
       
    97     virtual MSenTransport& TransportL();
       
    98     
       
    99     /**
       
   100     *   Sets STS session, used during registering STS which is not initiated. 
       
   101     *   Clear STSsession will be created and assign during registering.
       
   102     * @param aSession - clear sts session assign to this trust clint
       
   103     */
       
   104     void SetCoBrandingSessionL(CWSStarServiceSession* aSession);                    
       
   105     
       
   106     /**
       
   107     *   Sets version (mode) for trust client. Old or new trust
       
   108     * @param aVersion - old or new trust version 
       
   109     *   _LIT8( KTrustNamespace200502, "http://schemas.xmlsoap.org/ws/2005/02/trust");
       
   110     *   _LIT8( KTrustNamespace200404, "http://schemas.xmlsoap.org/ws/2004/04/trust");
       
   111     *
       
   112     */
       
   113     void SetHandlerCtx(MSenHandlerContext* aHndCtx);
       
   114     
       
   115     //TBool HasSuperClass( TDescriptionClassType aType );
       
   116 
       
   117     TInt FetchSCTL(CWSStarServiceSession& aSession,
       
   118                    HBufC8*& aErrorMessage);
       
   119         
       
   120 protected://methods
       
   121     
       
   122     /**
       
   123     * C++ default constructor.
       
   124     */
       
   125     CWSStarCoBrandingClient(    CSIF& aSIF,
       
   126                                     TDescriptionClassType aType,
       
   127                                     RFileLogger& aLogger);
       
   128     /**
       
   129     * By default Symbian 2nd phase constructor is private.
       
   130     */
       
   131     void BaseConstructL();
       
   132     virtual TBool Matches(MSenServiceDescription& aPattern);
       
   133     
       
   134 
       
   135 private: //methods
       
   136     //Co-Branding CR
       
   137     CSenElement* CreateFSTL();
       
   138     //Co-Branding CR
       
   139     TInt AdaptCoBrandEndpointL(TBool aToOrginal = EFalse);
       
   140     void AddAppInfoHeaderL();
       
   141 private: // Data
       
   142     CWSStarServiceSession* iWSStarServiceSession;   // Not owned, session which we validate
       
   143     CWSStarServiceSession* iCoBrandingSession;             //STS session, not owned
       
   144     HBufC8* iCoBrandingOrginalEndpoint;             //STS session, owned
       
   145     
       
   146     CSenIdentityProvider* iIdentityProvider; // Not owned, comes from validation phase
       
   147     RFileLogger& iLog;                      //not owned
       
   148     
       
   149     CSenTransportBase* ipTransport;//owned
       
   150     MSenHandlerContext* iHndCtx; //not owned
       
   151     TInt iTpCounter;    
       
   152 };
       
   153 
       
   154 #endif // CO_BRANDING_CLIENT_H
       
   155 
       
   156 // End of File