1 martin 1.28 //%LICENSE////////////////////////////////////////////////////////////////
|
2 martin 1.29 //
|
3 martin 1.28 // Licensed to The Open Group (TOG) under one or more contributor license
4 // agreements. Refer to the OpenPegasusNOTICE.txt file distributed with
5 // this work for additional information regarding copyright ownership.
6 // Each contributor licenses this file to you under the OpenPegasus Open
7 // Source License; you may not use this file except in compliance with the
8 // License.
|
9 martin 1.29 //
|
10 martin 1.28 // Permission is hereby granted, free of charge, to any person obtaining a
11 // copy of this software and associated documentation files (the "Software"),
12 // to deal in the Software without restriction, including without limitation
13 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
14 // and/or sell copies of the Software, and to permit persons to whom the
15 // Software is furnished to do so, subject to the following conditions:
|
16 martin 1.29 //
|
17 martin 1.28 // The above copyright notice and this permission notice shall be included
18 // in all copies or substantial portions of the Software.
|
19 martin 1.29 //
|
20 martin 1.28 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
21 martin 1.29 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
22 martin 1.28 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
23 // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
24 // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
25 // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
26 // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
27 martin 1.29 //
|
28 martin 1.28 //////////////////////////////////////////////////////////////////////////
|
29 kumpf 1.1 //
30 //%/////////////////////////////////////////////////////////////////////////////
31
32 #include <Pegasus/Common/Config.h>
33 #include <Pegasus/Common/Tracer.h>
34 #include "AuthenticationInfoRep.h"
|
35 h.sterling 1.10 #include <Pegasus/Common/SSLContext.h>
|
36 sahana.prabhakar 1.31 #include <Pegasus/Common/FileSystem.h>
37 #include <Pegasus/Common/Executor.h>
|
38 kumpf 1.1
39 PEGASUS_USING_STD;
40
41 PEGASUS_NAMESPACE_BEGIN
42
|
43 h.sterling 1.12 const String AuthenticationInfoRep::AUTH_TYPE_SSL = "SSL";
|
44 thilo.boehm 1.27 const String AuthenticationInfoRep::AUTH_TYPE_ZOS_LOCAL_DOMIAN_SOCKET = "LDS";
45 const String AuthenticationInfoRep::AUTH_TYPE_ZOS_ATTLS = "ATTLS";
|
46 jsafrane 1.37 const String AuthenticationInfoRep::AUTH_TYPE_COOKIE = "COOKIE";
|
47 kumpf 1.1
|
48 marek 1.32 AuthenticationInfoRep::AuthenticationInfoRep()
|
49 kumpf 1.25 : _connectionAuthenticated(false),
|
50 marek 1.33 _wasRemotePrivilegedUserAccessChecked(false),
|
51 marek 1.34 _authHandle(),
|
52 jsafrane 1.39 _isExpiredPassword(false),
53 _isConnectionSecure(false)
|
54 jsafrane 1.38 #ifdef PEGASUS_ENABLE_SESSION_COOKIES
55 ,_cookie()
56 #endif
|
57 kumpf 1.19 {
|
58 kumpf 1.1 PEG_METHOD_ENTER(
59 TRC_AUTHENTICATION, "AuthenticationInfoRep::AuthenticationInfoRep");
|
60 jsafrane 1.36 #ifdef PEGASUS_NEGOTIATE_AUTHENTICATION
61 _session.reset(new NegotiateServerSession());
62 #endif
|
63 kumpf 1.1 PEG_METHOD_EXIT();
64 }
65
66 AuthenticationInfoRep::~AuthenticationInfoRep()
67 {
68 PEG_METHOD_ENTER(
69 TRC_AUTHENTICATION, "AuthenticationInfoRep::~AuthenticationInfoRep");
|
70 gerarda 1.4
|
71 sahana.prabhakar 1.31 // initiate the deletion of _localAuthFilePath.
72 if(FileSystem::exists(_localAuthFilePath))
73 {
74 // No response was received from the local client for the
75 // authentication challenge. Hence deleting the file here.
76
77 // Use executor, if present.
78 if (Executor::detectExecutor() == 0)
79 {
80 Executor::removeFile(_localAuthFilePath.getCString());
81 }
82 else
83 {
84 FileSystem::removeFile(_localAuthFilePath);
85 }
86 }
|
87 jsafrane 1.36
|
88 kumpf 1.1 PEG_METHOD_EXIT();
89 }
90
|
91 kumpf 1.24 void AuthenticationInfoRep::setConnectionAuthenticated(
|
92 sushma.fernandes 1.23 Boolean connectionAuthenticated)
|
93 kumpf 1.1 {
|
94 kumpf 1.24 PEG_METHOD_ENTER(TRC_AUTHENTICATION,
95 "AuthenticationInfoRep::setConnectionAuthenticated");
|
96 kumpf 1.1
|
97 sushma.fernandes 1.23 _connectionAuthenticated = connectionAuthenticated;
|
98 kumpf 1.1
99 PEG_METHOD_EXIT();
100 }
101
|
102 thilo.boehm 1.27 #ifdef PEGASUS_OS_ZOS
103
104 // The connection user is for z/OS only.
105 // On z/OS Unix Local Domain Sockets and sockets
106 // protected by AT-TLS are able to get the user ID of
107 // the connected user.
|
108 kumpf 1.30 // This information is needed for later authentication
109 // steps.
|
110 thilo.boehm 1.27
111 void AuthenticationInfoRep::setConnectionUser(const String& userName)
112 {
113 PEG_METHOD_ENTER(
114 TRC_AUTHENTICATION, "AuthenticationInfoRep::setConnectionUser()");
115
116 _connectionUser = userName;
117
118 PEG_METHOD_EXIT();
119 }
120 #endif
121
|
122 kumpf 1.24 void AuthenticationInfoRep::setAuthenticatedUser(const String& userName)
|
123 kumpf 1.1 {
124 PEG_METHOD_ENTER(
125 TRC_AUTHENTICATION, "AuthenticationInfoRep::setAuthenticatedUser");
126
127 _authUser = userName;
|
128 kumpf 1.6
129 PEG_METHOD_EXIT();
130 }
131
|
132 kumpf 1.24 void AuthenticationInfoRep::setAuthenticatedPassword(const String& password)
|
133 kumpf 1.6 {
134 PEG_METHOD_ENTER(
135 TRC_AUTHENTICATION, "AuthenticationInfoRep::setAuthenticatedPassword");
136
137 _authPassword = password;
|
138 kumpf 1.1
139 PEG_METHOD_EXIT();
140 }
141
|
142 kumpf 1.26 void AuthenticationInfoRep::setLocalAuthFilePath(const String& filePath)
143 {
144 PEG_METHOD_ENTER(
145 TRC_AUTHENTICATION, "AuthenticationInfoRep::setLocalAuthFilePath");
146
147 _localAuthFilePath = filePath;
148
149 PEG_METHOD_EXIT();
150 }
151
|
152 kumpf 1.24 void AuthenticationInfoRep::setLocalAuthSecret(const String& secret)
|
153 kumpf 1.1 {
154 PEG_METHOD_ENTER(
|
155 sushma.fernandes 1.22 TRC_AUTHENTICATION, "AuthenticationInfoRep::setLocalAuthSecret");
|
156 kumpf 1.1
|
157 sushma.fernandes 1.22 _localAuthSecret = secret;
|
158 kumpf 1.1
159 PEG_METHOD_EXIT();
160 }
161
|
162 kumpf 1.24 void AuthenticationInfoRep::setAuthType(const String& authType)
|
163 kumpf 1.1 {
164 PEG_METHOD_ENTER(
165 TRC_AUTHENTICATION, "AuthenticationInfoRep::setAuthType");
166
167 _authType = authType;
168
169 PEG_METHOD_EXIT();
170 }
|
171 gerarda 1.5
|
172 kumpf 1.19 void AuthenticationInfoRep::setClientCertificateChain(
173 Array<SSLCertificateInfo*> clientCertificate)
|
174 h.sterling 1.14 {
175 PEG_METHOD_ENTER(TRC_AUTHENTICATION,
|
176 h.sterling 1.16 "AuthenticationInfoRep::setClientCertificateChain");
|
177 h.sterling 1.14
178 _clientCertificate = clientCertificate;
179
180 PEG_METHOD_EXIT();
181 }
182
|
183 kumpf 1.1 PEGASUS_NAMESPACE_END
|