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 //%/////////////////////////////////////////////////////////////////////////////
33
34 #ifndef Pegasus_ClientAuthenticator_h
35 #define Pegasus_ClientAuthenticator_h
36
37 #include <Pegasus/Common/Config.h>
38 #include <Pegasus/Common/Message.h>
39 #include <Pegasus/Common/HTTPMessage.h>
40 #include <Pegasus/Client/Linkage.h>
41
|
42 kumpf 1.3
|
43 mike 1.2 PEGASUS_NAMESPACE_BEGIN
44
45
|
46 kumpf 1.14 /** This class owns client authentication
|
47 mike 1.2 */
48 class PEGASUS_CLIENT_LINKAGE ClientAuthenticator
49 {
50 public:
51
|
52 kumpf 1.5 enum AuthType { NONE, BASIC, DIGEST, LOCAL, LOCALPRIVILEGED };
|
53 mike 1.2
54 /** Constuctor. */
55 ClientAuthenticator();
56
57 /** Destructor. */
58 ~ClientAuthenticator();
59
60 /** Build the request authentication header.
61 */
62 String buildRequestAuthHeader();
63
|
64 mateus.baur 1.12 /** Check whether the response header has authentication challenge
|
65 mike 1.2 (i.e, WWW-Authenticate header).
66 */
67 Boolean checkResponseHeaderForChallenge(Array<HTTPHeader> headers);
68
69 /** Save the request message for resending on a challenge.
70 */
71 void setRequestMessage(Message* message);
72
|
73 kumpf 1.11 /** Get the request message saved for resending on a challenge while
74 retaining memory ownership for the message.
|
75 mike 1.2 */
76 Message* getRequestMessage();
77
|
78 mateus.baur 1.12 void clearReconnect();
79
|
80 kumpf 1.11 /** Get the request message saved for resending on a challenge and
81 release memory ownership for the message.
82 */
83 Message* releaseRequestMessage();
84
|
85 mike 1.2 /** Clear the request buffer and other authentication informations
86 from the earlier request.
87 */
|
88 kumpf 1.8 void clear();
|
89 mike 1.2
90 /** Set the user name
91 */
92 void setUserName(const String& userName);
93
94 /** Get the user name
95 */
96 String getUserName();
97
98 /** Set the upasswor
99 */
100 void setPassword(const String& password);
101
102 /** Set the authentication type
103 */
104 void setAuthType(AuthType type);
105
106 /** Get the authentication type
107 */
108 AuthType getAuthType();
109
110 mike 1.2 private:
111
|
112 kumpf 1.4 String _buildLocalAuthResponse();
113
|
114 mike 1.2 String _getFileContent(String filePath);
115
|
116 kumpf 1.4 Boolean _parseAuthHeader(
117 const String authHeader,
118 String& authType,
119 String& authRealm);
120
121 String _getSubStringUptoMarker(
122 const char** line,
123 char marker);
124
|
125 kumpf 1.14 AutoPtr<Message> _requestMessage;
|
126 mike 1.2
127 Boolean _challengeReceived;
128
129 String _userName;
130
131 String _password;
|
132 kumpf 1.3
133 String _realm;
|
134 mike 1.2
135 AuthType _authType;
136 };
137
138 PEGASUS_NAMESPACE_END
139
140 #endif /* Pegasus_ClientAuthenticator_h */
|