Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_CONTROLLER_H_ | 5 #ifndef NET_HTTP_HTTP_AUTH_CONTROLLER_H_ |
| 6 #define NET_HTTP_HTTP_AUTH_CONTROLLER_H_ | 6 #define NET_HTTP_HTTP_AUTH_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 35 // The arguments are self explanatory except possibly for |auth_url|, which | 35 // The arguments are self explanatory except possibly for |auth_url|, which |
| 36 // should be both the auth target and auth path in a single url argument. | 36 // should be both the auth target and auth path in a single url argument. |
| 37 HttpAuthController(HttpAuth::Target target, | 37 HttpAuthController(HttpAuth::Target target, |
| 38 const GURL& auth_url, | 38 const GURL& auth_url, |
| 39 HttpAuthCache* http_auth_cache, | 39 HttpAuthCache* http_auth_cache, |
| 40 HttpAuthHandlerFactory* http_auth_handler_factory); | 40 HttpAuthHandlerFactory* http_auth_handler_factory); |
| 41 | 41 |
| 42 // Generate an authentication token for |target| if necessary. The return | 42 // Generate an authentication token for |target| if necessary. The return |
| 43 // value is a net error code. |OK| will be returned both in the case that | 43 // value is a net error code. |OK| will be returned both in the case that |
| 44 // a token is correctly generated synchronously, as well as when no tokens | 44 // a token is correctly generated synchronously, as well as when no tokens |
| 45 // were necessary. | 45 // were necessary. |
|
mmenke
2016/10/04 19:42:14
We're returning OK, but don't seem to be generatin
asanka
2016/10/06 14:16:35
Yeah, we'll need to update the documentation. It w
| |
| 46 virtual int MaybeGenerateAuthToken(const HttpRequestInfo* request, | 46 virtual int MaybeGenerateAuthToken(const HttpRequestInfo* request, |
| 47 const CompletionCallback& callback, | 47 const CompletionCallback& callback, |
| 48 const NetLogWithSource& net_log); | 48 const NetLogWithSource& net_log); |
| 49 | 49 |
| 50 // Adds either the proxy auth header, or the origin server auth header, | 50 // Adds either the proxy auth header, or the origin server auth header, |
| 51 // as specified by |target_|. | 51 // as specified by |target_|. |
| 52 virtual void AddAuthorizationHeader( | 52 virtual void AddAuthorizationHeader( |
| 53 HttpRequestHeaders* authorization_headers); | 53 HttpRequestHeaders* authorization_headers); |
| 54 | 54 |
| 55 // Checks for and handles HTTP status code 401 or 407. | 55 // Checks for and handles HTTP status code 401 or 407. |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 103 | 103 |
| 104 // Sets |identity_| to the next identity that the transaction should try. It | 104 // Sets |identity_| to the next identity that the transaction should try. It |
| 105 // chooses candidates by searching the auth cache and the URL for a | 105 // chooses candidates by searching the auth cache and the URL for a |
| 106 // username:password. Returns true if an identity was found. | 106 // username:password. Returns true if an identity was found. |
| 107 bool SelectNextAuthIdentityToTry(); | 107 bool SelectNextAuthIdentityToTry(); |
| 108 | 108 |
| 109 // Populates auth_info_ with the challenge information, so that | 109 // Populates auth_info_ with the challenge information, so that |
| 110 // URLRequestHttpJob can prompt for credentials. | 110 // URLRequestHttpJob can prompt for credentials. |
| 111 void PopulateAuthChallenge(); | 111 void PopulateAuthChallenge(); |
| 112 | 112 |
| 113 // If |result| indicates a permanent failure, disables the current | 113 // Handle the result of calling GenerateAuthToken on an HttpAuthHandler. The |
| 114 // auth scheme for this controller and returns true. Returns false | 114 // return value of this function should be used as the return value of the |
| 115 // otherwise. | 115 // GenerateAuthToken operation. |
| 116 bool DisableOnAuthHandlerResult(int result); | 116 int HandleGenerateTokenResult(int result); |
| 117 | 117 |
| 118 void OnIOComplete(int result); | 118 void OnIOComplete(int result); |
| 119 | 119 |
| 120 // Indicates if this handler is for Proxy auth or Server auth. | 120 // Indicates if this handler is for Proxy auth or Server auth. |
| 121 HttpAuth::Target target_; | 121 HttpAuth::Target target_; |
| 122 | 122 |
| 123 // Holds the {scheme, host, path, port} for the authentication target. | 123 // Holds the {scheme, host, path, port} for the authentication target. |
| 124 const GURL auth_url_; | 124 const GURL auth_url_; |
| 125 | 125 |
| 126 // Holds the {scheme, host, port} for the authentication target. | 126 // Holds the {scheme, host, port} for the authentication target. |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 163 HttpAuthHandlerFactory* const http_auth_handler_factory_; | 163 HttpAuthHandlerFactory* const http_auth_handler_factory_; |
| 164 | 164 |
| 165 std::set<HttpAuth::Scheme> disabled_schemes_; | 165 std::set<HttpAuth::Scheme> disabled_schemes_; |
| 166 | 166 |
| 167 CompletionCallback callback_; | 167 CompletionCallback callback_; |
| 168 }; | 168 }; |
| 169 | 169 |
| 170 } // namespace net | 170 } // namespace net |
| 171 | 171 |
| 172 #endif // NET_HTTP_HTTP_AUTH_CONTROLLER_H_ | 172 #endif // NET_HTTP_HTTP_AUTH_CONTROLLER_H_ |
| OLD | NEW |