1.1 --- a/epoc32/include/mw/senidentityprovider.h Tue Nov 24 13:55:44 2009 +0000
1.2 +++ b/epoc32/include/mw/senidentityprovider.h Tue Mar 16 16:12:26 2010 +0000
1.3 @@ -1,1 +1,488 @@
1.4 -senidentityprovider.h
1.5 +/*
1.6 +* Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies).
1.7 +* All rights reserved.
1.8 +* This component and the accompanying materials are made available
1.9 +* under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
1.10 +* which accompanies this distribution, and is available
1.11 +* at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
1.12 +*
1.13 +* Initial Contributors:
1.14 +* Nokia Corporation - initial contribution.
1.15 +*
1.16 +* Contributors:
1.17 +*
1.18 +* Description: Class describes some IdentityProvider service
1.19 +*
1.20 +*/
1.21 +
1.22 +
1.23 +
1.24 +
1.25 +
1.26 +
1.27 +
1.28 +
1.29 +#ifndef SEN_IDENTITY_PROVIDER_H
1.30 +#define SEN_IDENTITY_PROVIDER_H
1.31 +
1.32 +// INCLUDES
1.33 +#include <SenXmlServiceDescription.h>
1.34 +
1.35 +// CONSTANTS
1.36 +const TInt KSenAuthMaxUsernameLength = 32;
1.37 +const TInt KSenAuthMaxPasswordLength = 16;
1.38 +
1.39 +_LIT8(KIdentityProvider8, "IdentityProvider"); //@depricated
1.40 +_LIT8(KFakeIMEI8, "012345678901234"); //@depricated
1.41 +_LIT8(KContract8, "urn:liberty:as:2004-04"); //@depricated
1.42 +_LIT8(KSenIdpLocalname, "IdentityProvider");
1.43 +_LIT8(KSenIdpLibertyIdWsfAsContract, "urn:liberty:as:2004-04");
1.44 +_LIT8(KWSAtomPubAuthenticationServiceContract, "urn:atompub:as");
1.45 +_LIT8(KWSOviAuthenticationServiceContract, "urn:ovi:as");
1.46 +_LIT8(KWSStarSTSContract, "urn:wstar:sts");
1.47 +_LIT8(KImei, "IMEI"); //@depricated
1.48 +_LIT8(KType, "type"); //@depricated
1.49 +
1.50 +_LIT8(KAuthzID8, "AuthzID"); //@depricated
1.51 +_LIT8(KAdvisoryAuthnID8, "AdvisoryAuthnID"); //@depricated
1.52 +_LIT8(KPassword8, "Password"); //@depricated
1.53 +_LIT8(KProviderID8, "ProviderID"); //@depricated
1.54 +_LIT8(KSenIdpAuthzIDLocalname, "AuthzID");
1.55 +_LIT8(KSenIdpAdvisoryAuthnIdLocalname, "AdvisoryAuthnID");
1.56 +_LIT8(KSenIdpPasswordLocalname, "Password");
1.57 +_LIT8(KSenIdpProviderIdLocalname, "ProviderID");
1.58 +_LIT8(KSenAccountExtensions, "AccountExtensions");
1.59 +_LIT8(KSenAccAutoSignIn, "AutoSignIn");
1.60 +
1.61 +// DATA TYPES
1.62 +class TSenAuthentication
1.63 + {
1.64 + public:
1.65 + TBuf8<KSenAuthMaxUsernameLength> iUsername;
1.66 + TBuf8<KSenAuthMaxPasswordLength> iPassword;
1.67 + };
1.68 +
1.69 +// FORWARD DECLARATIONS
1.70 +class MSenIdentityManager;
1.71 +
1.72 +// CLASS DECLARATION
1.73 +
1.74 +/**
1.75 +* Class describes some IdentityProvider service
1.76 +* Class is intented to be used when registrating
1.77 +* information about some identity providing service.
1.78 +* In case of ID-WSF framework, the IdentityProvider
1.79 +* and Authentication Service are behind same endpoint.
1.80 +* Typically, ID-WSF service consumers call both
1.81 +* RegisterIdentityProviderL() and
1.82 +* RegisterServiceDescriptionL() methods as defined
1.83 +* in Service Management API (CSenServiceManager).
1.84 +* Basic Web Service consumers use this class to register
1.85 +* BASIC-AUTH credentials to certain pre-known service endpoint.
1.86 +* @lib SenServDesc.lib
1.87 +* @since Series60 3.0
1.88 +*/
1.89 +class CSenIdentityProvider : public CSenXmlServiceDescription
1.90 + {
1.91 + public: // Constructors and destructor
1.92 +
1.93 + /**
1.94 + * Two-phased constructor.
1.95 + * Note: contract defaults here to "urn:liberty:as:2004-04"
1.96 + * @since Series60 3.0
1.97 + * @param aEndpoint the service endpoint. Note that endpoint cannot
1.98 + * include characters which are illegal in XML. If endpoint
1.99 + * is an URL which contains illegal characters (like '&'-char),
1.100 + * those need to be encoded into XML entity form (like &).
1.101 + * EncodeHttpCharactersLC() method from XmlUtils can be used
1.102 + * for encoding of basic XML entities.
1.103 + * @return a new CSenIdentityProvider
1.104 + */
1.105 + IMPORT_C static CSenIdentityProvider* NewL( const TDesC8& aEndpoint );
1.106 +
1.107 + /**
1.108 + * Two-phased constructor.
1.109 + * Note: contract defaults here to "urn:liberty:as:2004-04"
1.110 + * @since Series60 3.0
1.111 + * @param aEndpoint the service endpoint. Note that endpoint cannot
1.112 + * include characters which are illegal in XML. If endpoint
1.113 + * is an URL which contains illegal characters (like '&'-char),
1.114 + * those need to be encoded into XML entity form (like &).
1.115 + * EncodeHttpCharactersLC() method from XmlUtils can be used
1.116 + * for encoding of basic XML entities.
1.117 + * @return a new CSenIdentityProvider, which pointer is left on
1.118 + * cleanup stack.
1.119 + */
1.120 + IMPORT_C static CSenIdentityProvider* NewLC( const TDesC8& aEndpoint );
1.121 +
1.122 + /**
1.123 + * Two-phased constructor.
1.124 + * @since Series60 3.0
1.125 + * @param aEndpoint the service endpoint. Note that endpoint cannot
1.126 + * include characters which are illegal in XML. If endpoint
1.127 + * is an URL which contains illegal characters (like '&'-char),
1.128 + * those need to be encoded into XML entity form (like &).
1.129 + * EncodeHttpCharactersLC() method from XmlUtils can be used
1.130 + * for encoding of basic XML entities.
1.131 + * @param aContract identifies the service type. Typically some URN.
1.132 + * Default is Liberty ID-WSF Authentication Service contract:
1.133 + * -- urn:liberty:as:2004-04
1.134 + * @return a new CSenIdentityProvider
1.135 + */
1.136 + IMPORT_C static CSenIdentityProvider* NewL( const TDesC8& aEndpoint,
1.137 + const TDesC8& aContract );
1.138 +
1.139 + /**
1.140 + * Two-phased constructor.
1.141 + * @since Series60 3.0
1.142 + * @param aEndpoint the service endpoint. Note that endpoint cannot
1.143 + * include characters which are illegal in XML. If endpoint
1.144 + * is an URL which contains illegal characters (like '&'-char),
1.145 + * those need to be encoded into XML entity form (like &).
1.146 + * EncodeHttpCharactersLC() method from XmlUtils can be used
1.147 + * for encoding of basic XML entities.
1.148 + * @param aContract identifies the service type. Typically some URN.
1.149 + * Default is Liberty ID-WSF Authentication Service contract:
1.150 + * -- urn:liberty:as:2004-04
1.151 + * @return a new CSenIdentityProvider, which pointer is left on
1.152 + * cleanup stack.
1.153 + */
1.154 + IMPORT_C static CSenIdentityProvider* NewLC(const TDesC8& aEndpoint,
1.155 + const TDesC8& aContract );
1.156 +
1.157 + /**
1.158 + * Two-phased constructor.
1.159 + * @since Series60 3.0
1.160 + * @param aEndpoint the service endpoint. Note that endpoint cannot
1.161 + * include characters which are illegal in XML. If endpoint
1.162 + * is an URL which contains illegal characters (like '&'-char),
1.163 + * those need to be encoded into XML entity form (like &).
1.164 + * EncodeHttpCharactersLC() method from XmlUtils can be used
1.165 + * for encoding of basic XML entities.
1.166 + * @param aContract identifies the service type. Typically some URN.
1.167 + * Default is Liberty ID-WSF Authentication Service contract:
1.168 + * -- urn:liberty:as:2004-04
1.169 + * @param aProviderID is identifier of this IdentityProvider. It is a
1.170 + * unique key pointing to some known endpoint.
1.171 + * @return a new CSenIdentityProvider
1.172 + */
1.173 + IMPORT_C static CSenIdentityProvider* NewL( const TDesC8& aEndpoint,
1.174 + const TDesC8& aContract,
1.175 + const TDesC8& aProviderID);
1.176 +
1.177 + /**
1.178 + * Two-phased constructor.
1.179 + * @since Series60 3.0
1.180 + * @param aEndpoint the service endpoint. Note that endpoint cannot
1.181 + * include characters which are illegal in XML. If endpoint
1.182 + * is an URL which contains illegal characters (like '&'-char),
1.183 + * those need to be encoded into XML entity form (like &).
1.184 + * EncodeHttpCharactersLC() method from XmlUtils can be used
1.185 + * for encoding of basic XML entities.
1.186 + * @param aContract identifies the service type. Typically some URN.
1.187 + * Default is Liberty ID-WSF Authentication Service contract:
1.188 + * -- urn:liberty:as:2004-04
1.189 + * @param aProviderID is identifier of this IdentityProvider. It is a
1.190 + * unique key pointing to some known endpoint. Required only
1.191 + * for ID-WSF framework.
1.192 + * @return a new CSenIdentityProvider, which pointer is left on
1.193 + * cleanup stack.
1.194 + */
1.195 + IMPORT_C static CSenIdentityProvider* NewLC(const TDesC8& aEndpoint,
1.196 + const TDesC8& aContract,
1.197 + const TDesC8& aProviderID);
1.198 +
1.199 + /**
1.200 + * Two-phased constructor.
1.201 + * @since Series60 3.0
1.202 + * @param aEndpoint the service endpoint. Note that endpoint cannot
1.203 + * include characters which are illegal in XML. If endpoint
1.204 + * is an URL which contains illegal characters (like '&'-char),
1.205 + * those need to be encoded into XML entity form (like &).
1.206 + * EncodeHttpCharactersLC() method from XmlUtils can be used
1.207 + * for encoding of basic XML entities.
1.208 + * @param aContract identifies the service type. Typically some URN.
1.209 + * Default is Liberty ID-WSF Authentication Service contract:
1.210 + * -- urn:liberty:as:2004-04
1.211 + * @param aProviderID is identifier of this IdentityProvider. It is a
1.212 + * unique key pointing to some known endpoint. Required only
1.213 + * for ID-WSF framework.
1.214 + * @param aServiceID is a unique contract to some invocable service.
1.215 + * Typically some URN. If this IDP is registered to ID-WSF
1.216 + * framework, this ServiceID will be appended into list of
1.217 + * services which trust this IDP, and the actual IDP "knows".
1.218 + * @return a new CSenIdentityProvider
1.219 + */
1.220 + IMPORT_C static CSenIdentityProvider* NewL( const TDesC8& aEndpoint,
1.221 + const TDesC8& aContract,
1.222 + const TDesC8& aProviderID,
1.223 + const TDesC8& aServiceID);
1.224 +
1.225 + /**
1.226 + * Two-phased constructor.
1.227 + * @since Series60 3.0
1.228 + * @param aEndpoint the service endpoint. Note that endpoint cannot
1.229 + * include characters which are illegal in XML. If endpoint
1.230 + * is an URL which contains illegal characters (like '&'-char),
1.231 + * those need to be encoded into XML entity form (like &).
1.232 + * EncodeHttpCharactersLC() method from XmlUtils can be used
1.233 + * for encoding of basic XML entities.
1.234 + * @param aProviderID is identifier of this IdentityProvider. It is a
1.235 + * unique key pointing to some known endpoint. Required only
1.236 + * for ID-WSF framework.
1.237 + * @param aContract identifies the service type. Typically some URN.
1.238 + * Default is Liberty ID-WSF Authentication Service contract:
1.239 + * -- urn:liberty:as:2004-04
1.240 + * @param aServiceID is a unique contract to some invocable service.
1.241 + * Typically some URN. If this IDP is registered to ID-WSF
1.242 + * framework, this ServiceID will be appended into list of
1.243 + * services which trust this IDP, and the actual IDP "knows".
1.244 + * @return a new CSenIdentityProvider, which pointer is left on
1.245 + * cleanup stack.
1.246 + */
1.247 + IMPORT_C static CSenIdentityProvider* NewLC(const TDesC8& aEndpoint,
1.248 + const TDesC8& aContract,
1.249 + const TDesC8& aProviderID,
1.250 + const TDesC8& aServiceID);
1.251 +
1.252 + /**
1.253 + * Destructor.
1.254 + */
1.255 + IMPORT_C virtual ~CSenIdentityProvider();
1.256 +
1.257 + // New functions
1.258 +
1.259 + /**
1.260 + * A getter.
1.261 + * @since Series60 3.0
1.262 + * @return a pointer to authorization id
1.263 + */
1.264 + IMPORT_C virtual TPtrC8 AuthzID();
1.265 +
1.266 + /**
1.267 + * A getter.
1.268 + * @since Series60 3.0
1.269 + * @return a pointer to advisory authentication id
1.270 + */
1.271 + IMPORT_C virtual TPtrC8 AdvisoryAuthnID();
1.272 +
1.273 + /**
1.274 + * A getter.
1.275 + * @since Series60 3.0
1.276 + * @return a pointer to provider id
1.277 + */
1.278 + IMPORT_C TPtrC8 ProviderID();
1.279 +
1.280 + /**
1.281 + * A getter.
1.282 + * @since Series60 3.0
1.283 + * @return a pointer to password
1.284 + */
1.285 + IMPORT_C virtual TPtrC8 Password();
1.286 +
1.287 + /**
1.288 + * A getter.
1.289 + * @since Series60 3.0
1.290 + * @return a pointer to IMEI
1.291 + */
1.292 + IMPORT_C const TDesC8& IMEI();
1.293 +
1.294 + /**
1.295 + * A getter.
1.296 + * @since Series60 3.0
1.297 + * @return a pointer to username
1.298 + */
1.299 + IMPORT_C TPtrC8 UserName();
1.300 +
1.301 + /**
1.302 + * Setter
1.303 + * @since Series60 3.0
1.304 + * @param aProviderID the set id
1.305 + * @return KErrNone or other system-wide Symbian error codes.
1.306 + */
1.307 + IMPORT_C TInt SetProviderID( const TDesC8& aProviderID );
1.308 +
1.309 + /**
1.310 + * Setter for ServiceID. ServiceID is the contract of some
1.311 + * invocable service, typically some URN.
1.312 + * Note, that when registering an IDP the possibly existing
1.313 + * list of ServiceIDs is not cleared, but the ServiceID set
1.314 + * via this method is added as new entry into that list, if
1.315 + * it was non-existent.
1.316 + * @since Series60 3.0
1.317 + * @param aServiceID the set id
1.318 + * @return KErrNone or other system-wide Symbian error codes.
1.319 + */
1.320 + IMPORT_C TInt SetServiceID( const TDesC8& aServiceID );
1.321 +
1.322 + /**
1.323 + * @since Series60 3.0
1.324 + * @param aServiceDescription the service description to check
1.325 + * @return ETrue if the ServiceDescription, i.e. its endpoint
1.326 + * or contract, is associated to this IdentityProvider.
1.327 + * Or if the ServiceDescription is about this
1.328 + * IdentityProvider.
1.329 + * EFalse otherwise
1.330 + */
1.331 + IMPORT_C TBool IsTrustedByL( MSenServiceDescription& aServiceDescription );
1.332 +
1.333 + /**
1.334 + * @since Series60 3.0
1.335 + * @param aProviderIdOrServiceId IdentityProvider ID, or Service ID
1.336 + * which is being checked. Service ID is typically URI
1.337 + * (service contract or service endpoint).
1.338 + * @return ETrue if the ServiceDescription, i.e. its endpoint
1.339 + * or contract, is associated to this IdentityProvider.
1.340 + * Or if the ServiceDescription is about this
1.341 + * IdentityProvider.
1.342 + * EFalse otherwise
1.343 + */
1.344 + IMPORT_C TBool IsTrustedByL( const TDesC8& aProviderIdOrServiceId );
1.345 +
1.346 + /**
1.347 + * Checks if this identity provider is set as default .
1.348 + * @since Series60 3.0
1.349 + * @return ETrue if default-attribute was set, EFalse otherwise
1.350 + */
1.351 + IMPORT_C TBool IsDefault();
1.352 +
1.353 + /**
1.354 + * Sets the user information.
1.355 + * Status codes:
1.356 + * KErrNone ok
1.357 + * Other codes are system error codes.
1.358 + * @since Series60 3.0
1.359 + * @param aAuthzID Authorization id.
1.360 + * @param aAdvisoryAuthnID Advisory authorization id.
1.361 + * @param aPassword Password.
1.362 + * @return status/error code.
1.363 + */
1.364 + IMPORT_C TInt SetUserInfoL( const TDesC8& aAuthzID,
1.365 + const TDesC8& aAdvisoryAuthnID,
1.366 + const TDesC8& aPassword );
1.367 +
1.368 + /**
1.369 + * @deprecated. This method is no longer in use.
1.370 + * Creates http-credentials by making password-username pair
1.371 + * and encoding it with BASE-64.
1.372 + * @since Series60 3.0
1.373 + * @param aIdMgr Identitymanager which is used to obtain a password
1.374 + * if no password for this identityprovider was set.
1.375 + * @return a newly allocated credentialbuffer. Ownership is transferred
1.376 + * to the caller.
1.377 + */
1.378 + IMPORT_C HBufC8* HttpCredentialsL( MSenIdentityManager& aIdMgr );
1.379 +
1.380 + // Functions from base classes
1.381 +
1.382 + // From CSenXmlServiceDescription
1.383 +
1.384 + /**
1.385 + * @since Series60 3.0
1.386 + * @return Descriptor containing service description local name
1.387 + * for this service description.
1.388 + * This is the localname of the element, when this class is
1.389 + * represented as an XML element.
1.390 + */
1.391 + IMPORT_C const TDesC8& NewElementName();
1.392 +
1.393 + /**
1.394 + * Setter for (identity) provider ID (leaving variant)
1.395 + * @since Series60 4.0
1.396 + * @param aProviderID the unique identifier of the (identity) provider
1.397 + * @return KErrNone on success, KErrArgument if aProviderID is a
1.398 + * zero-length descriptor, or one of the system-wide error codes
1.399 + * otherwise.
1.400 + */
1.401 + IMPORT_C TInt SetProviderIdL( const TDesC8& aProviderID );
1.402 +
1.403 + IMPORT_C TInt SetAccountExtensionsL(const TDesC8& aDetail);
1.404 +
1.405 + IMPORT_C TPtrC8 AccountExtensions(CSenElement*& aAccExt);
1.406 +
1.407 + protected:
1.408 +
1.409 + /*
1.410 + C++ default constructor
1.411 + */
1.412 + IMPORT_C CSenIdentityProvider( TDescriptionClassType aType );
1.413 +
1.414 +
1.415 + // Functions from base classes
1.416 +
1.417 + // From CSenXmlServiceDescription
1.418 +
1.419 + /**
1.420 + * Standard 2nd phase constructor.
1.421 + * @since Series60 3.0
1.422 + * @param aEndpoint the service endpoint. Note that endpoint cannot
1.423 + * include characters which are illegal in XML. If endpoint
1.424 + * is an URL which contains illegal characters (like '&'-char),
1.425 + * those need to be encoded into XML entity form (like &).
1.426 + * EncodeHttpCharactersLC() method from XmlUtils can be used
1.427 + * for encoding of basic XML entities.
1.428 + */
1.429 + IMPORT_C void ConstructL(const TDesC8& aEndPoint);
1.430 +
1.431 + /**
1.432 + * @since Series60 3.0
1.433 + * @param aEndpoint the service endpoint. Note that endpoint cannot
1.434 + * include characters which are illegal in XML. If endpoint
1.435 + * is an URL which contains illegal characters (like '&'-char),
1.436 + * those need to be encoded into XML entity form (like &).
1.437 + * EncodeHttpCharactersLC() method from XmlUtils can be used
1.438 + * for encoding of basic XML entities.
1.439 + * @param aContract identifies the service type. Typically some URN.
1.440 + * Default contract is Liberty ID-WSF Authentication Service
1.441 + * - "urn:liberty:as:2004-04".
1.442 + */
1.443 + IMPORT_C void ConstructL(const TDesC8& aEndPoint,
1.444 + const TDesC8& aContract);
1.445 +
1.446 + /**
1.447 + * @since Series60 3.0
1.448 + * @param aEndpoint the service endpoint. Note that endpoint cannot
1.449 + * include characters which are illegal in XML. If endpoint
1.450 + * is an URL which contains illegal characters (like '&'-char),
1.451 + * those need to be encoded into XML entity form (like &).
1.452 + * EncodeHttpCharactersLC() method from XmlUtils can be used
1.453 + * for encoding of basic XML entities.
1.454 + * @param aContract identifies the service type. Typically some URN.
1.455 + * Default contract is Liberty ID-WSF Authentication Service
1.456 + * - "urn:liberty:as:2004-04".
1.457 + * @param aProviderID is identifier of this IdentityProvider. It is a
1.458 + * unique key pointing to some known endpoint. Required only
1.459 + * for ID-WSF framework.
1.460 + */
1.461 + IMPORT_C void ConstructL(const TDesC8& aEndPoint,
1.462 + const TDesC8& aContract,
1.463 + const TDesC8& aProviderID);
1.464 +
1.465 + /**
1.466 + * @since Series60 3.0
1.467 + * @param aEndpoint the service endpoint. Note that endpoint cannot
1.468 + * include characters which are illegal in XML. If endpoint
1.469 + * is an URL which contains illegal characters (like '&'-char),
1.470 + * those need to be encoded into XML entity form (like &).
1.471 + * EncodeHttpCharactersLC() method from XmlUtils can be used
1.472 + * for encoding of basic XML entities.
1.473 + * @param aContract identifies the service type. Typically some URN.
1.474 + * Default contract is Liberty ID-WSF Authentication Service
1.475 + * - "urn:liberty:as:2004-04".
1.476 + * @param aProviderID is identifier of this IdentityProvider. It is a
1.477 + * unique key pointing to some known endpoint. Required only
1.478 + * for ID-WSF framework.
1.479 + * @param aServiceID is a unique contract to some invocable service.
1.480 + * Typically some URN. If this IDP is registered to ID-WSF
1.481 + * framework, this ServiceID will be appended into list of
1.482 + * services which trust this IDP, and the actual IDP "knows".
1.483 + */
1.484 + IMPORT_C void ConstructL( const TDesC8& aEndPoint,
1.485 + const TDesC8& aContract,
1.486 + const TDesC8& aProviderID,
1.487 + const TDesC8& aServiceID );
1.488 + };
1.489 +
1.490 +#endif // SEN_IDENTITY_PROVIDER_H
1.491 +
1.492 +// End of File