smf/smfcredentialmgr/smfcredmgrclient/smfcredmgrclient.h
changeset 14 a469c0e6e7fb
child 24 1cee9f1b95e0
equal deleted inserted replaced
13:b5d63d5fc252 14:a469c0e6e7fb
       
     1 /**
       
     2  * Copyright (c) 2010 Sasken Communication Technologies Ltd.
       
     3  * All rights reserved.
       
     4  * This component and the accompanying materials are made available
       
     5  * under the terms of the "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  * Pritam Roy Biswas, Sasken Communication Technologies Ltd - Initial contribution
       
    11  *
       
    12  * Description:
       
    13  * This is the public implementation Class(Qt-wrapper) for symbian client for Credential Manager server
       
    14  *
       
    15  */
       
    16 
       
    17 #ifndef SMFCREDMGRCLIENT_H_
       
    18 #define SMFCREDMGRCLIENT_H_
       
    19 
       
    20 #include <QObject>
       
    21 #include <QUrl>
       
    22 #include <QDateTime>
       
    23 #include <QStringList>
       
    24 
       
    25 #ifdef Q_OS_SYMBIAN
       
    26 #include <smfcredmgrcommon.h>
       
    27 #include <smfcredmgrclientglobal.h>
       
    28 #endif
       
    29 //Private implementation for different platforms
       
    30 #ifdef Q_OS_SYMBIAN
       
    31 class CSmfCredMgrClientSymbian;
       
    32 class RSmfCredMgrClientSession;
       
    33 #else
       
    34 class SmfCredMgrClientStub;
       
    35 class SmfCredMgrClientStubSession;
       
    36 #endif
       
    37 
       
    38 /**
       
    39  * Qt wrapper class for for exporting APIs of Credential Manager server
       
    40  */
       
    41 class SmfCredMgrClient : public QObject
       
    42 	{
       
    43 	//Q_OBJECT -- todo used when signal and slots implemented
       
    44 public:
       
    45 
       
    46 	/**
       
    47 	 * Constructor
       
    48 	 */
       
    49 	SmfCredMgrClient_EXPORT SmfCredMgrClient(QObject* parent = 0);
       
    50 
       
    51 	/**
       
    52 	 * Destructor
       
    53 	 */
       
    54 	SmfCredMgrClient_EXPORT ~SmfCredMgrClient();
       
    55 
       
    56 public:
       
    57 
       
    58 	/**
       
    59 	 * API to check plugin authentication
       
    60 	 * @param PluginID The ID of the Plugin to be checked
       
    61 	 * @return The boolean value-TRUE if authenticated, FALSE if not
       
    62 	 */
       
    63 	SmfCredMgrClient_EXPORT bool
       
    64 	CheckPluginAuthentication(QString PluginID) const;
       
    65 
       
    66 	/**
       
    67 	 * API to get the Auth Data set, eg:OAuth_RequestToken; OAuth_AccessToken
       
    68 	 * @param RegToken Registration Token obtained from SMF while storing this Auth Data set
       
    69 	 * @param Validity Time by which the Auth set will expire
       
    70 	 * @param AuthDataSet The Auth Token Set for the plugin, this Api would fill this parameter
       
    71 	 *   so the caller of The API must create space for SmfAuthParams
       
    72 	 * @return boolean Value if the reg token is still valid
       
    73 	 */
       
    74 	SmfCredMgrClient_EXPORT bool AuthDataSet(QString RegToken,
       
    75 			QDateTime Validity, SmfAuthParams& AuthDataSet) const;
       
    76 
       
    77 	/**
       
    78 	 * API to get list of URLs which plugin can access
       
    79 	 * @param PluginID The ID of the Plugin whose corresponding list of URLs to be retrieved
       
    80 	 * @return The URL list
       
    81 	 */
       
    82 	SmfCredMgrClient_EXPORT QList<QUrl> URLList(QString PluginID) const;
       
    83 
       
    84 	/**
       
    85 	 * API to get the list of authenticated plugins
       
    86 	 * @param RegistrationToken The token that validates a list of such plugins.
       
    87 	 * @return The list of authenticated plugins
       
    88 	 */
       
    89 	SmfCredMgrClient_EXPORT QStringList AuthenticatedPluginList(
       
    90 			QString RegistrationToken) const;
       
    91 
       
    92 	/**
       
    93 	 * API to generate NONCE token
       
    94 	 * @param Length Lenth of the NONCE tobe generated
       
    95 	 * @return The generated NONCE. This is never zero, the minimum length is 12.
       
    96 	 */
       
    97 	SmfCredMgrClient_EXPORT QString GenerateNONCE(const qint64 Length);
       
    98 
       
    99 	/**
       
   100 	 * API to update the list of authenticated plugins-add, remove, update to plugins
       
   101 	 * @param NewPluginID ID of the new plugin 
       
   102 	 * @param Flag flag to enable or disable the plugin
       
   103 	 * @param OldPluginID ID of the old plugin to be replaced
       
   104 	 * @todo - should return an error code to indicate error while changing the list.
       
   105 	 */
       
   106 	SmfCredMgrClient_EXPORT void ChangePluginIDList(QString NewPluginID,
       
   107 			bool Flag, QString OldPluginID);
       
   108 	/**
       
   109 	 * API to store all data related to an auth app i.e URL list for Plugins, List of Plugins.etc.
       
   110 	 * @param Set The auth Key set
       
   111 	 * @param Validity time by which the Auth set will expire
       
   112 	 * @param URLList The URL list to be set
       
   113 	 * @param PluginList The plugin list to be set
       
   114 	 * @param AuthAppId The Authentication Application Id
       
   115 	 * @param Flag flag to enable or disable the plugins
       
   116 	 * @return The registration token that completes authentication, its a NULL string if the 
       
   117 	 *   API fails due to any wrong argument
       
   118 	 */
       
   119 	SmfCredMgrClient_EXPORT QString StoreAuthData(SmfAuthParams Set,
       
   120 			QDateTime Validity, QList<QUrl> URLList, QStringList PluginList,
       
   121 			QString AuthAppId, bool Flag);
       
   122 
       
   123 	/**
       
   124 	 * API to store RSA Keys
       
   125 	 * @param KeyLabel First key of the key pair
       
   126 	 * @param Keydata  Other key of the key pair
       
   127 	 * @param Validity time by which the key set will expire
       
   128 	 * @return The Label of key pair
       
   129 	 */
       
   130 	SmfCredMgrClient_EXPORT QString StoreRSAKeys(const QString KeyLabel,
       
   131 			const QString Keydata, const QDateTime Validity);
       
   132 
       
   133 	/**
       
   134 	 * API to Sign the message
       
   135 	 * @param Message The message to be signed
       
   136 	 * @param Key If Signature method is RSA-SHA1 then it must be equal to the value
       
   137 	 * 				returned while storeRSAKeys(), if signature method is HMAC-SHA1 key
       
   138 	 * 				must the value to sign the message with
       
   139 	 * @param Signature The signed message is an output argument
       
   140 	 * @param AlgorithmUsed The algorithm used for signing
       
   141 	 * return Smf defined errorcode
       
   142 	 * @todo - RSA Signing is falgged-put for time being. 
       
   143 	 */
       
   144 	SmfCredMgrClient_EXPORT SMFCredMgrErrorCode SignMessage(QString Message,
       
   145 			QString Key, QString& Signature, SmfSignatureMethod AlgorithmUsed);
       
   146 	/**
       
   147 	 * API To delete the RSA Key from the Key Store 
       
   148 	 * @param KeyLabel The Label of key pair. This is the value returned while StoreRSAKeys().
       
   149 	 */
       
   150 	SmfCredMgrClient_EXPORT void DeleteRSAKey(QString KeyLabel);
       
   151 
       
   152 private:
       
   153 	/**
       
   154 	 * Handle to private implementation class.
       
   155 	 */
       
   156 #ifdef Q_OS_SYMBIAN
       
   157 	CSmfCredMgrClientSymbian* m_SmfClientPrivate;
       
   158 	friend class CSmfCredMgrClientSymbian;
       
   159 #endif
       
   160 
       
   161 	};
       
   162 
       
   163 #endif /* SMFCREDMGRCLIENT_H_ */
       
   164