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