#ifndef CHROME_BROWSER_NET_SPDYPROXY_HTTP_AUTH_HANDLER_SPDYPROXY_H_
#define CHROME_BROWSER_NET_SPDYPROXY_HTTP_AUTH_HANDLER_SPDYPROXY_H_
#include <string>
#include <vector>
#include "base/gtest_prod_util.h"
#include "net/http/http_auth_handler.h"
#include "net/http/http_auth_handler_factory.h"
namespace spdyproxy {
class HttpAuthHandlerSpdyProxy : public net::HttpAuthHandler {
public:
class Factory : public net::HttpAuthHandlerFactory {
public:
explicit Factory(const std::vector<GURL>& authorized_spdyproxy_origins);
virtual ~Factory();
virtual int CreateAuthHandler(
net::HttpAuthChallengeTokenizer* challenge,
net::HttpAuth::Target target,
const GURL& origin,
CreateReason reason,
int digest_nonce_count,
const net::BoundNetLog& net_log,
scoped_ptr<HttpAuthHandler>* handler) OVERRIDE;
private:
std::vector<GURL> authorized_spdyproxy_origins_;
};
HttpAuthHandlerSpdyProxy() {}
virtual net::HttpAuth::AuthorizationResult HandleAnotherChallenge(
net::HttpAuthChallengeTokenizer* challenge) OVERRIDE;
virtual bool NeedsIdentity() OVERRIDE;
virtual bool AllowsDefaultCredentials() OVERRIDE;
virtual bool AllowsExplicitCredentials() OVERRIDE;
private:
FRIEND_TEST_ALL_PREFIXES(HttpAuthHandlerSpdyProxyTest, ParseChallenge);
virtual ~HttpAuthHandlerSpdyProxy();
virtual bool Init(net::HttpAuthChallengeTokenizer* challenge) OVERRIDE;
virtual int GenerateAuthTokenImpl(const net::AuthCredentials* credentials,
const net::HttpRequestInfo* request,
const net::CompletionCallback& callback,
std::string* auth_token) OVERRIDE;
bool ParseChallenge(net::HttpAuthChallengeTokenizer* challenge);
bool ParseChallengeProperty(const std::string& name,
const std::string& value);
std::string ps_token_;
DISALLOW_COPY_AND_ASSIGN(HttpAuthHandlerSpdyProxy);
};
}
#endif