1 karl 1.7 //%2003////////////////////////////////////////////////////////////////////////
|
2 kumpf 1.1 //
|
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 // IBM Corp.; EMC Corporation, The Open Group.
|
7 kumpf 1.1 //
|
8 kumpf 1.3 // Permission is hereby granted, free of charge, to any person obtaining a copy
9 // of this software and associated documentation files (the "Software"), to
10 // deal in the Software without restriction, including without limitation the
11 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
12 // sell copies of the Software, and to permit persons to whom the Software is
13 // furnished to do so, subject to the following conditions:
14 //
15 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
16 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
17 // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
18 // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
19 // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
20 // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
21 // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
23 kumpf 1.1 //
24 //==============================================================================
25 //
26 // Author: Nag Boranna, Hewlett-Packard Company(nagaraja_boranna@hp.com)
27 //
|
28 kumpf 1.6 // Modified By: Jair Santos, Hewlett-Packard Company (jair.santos@hp.com)
|
29 h.sterling 1.7.4.1 // Heather Sterling, IBM (hsterl@us.ibm.com)
|
30 kumpf 1.1 //
31 //%/////////////////////////////////////////////////////////////////////////////
32
33 #include <Pegasus/Common/Config.h>
34 #include <Pegasus/Common/Tracer.h>
35 #include "AuthenticationInfoRep.h"
36
|
37 h.sterling 1.7.4.1 #ifdef PEGASUS_HAS_SSL
38 #include <Pegasus/Common/TLS.h>
39 #endif
40
|
41 kumpf 1.1 PEGASUS_USING_STD;
42
43 PEGASUS_NAMESPACE_BEGIN
44
45
46 AuthenticationInfoRep::AuthenticationInfoRep(Boolean flag)
47 :
48 _authUser(String::EMPTY),
|
49 kumpf 1.6 _authPassword(String::EMPTY),
|
50 kumpf 1.2 _authChallenge(String::EMPTY),
|
51 kumpf 1.1 _authSecret(String::EMPTY),
|
52 kumpf 1.2 _privileged(false),
53 _authType(String::EMPTY),
54 _authStatus(NEW_REQUEST)
|
55 kumpf 1.1 {
56 PEG_METHOD_ENTER(
57 TRC_AUTHENTICATION, "AuthenticationInfoRep::AuthenticationInfoRep");
58
|
59 gerarda 1.4 #ifdef PEGASUS_KERBEROS_AUTHENTICATION
|
60 gerarda 1.5 _securityAssoc = NULL;
|
61 gerarda 1.4 #endif
62
|
63 h.sterling 1.7.4.2 #ifdef PEGASUS_USE_232_CLIENT_VERIFICATION
|
64 h.sterling 1.7.4.1 #ifdef PEGASUS_HAS_SSL
65 _peerCertificate = NULL;
66 _certificateStatus = 0;
67 #endif
|
68 h.sterling 1.7.4.2 #endif
|
69 h.sterling 1.7.4.1
|
70 kumpf 1.1 PEG_METHOD_EXIT();
71 }
72
73
74 AuthenticationInfoRep::~AuthenticationInfoRep()
75 {
76 PEG_METHOD_ENTER(
77 TRC_AUTHENTICATION, "AuthenticationInfoRep::~AuthenticationInfoRep");
|
78 gerarda 1.4
79 #ifdef PEGASUS_KERBEROS_AUTHENTICATION
80 if (_securityAssoc)
81 {
82 delete _securityAssoc;
83 _securityAssoc = 0;
84 }
85 #endif
|
86 kumpf 1.1
87 PEG_METHOD_EXIT();
88 }
89
90 void AuthenticationInfoRep::setAuthStatus(AuthStatus status)
91 {
92 PEG_METHOD_ENTER(
93 TRC_AUTHENTICATION, "AuthenticationInfoRep::setAuthStatus");
94
95 _authStatus = status;
96
97 PEG_METHOD_EXIT();
98 }
99
100 void AuthenticationInfoRep::setAuthenticatedUser(const String& userName)
101 {
102 PEG_METHOD_ENTER(
103 TRC_AUTHENTICATION, "AuthenticationInfoRep::setAuthenticatedUser");
104
105 _authUser = userName;
|
106 kumpf 1.6
107 PEG_METHOD_EXIT();
108 }
109
110 void AuthenticationInfoRep::setAuthenticatedPassword(const String& password)
111 {
112 PEG_METHOD_ENTER(
113 TRC_AUTHENTICATION, "AuthenticationInfoRep::setAuthenticatedPassword");
114
115 _authPassword = password;
|
116 kumpf 1.1
117 PEG_METHOD_EXIT();
118 }
119
120 void AuthenticationInfoRep::setAuthChallenge(const String& challenge)
121 {
122 PEG_METHOD_ENTER(
123 TRC_AUTHENTICATION, "AuthenticationInfoRep::setAuthChallenge");
124
125 _authChallenge = challenge;
126
127 PEG_METHOD_EXIT();
128 }
129
130 void AuthenticationInfoRep::setAuthSecret(const String& secret)
131 {
132 PEG_METHOD_ENTER(
133 TRC_AUTHENTICATION, "AuthenticationInfoRep::setAuthSecret");
134
135 _authSecret = secret;
136
137 kumpf 1.1 PEG_METHOD_EXIT();
138 }
139
140 void AuthenticationInfoRep::setPrivileged(Boolean privileged)
141 {
142 PEG_METHOD_ENTER(
143 TRC_AUTHENTICATION, "AuthenticationInfoRep::setPrivileged");
144
145 _privileged = privileged;
146
147 PEG_METHOD_EXIT();
148 }
149
150 void AuthenticationInfoRep::setAuthType(const String& authType)
151 {
152 PEG_METHOD_ENTER(
153 TRC_AUTHENTICATION, "AuthenticationInfoRep::setAuthType");
154
155 _authType = authType;
156
157 PEG_METHOD_EXIT();
158 kumpf 1.1 }
|
159 gerarda 1.5
160 #ifdef PEGASUS_KERBEROS_AUTHENTICATION
161 void AuthenticationInfoRep::setSecurityAssociation()
162 {
163 PEG_METHOD_ENTER(
164 TRC_AUTHENTICATION, "AuthenticationInfoRep::setSecurityAssociation");
165
166 if ( !_securityAssoc )
167 {
168 _securityAssoc = new CIMKerberosSecurityAssociation;
169 }
170
171 PEG_METHOD_EXIT();
172 }
173 #endif
174
|
175 h.sterling 1.7.4.2 #ifdef PEGASUS_USE_232_CLIENT_VERIFICATION
|
176 h.sterling 1.7.4.1 #ifdef PEGASUS_HAS_SSL
177 void AuthenticationInfoRep::setPeerCertificate(SSLCertificateInfo* peerCertificate)
178 {
179 PEG_METHOD_ENTER(
180 TRC_AUTHENTICATION, "AuthenticationInfoRep::setCertificateStatus");
181
182 _peerCertificate = peerCertificate;
183
184 PEG_METHOD_EXIT();
185 }
186
187 void AuthenticationInfoRep::setCertificateStatus(Sint32 certificateStatus)
188 {
189 PEG_METHOD_ENTER(
190 TRC_AUTHENTICATION, "AuthenticationInfoRep::setCertificateStatus");
191
192 _certificateStatus = certificateStatus;
193
194 // check the certificate authentication status to determine whether or not this
195 // client is trusted
196 if (_certificateStatus == SSLSocket::CERT_SUCCESS)
197 h.sterling 1.7.4.1 {
198 PEG_TRACE_STRING(TRC_DISCARDED_DATA, Tracer::LEVEL2,
199 "AuthenticationInfoRep::Client authenticated via SSL certificate");
200 _authStatus = AUTHENTICATED;
201 _privileged = true;
202 }
203
204 PEG_METHOD_EXIT();
205 }
|
206 h.sterling 1.7.4.2 #endif
|
207 h.sterling 1.7.4.1 #endif
|
208 kumpf 1.1
209 PEGASUS_NAMESPACE_END
|