|
1 /* |
|
2 * Copyright (c) 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: Header declaration |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 #ifndef C_SEN_IDENTIFIER_H |
|
26 #define C_SEN_IDENTIFIER_H |
|
27 |
|
28 // INCLUDES |
|
29 |
|
30 #include <e32base.h> |
|
31 #include <flogger.h> |
|
32 #include <ssl.h> |
|
33 |
|
34 #include "senattributes.h" |
|
35 |
|
36 // CONSTANTS |
|
37 namespace SenIdentifier |
|
38 { |
|
39 enum TIdentifierType |
|
40 { |
|
41 EUnknown = 0, |
|
42 EEndpoint, // URL |
|
43 ECertInfo, // (Server) certificate info object - unique ID of X509 cert |
|
44 ESession, // Symbian server session |
|
45 ELocalApp, // Symbian App GUID |
|
46 EProvider, // i.e., Liberty ProviderID |
|
47 ERole, // Role ID (e.g., in form of SAML NameIdentifier) |
|
48 EIdentity, // Subject ID, e.g., SAML NameIdentifier |
|
49 EThread, // Thread ID |
|
50 EProcess // Process ID |
|
51 }; |
|
52 } |
|
53 |
|
54 // CLASS DEFINITIONS |
|
55 |
|
56 /** |
|
57 * An Identifier is used to address (point to) a Principal. |
|
58 * The system uses a variety of actual types to identify different |
|
59 * parties. For example an URL endpoint can serve as an identifier |
|
60 * for a remote service; a (G)UID may identitfy a local application, and |
|
61 * an XML document or SAML NameIdentifier may identify a person. |
|
62 * |
|
63 * NOTE: This is just like a java.security.Principal |
|
64 * and could potentially be extended to supply that kind of interface |
|
65 * to requesters |
|
66 * |
|
67 * How are Identifiers related? One way is via the Proxy mechanism - but |
|
68 * an attribute (ie. SAML attribute is just an Identifier with a different |
|
69 * name, and possibly multiple values) |
|
70 * |
|
71 * Identifiers are useful for policy related to a Subject, but can also be |
|
72 * used to index a session with a consumer application |
|
73 * |
|
74 * <p> |
|
75 * (c) Copyright Nokia 2004, 2005 |
|
76 * <p> |
|
77 */ |
|
78 class CSenIdentifier : public CBase |
|
79 { |
|
80 /* |
|
81 public final static CSenIdentifier NULL = new Identifier(); |
|
82 */ |
|
83 |
|
84 public: // Constructors and Destructors |
|
85 |
|
86 IMPORT_C static CSenIdentifier* NewL(); |
|
87 |
|
88 IMPORT_C static CSenIdentifier* NewLC(); |
|
89 |
|
90 IMPORT_C static CSenIdentifier* NewL(const CSenIdentifier& aParent); |
|
91 |
|
92 IMPORT_C static CSenIdentifier* NewLC(const CSenIdentifier& aParent); |
|
93 |
|
94 IMPORT_C static CSenIdentifier* NewL(SenIdentifier::TIdentifierType aIdentifierType, |
|
95 const TDesC8& aIdentifierValue); |
|
96 |
|
97 IMPORT_C static CSenIdentifier* NewLC(SenIdentifier::TIdentifierType aIdentifierType, |
|
98 const TDesC8& aIdentifierValue); |
|
99 |
|
100 |
|
101 IMPORT_C static CSenIdentifier* NewL(SenIdentifier::TIdentifierType aIdentifierType, |
|
102 const TDesC8& aIdentifierValue, |
|
103 const TDesC8& aFriendlyName); |
|
104 |
|
105 IMPORT_C static CSenIdentifier* NewLC(SenIdentifier::TIdentifierType aIdentifierType, |
|
106 const TDesC8& aIdentifierValue, |
|
107 const TDesC8& aFriendlyName); |
|
108 |
|
109 |
|
110 /** |
|
111 * |
|
112 * Constructor taking TCertInfo type as value input, which will be |
|
113 * converted into string representation (TDesC8) where fields are |
|
114 * delimited by KSenCASNDelimiter. |
|
115 * |
|
116 * @since Series60 5.0 |
|
117 * |
|
118 * @param aIdentifierType The identifier type value, which typically would be ECertInfo. |
|
119 * @param aCertInfo The certificate info object that provides a unique |
|
120 * identification of a certificate. |
|
121 * @return a pointer to new CSenIdentifier instance |
|
122 * |
|
123 */ |
|
124 IMPORT_C static CSenIdentifier* NewL(SenIdentifier::TIdentifierType aIdentifierType, |
|
125 const TCertInfo& aCertInfo); |
|
126 |
|
127 /** |
|
128 * |
|
129 * Constructor taking TCertInfo type as value input, which will be |
|
130 * converted into string representation (TDesC8) where fields are |
|
131 * delimited by KSenCASNDelimiter. |
|
132 * |
|
133 * @since Series60 5.0 |
|
134 * |
|
135 * @param aIdentifierType The identifier type value, which typically would be ECertInfo. |
|
136 * @param aCertInfo The certificate info object that provides a unique |
|
137 * identification of a certificate. |
|
138 * @return new CSenIdentifier instance pointer, which has been left on cleanup stack. |
|
139 * |
|
140 */ |
|
141 IMPORT_C static CSenIdentifier* NewLC(SenIdentifier::TIdentifierType aIdentifierType, |
|
142 const TCertInfo& aCertInfo); |
|
143 |
|
144 |
|
145 IMPORT_C virtual ~CSenIdentifier(); |
|
146 |
|
147 /** |
|
148 * Getter for Identifier value |
|
149 * @return the value of this identifier |
|
150 */ |
|
151 IMPORT_C TPtrC8 Value() const; |
|
152 |
|
153 |
|
154 /** |
|
155 * Getter for Identifier type |
|
156 * @return TIdentifierType enumeration (type) of this identifier |
|
157 */ |
|
158 IMPORT_C SenIdentifier::TIdentifierType Type() const; |
|
159 |
|
160 |
|
161 /** |
|
162 * Equality operation for two identifiers |
|
163 */ |
|
164 IMPORT_C TBool Equals(const CSenIdentifier& otherIdentifier); |
|
165 |
|
166 /** |
|
167 * This identifier is saying that it is acting as a proxy for the given (param) |
|
168 * identifier. An example of proxying is if the PAOS filter or another piece of |
|
169 * local software acts on behalf of some remote network entity, forwarding a |
|
170 * request message to Core Service Manager (and then onto the service instance). |
|
171 * |
|
172 * @param aIdentifier identifier of which self is a proxy for. That is, |
|
173 * aIdentifier becomes parent of self. Method takes ownership of aIdentifier. |
|
174 */ |
|
175 IMPORT_C void ProxyFor( CSenIdentifier* aIdentifier ); |
|
176 |
|
177 /** |
|
178 * Is the Identifier acting as the proxy for another Identifier? |
|
179 * |
|
180 * @return TBool - indicating that the Identifier in question is |
|
181 * acting as a proxy for some other Identifier |
|
182 * |
|
183 */ |
|
184 IMPORT_C TBool IsProxy() const; |
|
185 |
|
186 /** |
|
187 * Getter for parent identifier (ie. that which this identifier |
|
188 * is proxying for. |
|
189 * |
|
190 * @return the identifier that is being proxied for, or NULL, |
|
191 * if this identifier does not act as a proxy to any |
|
192 * other. |
|
193 */ |
|
194 IMPORT_C const CSenIdentifier* Proxy() const; |
|
195 |
|
196 |
|
197 /** |
|
198 * Getter for top level proxy (parent) of the identifier chain. |
|
199 * If this identifier is not proxy for any other, then this |
|
200 * method returns itself. |
|
201 * @return pointer to root identifier or if this identifier is |
|
202 * not a proxy, the pointer to this identifier itself. |
|
203 */ |
|
204 IMPORT_C const CSenIdentifier* Root() const; |
|
205 |
|
206 |
|
207 /** |
|
208 * Add an Attribute statement to this Identifier. An attribute might say something like |
|
209 * "this Identifier was authenticated at such and such a time" or "this Identifier is a member |
|
210 * of group YYY" |
|
211 * |
|
212 * Note: It is possible that multiple attributes with the same name, but different values |
|
213 * could have been added to the list. Currently there is no check on this in the Attribute |
|
214 * or Identifier code. |
|
215 * |
|
216 * |
|
217 * @param aAttribute |
|
218 * @see com.nokia.serene.utils.Attribute |
|
219 */ |
|
220 IMPORT_C void AddAttributeL( CSenAttribute& aAttribute ); //codescannerwarnings |
|
221 |
|
222 |
|
223 /** |
|
224 * Get a reference to the attributes associated with this Identifier |
|
225 * |
|
226 * |
|
227 * @since Series60 5.0 |
|
228 * |
|
229 * @param none |
|
230 * |
|
231 * @return CSenAttributes |
|
232 */ |
|
233 IMPORT_C const CSenAttributes* Attributes() const; |
|
234 |
|
235 |
|
236 /** |
|
237 * Tests whether or not two CSenIdentifier instances are equal. |
|
238 * @since Series60 5.0 |
|
239 * @param aIdentifier is the CSenIdentifier to be compared with this |
|
240 * @return True if the two CSenIdentifier are equal. False if not. |
|
241 */ |
|
242 IMPORT_C TBool operator==(const CSenIdentifier& aIdentifier); |
|
243 |
|
244 protected: |
|
245 |
|
246 |
|
247 |
|
248 void ConstructL(SenIdentifier::TIdentifierType aIdentifierType, |
|
249 const TDesC8& aIdentifierValue, |
|
250 const TDesC8& aFriendlyName); |
|
251 |
|
252 |
|
253 void ConstructL(const CSenIdentifier& aParent); |
|
254 |
|
255 |
|
256 private: |
|
257 |
|
258 CSenIdentifier(); |
|
259 |
|
260 /** |
|
261 * Getter for parent identifier (which is being proxied by |
|
262 * this identifier, or if this identifier does not act as |
|
263 * proxy, it returns it self. |
|
264 * @return parent identifier. Unlike Proxy(), this method |
|
265 * returns a reference to itself, if it does not |
|
266 * have a parent. |
|
267 */ |
|
268 const CSenIdentifier& Parent() const; |
|
269 |
|
270 /** |
|
271 * Getter for statement attribute list. |
|
272 * @return a list of attributes that containt statements of |
|
273 * this identifier. |
|
274 */ |
|
275 const CSenAttributes& Statements() const; |
|
276 |
|
277 |
|
278 protected: // Data |
|
279 |
|
280 SenIdentifier::TIdentifierType iType; |
|
281 HBufC8* ipValue; // owned |
|
282 |
|
283 private: // Data |
|
284 HBufC8* ipFriendlyName; // ownedd |
|
285 CSenIdentifier* ipParent; // not owned |
|
286 CSenAttributes* ipStatements; // owned |
|
287 |
|
288 |
|
289 }; |
|
290 |
|
291 #endif // C_SEN_IDENTIFIER_H |
|
292 |