websrv_pub/web_service_description_api/inc/SenIdentityProvider.h
changeset 0 62f9d29f7211
equal deleted inserted replaced
-1:000000000000 0:62f9d29f7211
       
     1 /*
       
     2 * Copyright (c) 2002-2005 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:        Class describes some IdentityProvider service
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 
       
    23 
       
    24 
       
    25 #ifndef SEN_IDENTITY_PROVIDER_H
       
    26 #define SEN_IDENTITY_PROVIDER_H
       
    27 
       
    28 //  INCLUDES
       
    29 #include <SenXmlServiceDescription.h>
       
    30 
       
    31 // CONSTANTS
       
    32 const TInt KSenAuthMaxUsernameLength = 32;
       
    33 const TInt KSenAuthMaxPasswordLength = 16;
       
    34 
       
    35 _LIT8(KIdentityProvider8, "IdentityProvider"); 	//@depricated
       
    36 _LIT8(KFakeIMEI8, "012345678901234");		//@depricated
       
    37 _LIT8(KContract8, "urn:liberty:as:2004-04");		//@depricated
       
    38 _LIT8(KSenIdpLocalname,                 "IdentityProvider");
       
    39 _LIT8(KSenIdpLibertyIdWsfAsContract,            "urn:liberty:as:2004-04");
       
    40 _LIT8(KWSAtomPubAuthenticationServiceContract,  "urn:atompub:as");
       
    41 _LIT8(KWSOviAuthenticationServiceContract,      "urn:ovi:as");
       
    42 _LIT8(KWSStarSTSContract,                       "urn:wstar:sts");
       
    43 _LIT8(KImei, "IMEI");		//@depricated
       
    44 _LIT8(KType, "type");		//@depricated
       
    45 
       
    46 _LIT8(KAuthzID8, "AuthzID");		//@depricated
       
    47 _LIT8(KAdvisoryAuthnID8, "AdvisoryAuthnID");			//@depricated	
       
    48 _LIT8(KPassword8, "Password");		//@depricated
       
    49 _LIT8(KProviderID8, "ProviderID");		//@depricated
       
    50 _LIT8(KSenIdpAuthzIDLocalname,          "AuthzID");
       
    51 _LIT8(KSenIdpAdvisoryAuthnIdLocalname,  "AdvisoryAuthnID");
       
    52 _LIT8(KSenIdpPasswordLocalname,         "Password");
       
    53 _LIT8(KSenIdpProviderIdLocalname,       "ProviderID");
       
    54 _LIT8(KSenAccountExtensions,            "AccountExtensions");
       
    55 _LIT8(KSenAccAutoSignIn,                "AutoSignIn");
       
    56                 
       
    57 // DATA TYPES
       
    58 class TSenAuthentication
       
    59     {
       
    60     public:
       
    61         TBuf8<KSenAuthMaxUsernameLength> iUsername;
       
    62         TBuf8<KSenAuthMaxPasswordLength> iPassword;
       
    63     };
       
    64 
       
    65 // FORWARD DECLARATIONS
       
    66 class MSenIdentityManager;
       
    67 
       
    68 // CLASS DECLARATION
       
    69 
       
    70 /**
       
    71 *  Class describes some IdentityProvider service
       
    72 *  Class is intented to be used when registrating
       
    73 *  information about some identity providing service.
       
    74 *  In case of ID-WSF framework, the IdentityProvider
       
    75 *  and Authentication Service are behind same endpoint.
       
    76 *  Typically, ID-WSF service consumers call both
       
    77 *  RegisterIdentityProviderL() and 
       
    78 *  RegisterServiceDescriptionL() methods as defined
       
    79 *  in Service Management API (CSenServiceManager).
       
    80 *  Basic Web Service consumers use this class to register
       
    81 *  BASIC-AUTH credentials to certain pre-known service endpoint.
       
    82 *  @lib SenServDesc.lib
       
    83 *  @since Series60 3.0
       
    84 */
       
    85 class CSenIdentityProvider : public CSenXmlServiceDescription
       
    86     {
       
    87     public:  // Constructors and destructor
       
    88         
       
    89         /**
       
    90         * Two-phased constructor.
       
    91         * Note: contract defaults here to "urn:liberty:as:2004-04"
       
    92         * @since Series60 3.0
       
    93         * @param aEndpoint the service endpoint. Note that endpoint cannot 
       
    94         *        include characters which are illegal in XML. If endpoint
       
    95         *        is an URL which contains illegal characters (like '&'-char),
       
    96         *        those need to be encoded into XML entity form (like &amp;).
       
    97         *        EncodeHttpCharactersLC() method from XmlUtils can be used
       
    98         *        for encoding of basic XML entities.
       
    99         * @return a new CSenIdentityProvider
       
   100         */
       
   101         IMPORT_C static CSenIdentityProvider* NewL( const TDesC8& aEndpoint );
       
   102 
       
   103         /**
       
   104         * Two-phased constructor.
       
   105         * Note: contract defaults here to "urn:liberty:as:2004-04"
       
   106         * @since Series60 3.0
       
   107         * @param aEndpoint the service endpoint. Note that endpoint cannot 
       
   108         *        include characters which are illegal in XML. If endpoint
       
   109         *        is an URL which contains illegal characters (like '&'-char),
       
   110         *        those need to be encoded into XML entity form (like &amp;).
       
   111         *        EncodeHttpCharactersLC() method from XmlUtils can be used
       
   112         *        for encoding of basic XML entities.
       
   113         * @return a new CSenIdentityProvider, which pointer is left on
       
   114         *         cleanup stack.
       
   115         */
       
   116         IMPORT_C static CSenIdentityProvider* NewLC( const TDesC8& aEndpoint );
       
   117 
       
   118         /**
       
   119         * Two-phased constructor.
       
   120         * @since Series60 3.0
       
   121         * @param aEndpoint the service endpoint. Note that endpoint cannot 
       
   122         *        include characters which are illegal in XML. If endpoint
       
   123         *        is an URL which contains illegal characters (like '&'-char),
       
   124         *        those need to be encoded into XML entity form (like &amp;).
       
   125         *        EncodeHttpCharactersLC() method from XmlUtils can be used
       
   126         *        for encoding of basic XML entities.
       
   127         * @param aContract identifies the service type. Typically some URN.
       
   128         *        Default is Liberty ID-WSF Authentication Service contract:
       
   129         *        -- urn:liberty:as:2004-04
       
   130         * @return a new CSenIdentityProvider
       
   131         */
       
   132         IMPORT_C static CSenIdentityProvider* NewL( const TDesC8& aEndpoint,
       
   133                                                     const TDesC8& aContract );
       
   134 
       
   135         /**
       
   136         * Two-phased constructor.
       
   137         * @since Series60 3.0
       
   138         * @param aEndpoint the service endpoint. Note that endpoint cannot 
       
   139         *        include characters which are illegal in XML. If endpoint
       
   140         *        is an URL which contains illegal characters (like '&'-char),
       
   141         *        those need to be encoded into XML entity form (like &amp;).
       
   142         *        EncodeHttpCharactersLC() method from XmlUtils can be used
       
   143         *        for encoding of basic XML entities.
       
   144         * @param aContract identifies the service type. Typically some URN.
       
   145         *        Default is Liberty ID-WSF Authentication Service contract:
       
   146         *        -- urn:liberty:as:2004-04
       
   147         * @return a new CSenIdentityProvider, which pointer is left on
       
   148         *         cleanup stack.
       
   149         */
       
   150         IMPORT_C static CSenIdentityProvider* NewLC(const TDesC8& aEndpoint,
       
   151                                                     const TDesC8& aContract );
       
   152         
       
   153         /**
       
   154         * Two-phased constructor.
       
   155         * @since Series60 3.0
       
   156         * @param aEndpoint the service endpoint. Note that endpoint cannot 
       
   157         *        include characters which are illegal in XML. If endpoint
       
   158         *        is an URL which contains illegal characters (like '&'-char),
       
   159         *        those need to be encoded into XML entity form (like &amp;).
       
   160         *        EncodeHttpCharactersLC() method from XmlUtils can be used
       
   161         *        for encoding of basic XML entities.
       
   162         * @param aContract identifies the service type. Typically some URN.
       
   163         *        Default is Liberty ID-WSF Authentication Service contract:
       
   164         *        -- urn:liberty:as:2004-04
       
   165         * @param aProviderID is identifier of this IdentityProvider. It is a
       
   166         *        unique key pointing to some known endpoint.
       
   167         * @return a new CSenIdentityProvider
       
   168         */
       
   169         IMPORT_C static CSenIdentityProvider* NewL( const TDesC8& aEndpoint,
       
   170                                                     const TDesC8& aContract,
       
   171                                                     const TDesC8& aProviderID);
       
   172 
       
   173         /**
       
   174         * Two-phased constructor.
       
   175         * @since Series60 3.0
       
   176         * @param aEndpoint the service endpoint. Note that endpoint cannot 
       
   177         *        include characters which are illegal in XML. If endpoint
       
   178         *        is an URL which contains illegal characters (like '&'-char),
       
   179         *        those need to be encoded into XML entity form (like &amp;).
       
   180         *        EncodeHttpCharactersLC() method from XmlUtils can be used
       
   181         *        for encoding of basic XML entities.
       
   182         * @param aContract identifies the service type. Typically some URN.
       
   183         *        Default is Liberty ID-WSF Authentication Service contract:
       
   184         *        -- urn:liberty:as:2004-04
       
   185         * @param aProviderID is identifier of this IdentityProvider. It is a
       
   186         *        unique key pointing to some known endpoint. Required only
       
   187         *        for ID-WSF framework.
       
   188         * @return a new CSenIdentityProvider, which pointer is left on
       
   189         *         cleanup stack.
       
   190         */
       
   191         IMPORT_C static CSenIdentityProvider* NewLC(const TDesC8& aEndpoint,
       
   192                                                     const TDesC8& aContract,
       
   193                                                     const TDesC8& aProviderID);
       
   194 
       
   195         /**
       
   196         * Two-phased constructor.
       
   197         * @since Series60 3.0
       
   198         * @param aEndpoint the service endpoint. Note that endpoint cannot 
       
   199         *        include characters which are illegal in XML. If endpoint
       
   200         *        is an URL which contains illegal characters (like '&'-char),
       
   201         *        those need to be encoded into XML entity form (like &amp;).
       
   202         *        EncodeHttpCharactersLC() method from XmlUtils can be used
       
   203         *        for encoding of basic XML entities.
       
   204         * @param aContract identifies the service type. Typically some URN.
       
   205         *        Default is Liberty ID-WSF Authentication Service contract:
       
   206         *        -- urn:liberty:as:2004-04
       
   207         * @param aProviderID is identifier of this IdentityProvider. It is a
       
   208         *        unique key pointing to some known endpoint. Required only
       
   209         *        for ID-WSF framework.
       
   210         * @param aServiceID is a unique contract to some invocable service.
       
   211         *        Typically some URN. If this IDP is registered to ID-WSF 
       
   212         *        framework, this ServiceID will be appended into list of
       
   213         *        services which trust this IDP, and the actual IDP "knows".
       
   214         * @return a new CSenIdentityProvider
       
   215         */
       
   216         IMPORT_C static CSenIdentityProvider* NewL( const TDesC8& aEndpoint,
       
   217                                                     const TDesC8& aContract,
       
   218                                                     const TDesC8& aProviderID,
       
   219                                                     const TDesC8& aServiceID);
       
   220 
       
   221         /**
       
   222         * Two-phased constructor.
       
   223         * @since Series60 3.0
       
   224         * @param aEndpoint the service endpoint. Note that endpoint cannot 
       
   225         *        include characters which are illegal in XML. If endpoint
       
   226         *        is an URL which contains illegal characters (like '&'-char),
       
   227         *        those need to be encoded into XML entity form (like &amp;).
       
   228         *        EncodeHttpCharactersLC() method from XmlUtils can be used
       
   229         *        for encoding of basic XML entities.
       
   230         * @param aProviderID is identifier of this IdentityProvider. It is a
       
   231         *        unique key pointing to some known endpoint. Required only
       
   232         *        for ID-WSF framework.
       
   233         * @param aContract identifies the service type. Typically some URN.
       
   234         *        Default is Liberty ID-WSF Authentication Service contract:
       
   235         *        -- urn:liberty:as:2004-04
       
   236         * @param aServiceID is a unique contract to some invocable service.
       
   237         *        Typically some URN. If this IDP is registered to ID-WSF 
       
   238         *        framework, this ServiceID will be appended into list of
       
   239         *        services which trust this IDP, and the actual IDP "knows".
       
   240         * @return a new CSenIdentityProvider, which pointer is left on
       
   241         *         cleanup stack.
       
   242         */
       
   243         IMPORT_C static CSenIdentityProvider* NewLC(const TDesC8& aEndpoint,
       
   244                                                     const TDesC8& aContract,
       
   245                                                     const TDesC8& aProviderID,
       
   246                                                     const TDesC8& aServiceID);
       
   247 
       
   248         /**
       
   249         * Destructor.
       
   250         */
       
   251         IMPORT_C virtual ~CSenIdentityProvider();
       
   252 
       
   253         // New functions
       
   254 
       
   255         /**
       
   256         * A getter.
       
   257         * @since Series60 3.0
       
   258         * @return a pointer to authorization id
       
   259         */
       
   260         IMPORT_C virtual TPtrC8 AuthzID();
       
   261 
       
   262         /**
       
   263         * A getter.
       
   264         * @since Series60 3.0
       
   265         * @return a pointer to advisory authentication id
       
   266         */
       
   267         IMPORT_C virtual TPtrC8 AdvisoryAuthnID();
       
   268 
       
   269         /**
       
   270         * A getter.
       
   271         * @since Series60 3.0
       
   272         * @return a pointer to provider id
       
   273         */
       
   274         IMPORT_C TPtrC8 ProviderID();
       
   275 
       
   276         /**
       
   277         * A getter.
       
   278         * @since Series60 3.0
       
   279         * @return a pointer to password
       
   280         */
       
   281         IMPORT_C virtual TPtrC8 Password();
       
   282 
       
   283         /**
       
   284         * A getter.
       
   285         * @since Series60 3.0
       
   286         * @return a pointer to IMEI
       
   287         */
       
   288         IMPORT_C const TDesC8& IMEI();
       
   289 
       
   290         /**
       
   291         * A getter.
       
   292         * @since Series60 3.0
       
   293         * @return a pointer to username
       
   294         */
       
   295         IMPORT_C TPtrC8 UserName();
       
   296 
       
   297         /**
       
   298         * Setter
       
   299         * @since Series60 3.0
       
   300         * @param aProviderID the set id
       
   301         * @return KErrNone or other system-wide Symbian error codes.
       
   302         */
       
   303         IMPORT_C TInt SetProviderID( const TDesC8& aProviderID );
       
   304 
       
   305         /**
       
   306         * Setter for ServiceID. ServiceID is the contract of some
       
   307         * invocable service, typically some URN.
       
   308         * Note, that when registering an IDP the possibly existing
       
   309         * list of ServiceIDs is not cleared, but the ServiceID set
       
   310         * via this method is added as new entry into that list, if
       
   311         * it was non-existent.
       
   312         * @since Series60 3.0
       
   313         * @param aServiceID the set id
       
   314         * @return KErrNone or other system-wide Symbian error codes.
       
   315         */
       
   316         IMPORT_C TInt SetServiceID( const TDesC8& aServiceID );
       
   317 
       
   318         /**
       
   319         * @since Series60 3.0
       
   320         * @param aServiceDescription the service description to check
       
   321         * @return   ETrue if the ServiceDescription, i.e. its endpoint
       
   322         *                 or contract, is associated to this IdentityProvider.
       
   323         *                 Or if the ServiceDescription is about this
       
   324         *                 IdentityProvider.
       
   325         *           EFalse otherwise
       
   326         */
       
   327         IMPORT_C TBool IsTrustedByL( MSenServiceDescription& aServiceDescription );
       
   328 
       
   329         /**
       
   330         * @since Series60 3.0
       
   331         * @param aProviderIdOrServiceId    IdentityProvider ID, or Service ID
       
   332         *                 which is being checked. Service ID is typically URI
       
   333         *                 (service contract or service endpoint).
       
   334         * @return   ETrue if the ServiceDescription, i.e. its endpoint
       
   335         *                 or contract, is associated to this IdentityProvider.
       
   336         *                 Or if the ServiceDescription is about this
       
   337         *                 IdentityProvider.
       
   338         *           EFalse otherwise
       
   339         */
       
   340         IMPORT_C TBool IsTrustedByL( const TDesC8& aProviderIdOrServiceId );
       
   341 
       
   342         /**
       
   343         * Checks if this identity provider is set as default .
       
   344         * @since Series60 3.0
       
   345         * @return ETrue if default-attribute was set, EFalse otherwise
       
   346         */
       
   347         IMPORT_C TBool IsDefault();
       
   348 
       
   349         /**
       
   350         * Sets the user information.
       
   351         *   Status codes:
       
   352         *   KErrNone        ok
       
   353         *   Other codes are system error codes.
       
   354         * @since Series60 3.0
       
   355         * @param aAuthzID Authorization id.
       
   356         * @param aAdvisoryAuthnID Advisory authorization id.
       
   357         * @param aPassword Password.
       
   358         * @return status/error code.
       
   359         */
       
   360         IMPORT_C TInt SetUserInfoL( const TDesC8& aAuthzID,
       
   361                                     const TDesC8& aAdvisoryAuthnID,
       
   362                                     const TDesC8& aPassword );
       
   363 
       
   364         /**
       
   365         * @deprecated. This method is no longer in use.
       
   366         * Creates http-credentials by making password-username pair 
       
   367         * and encoding it with BASE-64.
       
   368         * @since Series60 3.0
       
   369         * @param    aIdMgr  Identitymanager which is used to obtain a password
       
   370         *                   if no password for this identityprovider was set.
       
   371         * @return   a newly allocated credentialbuffer. Ownership is transferred 
       
   372         *           to the caller.
       
   373         */
       
   374         IMPORT_C HBufC8* HttpCredentialsL( MSenIdentityManager& aIdMgr );
       
   375     
       
   376         // Functions from base classes
       
   377     
       
   378         // From CSenXmlServiceDescription
       
   379         
       
   380         /**
       
   381         * @since Series60 3.0
       
   382         * @return Descriptor containing service description local name
       
   383         *                    for this service description.
       
   384         *                    This is the localname of the element, when this class is
       
   385         *                    represented as an XML element. 
       
   386         */
       
   387         IMPORT_C const TDesC8& NewElementName();
       
   388 
       
   389         /**
       
   390         * Setter for (identity) provider ID (leaving variant)
       
   391         * @since Series60 4.0
       
   392         * @param aProviderID the unique identifier of the (identity) provider
       
   393         * @return KErrNone on success, KErrArgument if aProviderID is a
       
   394         * zero-length descriptor, or one of the system-wide error codes
       
   395         * otherwise.
       
   396         */
       
   397         IMPORT_C TInt SetProviderIdL( const TDesC8& aProviderID );
       
   398         
       
   399         IMPORT_C TInt SetAccountExtensionsL(const TDesC8& aDetail);
       
   400         
       
   401         IMPORT_C TPtrC8 AccountExtensions(CSenElement*& aAccExt);
       
   402 
       
   403     protected:  
       
   404     
       
   405         /*
       
   406           C++ default constructor
       
   407         */
       
   408         IMPORT_C CSenIdentityProvider( TDescriptionClassType aType );
       
   409         
       
   410 
       
   411         // Functions from base classes
       
   412     
       
   413         // From CSenXmlServiceDescription
       
   414         
       
   415         /**
       
   416         * Standard 2nd phase constructor.   
       
   417         * @since Series60 3.0
       
   418         * @param aEndpoint the service endpoint. Note that endpoint cannot 
       
   419         *        include characters which are illegal in XML. If endpoint
       
   420         *        is an URL which contains illegal characters (like '&'-char),
       
   421         *        those need to be encoded into XML entity form (like &amp;).
       
   422         *        EncodeHttpCharactersLC() method from XmlUtils can be used
       
   423         *        for encoding of basic XML entities.
       
   424         */
       
   425         IMPORT_C void ConstructL(const TDesC8& aEndPoint);
       
   426         
       
   427         /**
       
   428         * @since Series60 3.0
       
   429         * @param aEndpoint the service endpoint. Note that endpoint cannot 
       
   430         *        include characters which are illegal in XML. If endpoint
       
   431         *        is an URL which contains illegal characters (like '&'-char),
       
   432         *        those need to be encoded into XML entity form (like &amp;).
       
   433         *        EncodeHttpCharactersLC() method from XmlUtils can be used
       
   434         *        for encoding of basic XML entities.
       
   435         * @param aContract identifies the service type. Typically some URN.
       
   436         *        Default contract is Liberty ID-WSF Authentication Service
       
   437         *        - "urn:liberty:as:2004-04".
       
   438         */
       
   439         IMPORT_C void ConstructL(const TDesC8& aEndPoint,
       
   440                                  const TDesC8& aContract);
       
   441 
       
   442         /**
       
   443         * @since Series60 3.0
       
   444         * @param aEndpoint the service endpoint. Note that endpoint cannot 
       
   445         *        include characters which are illegal in XML. If endpoint
       
   446         *        is an URL which contains illegal characters (like '&'-char),
       
   447         *        those need to be encoded into XML entity form (like &amp;).
       
   448         *        EncodeHttpCharactersLC() method from XmlUtils can be used
       
   449         *        for encoding of basic XML entities.
       
   450         * @param aContract identifies the service type. Typically some URN.
       
   451         *        Default contract is Liberty ID-WSF Authentication Service
       
   452         *        - "urn:liberty:as:2004-04".
       
   453         * @param aProviderID is identifier of this IdentityProvider. It is a
       
   454         *        unique key pointing to some known endpoint. Required only
       
   455         *        for ID-WSF framework.
       
   456         */
       
   457         IMPORT_C void ConstructL(const TDesC8& aEndPoint,
       
   458                                  const TDesC8& aContract,
       
   459                                  const TDesC8& aProviderID);
       
   460 
       
   461         /**
       
   462         * @since Series60 3.0
       
   463         * @param aEndpoint the service endpoint. Note that endpoint cannot 
       
   464         *        include characters which are illegal in XML. If endpoint
       
   465         *        is an URL which contains illegal characters (like '&'-char),
       
   466         *        those need to be encoded into XML entity form (like &amp;).
       
   467         *        EncodeHttpCharactersLC() method from XmlUtils can be used
       
   468         *        for encoding of basic XML entities.
       
   469         * @param aContract identifies the service type. Typically some URN.
       
   470         *        Default contract is Liberty ID-WSF Authentication Service
       
   471         *        - "urn:liberty:as:2004-04".
       
   472         * @param aProviderID is identifier of this IdentityProvider. It is a
       
   473         *        unique key pointing to some known endpoint. Required only
       
   474         *        for ID-WSF framework.
       
   475         * @param aServiceID is a unique contract to some invocable service.
       
   476         *        Typically some URN. If this IDP is registered to ID-WSF 
       
   477         *        framework, this ServiceID will be appended into list of
       
   478         *        services which trust this IDP, and the actual IDP "knows".
       
   479         */
       
   480         IMPORT_C void ConstructL( const TDesC8& aEndPoint,
       
   481                                   const TDesC8& aContract,
       
   482                                   const TDesC8& aProviderID,
       
   483                                   const TDesC8& aServiceID );
       
   484     };
       
   485 
       
   486 #endif // SEN_IDENTITY_PROVIDER_H
       
   487 
       
   488 // End of File