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 the License "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 * CTPostRAMMarketPlugin is a dummy interface implementation for CAuthPluginInterface |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 #ifndef TPOSTMARKETRAMPLUGIN_H |
|
22 #define TPOSTMARKETRAMPLUGIN_H |
|
23 |
|
24 #include "authserver_client.h" |
|
25 #include <authserver/authplugininterface.h> |
|
26 |
|
27 //An implementation of the CAuthPluginInterface definition |
|
28 |
|
29 using namespace AuthServer; |
|
30 |
|
31 //implementation_uid = 0x1023F3F3 |
|
32 class CTPostMarketRAMPlugin : public CAuthPluginInterface |
|
33 { |
|
34 public: |
|
35 // Two phase constructor |
|
36 static CTPostMarketRAMPlugin* NewL(); |
|
37 // Destructor |
|
38 virtual ~CTPostMarketRAMPlugin(); |
|
39 //Implementation of CAuthPluginInterface definitions using a PIN system |
|
40 virtual void Identify(TIdentityId& aId, const TDesC& aClientMessage, HBufC8*& aResult, TRequestStatus& aRequest); |
|
41 virtual void Cancel(); |
|
42 virtual void Train(TIdentityId aId, HBufC8*& aResult, TRequestStatus& aRequest); |
|
43 virtual TBool IsActive() const; |
|
44 virtual TInt Forget(TIdentityId aId); |
|
45 virtual TInt DefaultData(TIdentityId aId, HBufC8*& aOutputBuf); |
|
46 virtual TInt Reset(TIdentityId aId, const TDesC& aRegistrationData, HBufC8*& aResult); |
|
47 virtual TPluginId Id() const = 0; |
|
48 virtual const TPtrC& Name() const; |
|
49 virtual const TPtrC& Description() const; |
|
50 virtual AuthServer::TEntropy MinEntropy() const; |
|
51 virtual AuthServer::TPercentage FalsePositiveRate() const; |
|
52 virtual AuthServer::TPercentage FalseNegativeRate() const; |
|
53 virtual AuthServer::TAuthPluginType Type() const; |
|
54 |
|
55 // Utility functions |
|
56 TInt IdReadUserInput(TBuf8<32>& inputValue); |
|
57 TInt TrainReadUserInput(TBuf8<32>& inputValue); |
|
58 TInt CheckForStringPresence(TIdentityId& aId, TBuf8<32> aInputValue, TRequestStatus& aRequestValue); |
|
59 TInt CheckForNewStringPresenceL(TIdentityId aId, TBuf8<32> aInputValue, TRequestStatus& aRequestValue); |
|
60 TInt FindStringAndRemoveL(TIdentityId aId); |
|
61 TInt AddToGlobalDb (TIdentityId aId, TBuf8<32> aInputValue); |
|
62 TInt RemoveFromGlobalDb (TIdentityId aId); |
|
63 const HBufC* ClientMessage (); |
|
64 |
|
65 |
|
66 public: |
|
67 mutable TBuf<70> iFileToRead; |
|
68 void ConstructL(); |
|
69 CTPostMarketRAMPlugin(); |
|
70 void ReloadAllFromIniFile(); |
|
71 void ReloadActiveStateFromIniFile() const; |
|
72 |
|
73 protected: |
|
74 /// The name of the plugin. Derived classes should set this member. |
|
75 TPtrC iName; |
|
76 /// The plugin's description. Derived classes should set this member. |
|
77 TPtrC iDescription; |
|
78 /// The minumum entropy provided by the plugin. Derived classes should set |
|
79 /// this member. |
|
80 AuthServer::TEntropy iMinEntropy; |
|
81 /// The false positive rate of the plugin. Derived classes should set this |
|
82 /// member. |
|
83 AuthServer::TPercentage iFalsePositiveRate; |
|
84 /// The false negative rate of the plugin. Derived classes should set this |
|
85 /// member. |
|
86 AuthServer::TPercentage iFalseNegativeRate; |
|
87 /// The type of the plugin. Derived classes should set this member. |
|
88 AuthServer::TAuthPluginType iType; |
|
89 |
|
90 private: |
|
91 // Data read from file determining if this plugin supports default data |
|
92 TBool iSupportsDefaultData; |
|
93 mutable TBool iActiveState; |
|
94 HBufC* iClientMessage; |
|
95 }; |
|
96 |
|
97 |
|
98 //========================================================================= |
|
99 // The various classes that are spawned from this base class by inheriting the implementations besides |
|
100 // the Id() function (Uses the #define macro) |
|
101 |
|
102 // number is hex, type is one of the TAuthPluginType enums |
|
103 // Id() returns the Id of the plugin |
|
104 |
|
105 |
|
106 #define NClass(id,type) class CTPostMarketRAMPlugin##id : public CTPostMarketRAMPlugin\ |
|
107 { \ |
|
108 public: \ |
|
109 typedef CTPostMarketRAMPlugin##id TMyPinType; \ |
|
110 TPluginId Id() const \ |
|
111 { return 0x##id; } \ |
|
112 static TMyPinType* NewL() \ |
|
113 { \ |
|
114 TMyPinType* r = new (ELeave) TMyPinType(); \ |
|
115 CleanupStack::PushL(r); \ |
|
116 r->ConstructL(); \ |
|
117 CleanupStack::Pop(r); \ |
|
118 r->iType = type; \ |
|
119 return r; \ |
|
120 } \ |
|
121 } |
|
122 |
|
123 NClass(10234100, EAuthKnowledge); |
|
124 |
|
125 //========================================================================= |
|
126 |
|
127 // Constants used in the utility functions -File locations, etc |
|
128 _LIT8(KDefaultData, "0000"); |
|
129 _LIT(KInitInfoFile, "\\tAuth\\tAuthSvr\\testdata\\initialisation_Info.ini"); |
|
130 _LIT(KPolicyFile, "\\tAuth\\tAuthSvr\\testdata\\AuthSvrPolicy.ini"); |
|
131 |
|
132 _LIT(KPluginNamePin, "PostMarketRAMPlugin"); |
|
133 _LIT(KPluginDescriptionPin, "Post Market RAM Plugin, a test plugin does nothing."); |
|
134 |
|
135 static const TInt KEntropyPin = 999; |
|
136 static const TInt KFalsePosPin = 100; |
|
137 static const TInt KFalseNegPin = 10; |
|
138 |
|
139 //From Step_Base.cpp |
|
140 _LIT(KPluginIniSection, "SectionOne"); |
|
141 _LIT(KAuthSvrPolicyFile, "\\tAuth\\tAuthSvr\\testdata\\AuthSvrPolicy.ini"); |
|
142 _LIT(KDefaultPluginTag, "DefaultPlugin"); |
|
143 _LIT(KEnteredPinTag, "EnteredPinValue"); |
|
144 _LIT(KPinDbTag, "Identity&PinValues"); |
|
145 _LIT(KTotalDbTag, "AllUserID&PinValues"); |
|
146 _LIT(KInitPinDatabaseValue, ","); |
|
147 |
|
148 |
|
149 #endif /* TPOSTMARKETRAMPLUGIN_H */ |
|