Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_NET_SPDYPROXY_HTTP_AUTH_HANDLER_SPDYPROXY_H_ | |
| 6 #define CHROME_BROWSER_NET_SPDYPROXY_HTTP_AUTH_HANDLER_SPDYPROXY_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 | |
| 10 #include "base/gtest_prod_util.h" | |
| 11 #include "net/http/http_auth_handler.h" | |
| 12 #include "net/http/http_auth_handler_factory.h" | |
| 13 | |
| 14 namespace spdyproxy { | |
| 15 | |
| 16 // Code for handling http SpdyProxy authentication. | |
| 17 class HttpAuthHandlerSpdyProxy : public net::HttpAuthHandler { | |
| 18 public: | |
| 19 class Factory : public net::HttpAuthHandlerFactory { | |
| 20 public: | |
| 21 // Constructs a new spdyproxy handler factory which mints handlers that | |
| 22 // respond to challenges only from the given |authorized_spdyproxy_origin|. | |
| 23 explicit Factory(const GURL& authorized_spdyproxy_origin); | |
| 24 virtual ~Factory(); | |
| 25 | |
| 26 virtual int CreateAuthHandler( | |
| 27 net::HttpAuth::ChallengeTokenizer* challenge, | |
| 28 net::HttpAuth::Target target, | |
| 29 const GURL& origin, | |
| 30 CreateReason reason, | |
| 31 int digest_nonce_count, | |
| 32 const net::BoundNetLog& net_log, | |
| 33 scoped_ptr<HttpAuthHandler>* handler) OVERRIDE; | |
| 34 | |
| 35 private: | |
| 36 // The origin for which we will respond to SpdyProxy auth challenges. | |
| 37 GURL authorized_spdyproxy_origin_; | |
| 38 }; | |
| 39 | |
| 40 // Constructs a new spdyproxy handler which responds to challenges | |
| 41 // from the given |authorized_spdyproxy_origin|. | |
| 42 explicit HttpAuthHandlerSpdyProxy( | |
| 43 const GURL& authorized_spdyproxy_origin); | |
| 44 | |
| 45 virtual net::HttpAuth::AuthorizationResult HandleAnotherChallenge( | |
|
sky
2012/09/28 17:14:30
Keep all your overrides grouped together with no n
Michael Piatek
2012/09/28 17:51:30
Done.
| |
| 46 net::HttpAuth::ChallengeTokenizer* challenge) OVERRIDE; | |
| 47 | |
| 48 virtual bool NeedsIdentity() OVERRIDE; | |
| 49 virtual bool AllowsDefaultCredentials() OVERRIDE; | |
| 50 | |
| 51 virtual bool AllowsExplicitCredentials() OVERRIDE; | |
| 52 | |
| 53 private: | |
| 54 FRIEND_TEST_ALL_PREFIXES(HttpAuthHandlerSpdyProxyTest, ParseChallenge); | |
| 55 | |
| 56 virtual ~HttpAuthHandlerSpdyProxy() {} | |
| 57 | |
| 58 virtual bool Init(net::HttpAuth::ChallengeTokenizer* challenge) OVERRIDE; | |
| 59 | |
| 60 virtual int GenerateAuthTokenImpl(const net::AuthCredentials* credentials, | |
| 61 const net::HttpRequestInfo* request, | |
| 62 const net::CompletionCallback& callback, | |
| 63 std::string* auth_token) OVERRIDE; | |
| 64 | |
| 65 bool ParseChallenge(net::HttpAuth::ChallengeTokenizer* challenge); | |
| 66 | |
| 67 bool ParseChallengeProperty(const std::string& name, | |
| 68 const std::string& value); | |
| 69 | |
| 70 // The origin for which we will respond to SpdyProxy auth challenges. | |
| 71 GURL authorized_spdyproxy_origin_; | |
| 72 | |
| 73 // The ps token, encoded as UTF-8. | |
| 74 std::string ps_token_; | |
| 75 }; | |
|
sky
2012/09/28 17:14:30
DISALLOW_CO..
Michael Piatek
2012/09/28 17:51:30
Done.
| |
| 76 | |
| 77 } // namespace spdyproxy | |
| 78 | |
| 79 #endif // CHROME_BROWSER_NET_SPDYPROXY_HTTP_AUTH_HANDLER_SPDYPROXY_H_ | |
| OLD | NEW |