Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(459)

Side by Side Diff: net/http/http_auth_preferences.cc

Issue 1414313002: Allow dynamic updating of authentication policies (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Respond to cbentzel@'s comments. Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/http/http_auth_preferences.h ('k') | net/http/http_auth_preferences_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "base/strings/string_split.h"
6 #include "net/http/http_auth_filter.h"
7 #include "net/http/http_auth_preferences.h"
8 #include "net/http/url_security_manager.h"
9
10 namespace net {
11
12 HttpAuthPreferences::HttpAuthPreferences(
13 const std::vector<std::string>& auth_schemes
14 #if defined(OS_POSIX) && !defined(OS_ANDROID)
15 ,
16 const std::string& gssapi_library_name
17 #endif
18 )
19 : auth_schemes_(auth_schemes.begin(), auth_schemes.end()),
20 negotiate_disable_cname_lookup_(false),
21 negotiate_enable_port_(false),
22 #if defined(OS_POSIX) && !defined(OS_ANDROID)
23 gssapi_library_name_(gssapi_library_name),
24 #endif
25 security_manager_(URLSecurityManager::Create()) {
26 }
27
28 HttpAuthPreferences::~HttpAuthPreferences() {}
29
30 bool HttpAuthPreferences::IsSupportedScheme(const std::string& scheme) const {
31 return auth_schemes_.count(scheme) == 1;
32 }
33
34 bool HttpAuthPreferences::NegotiateDisableCnameLookup() const {
35 return negotiate_disable_cname_lookup_;
36 }
37
38 bool HttpAuthPreferences::NegotiateEnablePort() const {
39 return negotiate_enable_port_;
40 }
41
42 #if defined(OS_ANDROID)
43 std::string HttpAuthPreferences::AuthAndroidNegotiateAccountType() const {
44 return auth_android_negotiate_account_type_;
45 }
46 #endif
47 #if defined(OS_POSIX) && !defined(OS_ANDROID)
48 std::string HttpAuthPreferences::GssapiLibraryName() const {
49 return gssapi_library_name_;
50 }
51 #endif
52
53 bool HttpAuthPreferences::CanUseDefaultCredentials(
54 const GURL& auth_origin) const {
55 return security_manager_->CanUseDefaultCredentials(auth_origin);
56 }
57
58 bool HttpAuthPreferences::CanDelegate(const GURL& auth_origin) const {
59 return security_manager_->CanDelegate(auth_origin);
60 }
61
62 void HttpAuthPreferences::set_server_whitelist(
63 const std::string& server_whitelist) {
64 if (server_whitelist.empty()) {
65 security_manager_->SetDefaultWhitelist(scoped_ptr<HttpAuthFilter>());
66 } else {
67 security_manager_->SetDefaultWhitelist(scoped_ptr<HttpAuthFilter>(
68 new net::HttpAuthFilterWhitelist(server_whitelist)));
69 }
70 }
71
72 void HttpAuthPreferences::set_delegate_whitelist(
73 const std::string& delegate_whitelist) {
74 if (delegate_whitelist.empty()) {
75 security_manager_->SetDelegateWhitelist(scoped_ptr<HttpAuthFilter>());
76 } else {
77 security_manager_->SetDelegateWhitelist(scoped_ptr<HttpAuthFilter>(
78 new net::HttpAuthFilterWhitelist(delegate_whitelist)));
79 }
80 }
81
82 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_auth_preferences.h ('k') | net/http/http_auth_preferences_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698