1 karl 1.8 //%2005////////////////////////////////////////////////////////////////////////
|
2 mike 1.2 //
|
3 karl 1.7 // 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.6 // IBM Corp.; EMC Corporation, The Open Group.
|
7 karl 1.7 // 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.8 // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
10 // EMC Corporation; VERITAS Software Corporation; The Open Group.
|
11 mike 1.2 //
12 // Permission is hereby granted, free of charge, to any person obtaining a copy
|
13 kumpf 1.4 // 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 mike 1.2 // 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 //
|
19 kumpf 1.4 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
|
20 mike 1.2 // 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 kumpf 1.4 // 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 mike 1.2 // 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 kumpf 1.4 //==============================================================================
|
29 mike 1.2 //
30 // Author: Sushma Fernandes (sushma_fernandes@hp.com)
31 //
32 // Modified By: Nag Boranna, Hewlett Packard Company (nagaraja_boranna@hp.com)
|
33 kumpf 1.5 // Carol Ann Krug Graves, Hewlett-Packard Company
34 // (carolann_graves@hp.com)
|
35 mike 1.2 //
36 //%////////////////////////////////////////////////////////////////////////////
37
38
39 ///////////////////////////////////////////////////////////////////////////////
40 //
41 // This file implements the functionality required to manage password file.
42 //
43 ///////////////////////////////////////////////////////////////////////////////
44
45 #ifndef Pegasus_AuthorizationHandler_h
46 #define Pegasus_AuthorizationHandler_h
47
48 #include <cctype>
49 #include <fstream>
50
51 #include <Pegasus/Common/Config.h>
52 #include <Pegasus/Common/String.h>
53 #include <Pegasus/Repository/CIMRepository.h>
54
55 #include <Pegasus/Security/UserManager/Linkage.h>
56 mike 1.2
57 PEGASUS_NAMESPACE_BEGIN
58
59 ///////////////////////////////////////////////////////////////////////////////
60 // Auth Table
61 //////////////////////////////////////////////////////////////////////////////
62
63 typedef HashTable<String, String, EqualFunc<String>, HashFunc<String> > AuthTable;
64
|
65 kumpf 1.3 /** This class implements the functionality required to manage user authorizations.
66 It provides methods to get, set, remove and verify the user authorizations at
67 namespace level.
68 */
|
69 mike 1.2
70 class PEGASUS_USERMANAGER_LINKAGE AuthorizationHandler
71 {
72
73 private:
74
75 //
76 // Authorization cache
77 //
78 AuthTable _authTable;
79
80 //
81 // Repository handle
82 //
83 CIMRepository* _repository;
84
85 protected:
86
|
87 kumpf 1.3 /** Load the user information from the Repository.
|
88 mike 1.2 */
89 void _loadAllAuthorizations ();
90
91
92 public:
93
94 /** Constructor. */
95 AuthorizationHandler(CIMRepository* repository);
96
97 /** Destructor. */
98 ~AuthorizationHandler();
99
|
100 kumpf 1.3 /** Verify whether the spcefied namespace is a valid namespace.
101 @param nameSpace string containing the namespace name.
102 @return true if the specified name space is valid and exists, false otherwise.
|
103 mike 1.2 */
|
104 kumpf 1.5 Boolean verifyNamespace( const CIMNamespaceName& nameSpace );
|
105 mike 1.2
|
106 kumpf 1.3 /** Verify whether the specified operation has authorization to be performed
107 by the specified user.
108 @param userName string containing the user name.
109 @param nameSpace string containing the namespace name.
110 @param cimMethodName string containing the cim method name.
111 @return true if the specified user has authorizations to run the specified CIM
112 operation on the specified namespace, false otherwise.
|
113 mike 1.2 */
114 Boolean verifyAuthorization(
115 const String& userName,
|
116 kumpf 1.5 const CIMNamespaceName& nameSpace,
117 const CIMName& cimMethodName);
|
118 mike 1.2
|
119 kumpf 1.3 /** Set the authorization to the specified user on the specified namespace.
120 @param userName string containing the user name.
121 @param nameSpace string containing the namespace name.
122 @param auth string containing the authorizations.
|
123 mike 1.2 */
124 void setAuthorization(
125 const String& userName,
|
126 kumpf 1.5 const CIMNamespaceName& nameSpace,
|
127 mike 1.2 const String& auth);
128
|
129 kumpf 1.3 /** Remove the authorizations of the specified user on the specified namespace.
130 @param userName string containing the user name.
131 @param nameSpace string containing the namespace name.
|
132 mike 1.2 */
133 void removeAuthorization(
134 const String& userName,
|
135 kumpf 1.5 const CIMNamespaceName& nameSpace);
|
136 mike 1.2
|
137 kumpf 1.3 /** Get the authorizations of the specified user on the specified namespace.
138 @param userName string containing the user name.
139 @param nameSpace string containing the namespace name.
140 @return a string containing the authorizations.
|
141 mike 1.2 */
142 String getAuthorization(
143 const String& userName,
|
144 kumpf 1.5 const CIMNamespaceName& nameSpace);
|
145 mike 1.2 };
146
147 PEGASUS_NAMESPACE_END
148
149 #endif /* Pegasus_AuthorizationHandler_h */
150
|