1 karl 1.12 //%2005////////////////////////////////////////////////////////////////////////
|
2 mday 1.1 //
|
3 karl 1.11 // Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
4 // Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
5 // Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
|
6 karl 1.10 // IBM Corp.; EMC Corporation, The Open Group.
|
7 karl 1.11 // Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
8 // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
|
9 karl 1.12 // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
10 // EMC Corporation; VERITAS Software Corporation; The Open Group.
|
11 mday 1.1 //
12 // Permission is hereby granted, free of charge, to any person obtaining a copy
13 // of this software and associated documentation files (the "Software"), to
14 // deal in the Software without restriction, including without limitation the
15 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
16 // sell copies of the Software, and to permit persons to whom the Software is
17 // furnished to do so, subject to the following conditions:
|
18 kumpf 1.8 //
|
19 mday 1.1 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
20 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
21 // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
22 // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
23 // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
24 // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
25 // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
26 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 //
28 //==============================================================================
29 //
30 // Author: Mike Day (mdday@us.ibm.com) << Fri Mar 29 09:28:11 2002 mdd >>
31 //
32 // Modified By:
33 //
34 //%/////////////////////////////////////////////////////////////////////////////
35
36 #ifndef Pegasus_authorization_h
37 #define Pegasus_authorization_h
38
39 #include <Pegasus/Common/Config.h>
40 mday 1.1 #include <Pegasus/Common/IPC.h>
|
41 kumpf 1.7 #include <Pegasus/Common/String.h>
|
42 kumpf 1.9 #include <Pegasus/Common/Linkage.h>
|
43 mday 1.1 #include <bitset>
44
45 PEGASUS_NAMESPACE_BEGIN
46
47
48 // these constants will certainly change with implementation
49 class PEGASUS_COMMON_LINKAGE peg_identity_types
50 {
51 public:
52 static const Uint32 USERNAME;
53 static const Uint32 LDAP_DN;
54 static const Uint32 GUID;
55 static const Uint32 X509;
56 static const Uint32 PKCS6;
57 static const Uint32 HTTP_DIGEST_USER_AND_REALM;
58 static const Uint32 UNIX_ID;
|
59 mday 1.2 static const Uint32 INTERNAL;
|
60 mday 1.1 };
61
62 // these constants will certainly change with implementation
63 class PEGASUS_COMMON_LINKAGE peg_credential_types
64 {
65 public:
66 static const Uint32 CLEAR_PASSWORD;
67 static const Uint32 CRYPT_PASSWORD;
68 static const Uint32 HTTP_DIGEST;
|
69 mday 1.2 static const Uint32 SERVICE;
70 static const Uint32 MODULE;
71 static const Uint32 PROVIDER;
|
72 mday 1.1 };
73
74
|
75 mday 1.5 class PEGASUS_COMMON_LINKAGE pegasus_identity
|
76 mday 1.1 {
77 public:
|
78 mday 1.5 pegasus_identity(void) { }
79 virtual ~pegasus_identity(void){ };
80 virtual String get_id_string(void) const = 0;
81 virtual String get_cred_string(void) const = 0;
82 virtual Uint32 get_id_type(void) const = 0;
83 virtual Uint32 get_credential_type(void) const = 0;
|
84 mday 1.1 virtual Boolean authenticate(void) = 0;
|
85 mday 1.5 virtual pegasus_identity *create_id(void) const = 0;
86 virtual Boolean get_auth_bit(Uint32 index, Uint32 bit) const = 0;
|
87 mday 1.1 };
88
89
|
90 mday 1.5 class PEGASUS_COMMON_LINKAGE pegasus_basic_identity : public pegasus_identity
|
91 mday 1.1 {
92 public:
|
93 mday 1.5 typedef pegasus_identity Base;
|
94 mday 1.1
|
95 mday 1.5 pegasus_basic_identity(const String & username,
96 const String & password);
|
97 mday 1.1 pegasus_basic_identity( const pegasus_basic_identity & id);
98 virtual ~pegasus_basic_identity(void);
99
|
100 mday 1.5 pegasus_basic_identity & operator= (const pegasus_basic_identity & id);
101 Boolean operator==(const pegasus_basic_identity & id) const;
102 virtual String get_id_string(void) const;
103 virtual String get_cred_string(void) const;
104 virtual Uint32 get_id_type(void) const ;
105 virtual Uint32 get_credential_type(void) const ;
106 virtual Boolean authenticate(void) ;
107 virtual pegasus_identity *create_id(void) const;
|
108 mday 1.6 virtual Boolean get_auth_bit(Uint32 index, Uint32 bit) const { return true ; }
109
|
110 mday 1.1 private:
111 pegasus_basic_identity(void);
|
112 mday 1.5
113 String _username;
114 String _password;
|
115 mday 1.2 };
116
117
|
118 mday 1.5 class PEGASUS_COMMON_LINKAGE pegasus_internal_identity : public pegasus_identity
|
119 mday 1.2 {
120 public:
|
121 mday 1.5 typedef pegasus_identity Base;
|
122 mday 1.2 pegasus_internal_identity(Uint32 identity);
123 pegasus_internal_identity(const pegasus_internal_identity & id);
|
124 mday 1.6 virtual ~pegasus_internal_identity(void) {};
|
125 mday 1.5
|
126 mday 1.4 pegasus_internal_identity & operator= ( const pegasus_internal_identity & id);
|
127 mday 1.5 Boolean operator== (const pegasus_internal_identity & id) const ;
128 virtual String get_id_string(void) const;
129 virtual String get_cred_string(void) const;
130 virtual Uint32 get_id_type(void) const;
131 virtual Uint32 get_credential_type(void) const;
132 virtual Boolean authenticate(void);
133 virtual pegasus_identity *create_id(void) const;
|
134 mday 1.6 virtual Boolean get_auth_bit(Uint32 index, Uint32 bit) const { return true ; }
|
135 mday 1.2 private:
136 pegasus_internal_identity(void);
|
137 mday 1.5 Uint32 _id;
138 Uint32 _credential;
|
139 mday 1.2 };
140
141
|
142 mday 1.5 class PEGASUS_COMMON_LINKAGE pegasus_auth_handle
|
143 mday 1.2 {
144 public:
|
145 mday 1.5 pegasus_auth_handle(const pegasus_identity & id)
|
146 mday 1.2 {
|
147 mday 1.5 _id = id.create_id();
|
148 mday 1.2 }
149
|
150 mday 1.5 virtual ~pegasus_auth_handle(void)
|
151 mday 1.3 {
|
152 mday 1.5 delete _id;
|
153 mday 1.3 }
154
|
155 mday 1.5 virtual Boolean authorized(void) = 0;
156 virtual Boolean authorized(Uint32 ) = 0;
157 virtual Boolean authorized(Uint32, Uint32) = 0;
158
|
159 mday 1.2 private:
|
160 mday 1.5 pegasus_identity *_id;
|
161 mday 1.1 };
162
163
164
165 PEGASUS_NAMESPACE_END
166
167 #endif
|