1 karl 1.13 //%2006////////////////////////////////////////////////////////////////////////
|
2 mike 1.2 //
|
3 karl 1.9 // 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.7 // IBM Corp.; EMC Corporation, The Open Group.
|
7 karl 1.9 // 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.10 // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
10 // EMC Corporation; VERITAS Software Corporation; The Open Group.
|
11 karl 1.13 // Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
12 // EMC Corporation; Symantec Corporation; The Open Group.
|
13 mike 1.2 //
14 // Permission is hereby granted, free of charge, to any person obtaining a copy
15 // of this software and associated documentation files (the "Software"), to
16 // deal in the Software without restriction, including without limitation the
17 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
18 // sell copies of the Software, and to permit persons to whom the Software is
19 // furnished to do so, subject to the following conditions:
|
20 kumpf 1.6 //
|
21 mike 1.2 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
22 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
23 // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
24 // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
25 // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
26 // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
27 // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
28 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29 //
30 //==============================================================================
31 //
32 // Author: Nag Boranna, Hewlett-Packard Company (nagaraja_boranna@hp.com)
33 //
34 // Modified By:
35 //
36 //%/////////////////////////////////////////////////////////////////////////////
37
38 #ifndef Pegasus_ClientAuthenticator_h
39 #define Pegasus_ClientAuthenticator_h
40
41 #include <Pegasus/Common/Config.h>
42 mike 1.2 #include <Pegasus/Common/Message.h>
43 #include <Pegasus/Common/HTTPMessage.h>
44 #include <Pegasus/Client/Linkage.h>
45
|
46 kumpf 1.3
|
47 mike 1.2 PEGASUS_NAMESPACE_BEGIN
48
49
50 /** This class owns client authentication
51 */
52 class PEGASUS_CLIENT_LINKAGE ClientAuthenticator
53 {
54 public:
55
|
56 kumpf 1.5 enum AuthType { NONE, BASIC, DIGEST, LOCAL, LOCALPRIVILEGED };
|
57 mike 1.2
58 /** Constuctor. */
59 ClientAuthenticator();
60
61 /** Destructor. */
62 ~ClientAuthenticator();
63
64 /** Build the request authentication header.
65 */
66 String buildRequestAuthHeader();
67
|
68 mateus.baur 1.12 /** Check whether the response header has authentication challenge
|
69 mike 1.2 (i.e, WWW-Authenticate header).
70 */
71 Boolean checkResponseHeaderForChallenge(Array<HTTPHeader> headers);
72
73 /** Save the request message for resending on a challenge.
74 */
75 void setRequestMessage(Message* message);
76
|
77 kumpf 1.11 /** Get the request message saved for resending on a challenge while
78 retaining memory ownership for the message.
|
79 mike 1.2 */
80 Message* getRequestMessage();
81
|
82 mateus.baur 1.12 void clearReconnect();
83
|
84 kumpf 1.11 /** Get the request message saved for resending on a challenge and
85 release memory ownership for the message.
86 */
87 Message* releaseRequestMessage();
88
|
89 mike 1.2 /** Clear the request buffer and other authentication informations
90 from the earlier request.
91 */
|
92 kumpf 1.8 void clear();
|
93 mike 1.2
94 /** Set the user name
95 */
96 void setUserName(const String& userName);
97
98 /** Get the user name
99 */
100 String getUserName();
101
102 /** Set the upasswor
103 */
104 void setPassword(const String& password);
105
106 /** Set the authentication type
107 */
108 void setAuthType(AuthType type);
109
110 /** Get the authentication type
111 */
112 AuthType getAuthType();
113
114 mike 1.2 private:
115
|
116 kumpf 1.4 String _buildLocalAuthResponse();
117
|
118 mike 1.2 String _getFileContent(String filePath);
119
|
120 kumpf 1.4 Boolean _parseAuthHeader(
121 const String authHeader,
122 String& authType,
123 String& authRealm);
124
125 String _getSubStringUptoMarker(
126 const char** line,
127 char marker);
128
|
129 kumpf 1.11 AutoPtr<Message> _requestMessage;
|
130 mike 1.2
131 Boolean _challengeReceived;
132
133 String _userName;
134
135 String _password;
|
136 kumpf 1.3
137 String _realm;
|
138 mike 1.2
139 AuthType _authType;
140 };
141
142 PEGASUS_NAMESPACE_END
143
144 #endif /* Pegasus_ClientAuthenticator_h */
|