| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef NET_HTTP_HTTP_AUTH_GSSAPI_POSIX_H_ | 5 #ifndef NET_HTTP_HTTP_AUTH_GSSAPI_POSIX_H_ |
| 6 #define NET_HTTP_HTTP_AUTH_GSSAPI_POSIX_H_ | 6 #define NET_HTTP_HTTP_AUTH_GSSAPI_POSIX_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <gssapi.h> | 9 #include <gssapi.h> |
| 10 | 10 |
| 11 #include <string> | 11 #include <string> |
| 12 | 12 |
| 13 #include "base/gtest_prod_util.h" | 13 #include "base/gtest_prod_util.h" |
| 14 #include "base/native_library.h" | 14 #include "base/native_library.h" |
| 15 #include "base/string16.h" | |
| 16 #include "net/base/net_export.h" | 15 #include "net/base/net_export.h" |
| 17 #include "net/http/http_auth.h" | 16 #include "net/http/http_auth.h" |
| 18 | 17 |
| 19 namespace net { | 18 namespace net { |
| 20 | 19 |
| 21 NET_EXPORT_PRIVATE extern gss_OID CHROME_GSS_C_NT_HOSTBASED_SERVICE_X; | 20 NET_EXPORT_PRIVATE extern gss_OID CHROME_GSS_C_NT_HOSTBASED_SERVICE_X; |
| 22 NET_EXPORT_PRIVATE extern gss_OID CHROME_GSS_C_NT_HOSTBASED_SERVICE; | 21 NET_EXPORT_PRIVATE extern gss_OID CHROME_GSS_C_NT_HOSTBASED_SERVICE; |
| 23 NET_EXPORT_PRIVATE extern gss_OID CHROME_GSS_KRB5_MECH_OID_DESC; | 22 NET_EXPORT_PRIVATE extern gss_OID CHROME_GSS_KRB5_MECH_OID_DESC; |
| 24 | 23 |
| 25 // GSSAPILibrary is introduced so unit tests can mock the calls to the GSSAPI | 24 // GSSAPILibrary is introduced so unit tests can mock the calls to the GSSAPI |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 | 237 |
| 239 HttpAuth::AuthorizationResult ParseChallenge( | 238 HttpAuth::AuthorizationResult ParseChallenge( |
| 240 HttpAuth::ChallengeTokenizer* tok); | 239 HttpAuth::ChallengeTokenizer* tok); |
| 241 | 240 |
| 242 // Generates an authentication token. | 241 // Generates an authentication token. |
| 243 // The return value is an error code. If it's not |OK|, the value of | 242 // The return value is an error code. If it's not |OK|, the value of |
| 244 // |*auth_token| is unspecified. | 243 // |*auth_token| is unspecified. |
| 245 // |spn| is the Service Principal Name of the server that the token is | 244 // |spn| is the Service Principal Name of the server that the token is |
| 246 // being generated for. | 245 // being generated for. |
| 247 // If this is the first round of a multiple round scheme, credentials are | 246 // If this is the first round of a multiple round scheme, credentials are |
| 248 // obtained using |*username| and |*password|. If |username| and |password| | 247 // obtained using |*credentials|. If |credentials| is NULL, the default |
| 249 // are NULL, the default credentials are used instead. | 248 // credentials are used instead. |
| 250 int GenerateAuthToken(const string16* username, | 249 int GenerateAuthToken(const AuthCredentials* credentials, |
| 251 const string16* password, | |
| 252 const std::wstring& spn, | 250 const std::wstring& spn, |
| 253 std::string* auth_token); | 251 std::string* auth_token); |
| 254 | 252 |
| 255 // Delegation is allowed on the Kerberos ticket. This allows certain servers | 253 // Delegation is allowed on the Kerberos ticket. This allows certain servers |
| 256 // to act as the user, such as an IIS server retrieiving data from a | 254 // to act as the user, such as an IIS server retrieiving data from a |
| 257 // Kerberized MSSQL server. | 255 // Kerberized MSSQL server. |
| 258 void Delegate(); | 256 void Delegate(); |
| 259 | 257 |
| 260 private: | 258 private: |
| 261 int GetNextSecurityToken(const std::wstring& spn, | 259 int GetNextSecurityToken(const std::wstring& spn, |
| 262 gss_buffer_t in_token, | 260 gss_buffer_t in_token, |
| 263 gss_buffer_t out_token); | 261 gss_buffer_t out_token); |
| 264 | 262 |
| 265 std::string scheme_; | 263 std::string scheme_; |
| 266 gss_OID gss_oid_; | 264 gss_OID gss_oid_; |
| 267 GSSAPILibrary* library_; | 265 GSSAPILibrary* library_; |
| 268 std::string decoded_server_auth_token_; | 266 std::string decoded_server_auth_token_; |
| 269 ScopedSecurityContext scoped_sec_context_; | 267 ScopedSecurityContext scoped_sec_context_; |
| 270 bool can_delegate_; | 268 bool can_delegate_; |
| 271 }; | 269 }; |
| 272 | 270 |
| 273 } // namespace net | 271 } // namespace net |
| 274 | 272 |
| 275 #endif // NET_HTTP_HTTP_AUTH_GSSAPI_POSIX_H_ | 273 #endif // NET_HTTP_HTTP_AUTH_GSSAPI_POSIX_H_ |
| OLD | NEW |