| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 CHROME_BROWSER_INTERNAL_AUTH_H_ | 5 #ifndef CHROME_BROWSER_INTERNAL_AUTH_H_ |
| 6 #define CHROME_BROWSER_INTERNAL_AUTH_H_ | 6 #define CHROME_BROWSER_INTERNAL_AUTH_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <string> | 10 #include <string> |
| 11 | 11 |
| 12 #include "base/gtest_prod_util.h" | 12 #include "base/gtest_prod_util.h" |
| 13 | 13 |
| 14 namespace extensions { |
| 14 class WebSocketProxyPrivateGetPassportForTCPFunction; | 15 class WebSocketProxyPrivateGetPassportForTCPFunction; |
| 15 class WebSocketProxyPrivateGetURLForTCPFunction; | 16 class WebSocketProxyPrivateGetURLForTCPFunction; |
| 17 } // namespace extensions |
| 16 | 18 |
| 17 namespace browser { | 19 namespace browser { |
| 18 | 20 |
| 19 // Call InternalAuthVerification methods on any thread. | 21 // Call InternalAuthVerification methods on any thread. |
| 20 class InternalAuthVerification { | 22 class InternalAuthVerification { |
| 21 public: | 23 public: |
| 22 // Used by consumer of passport in order to verify credentials. | 24 // Used by consumer of passport in order to verify credentials. |
| 23 static bool VerifyPassport( | 25 static bool VerifyPassport( |
| 24 const std::string& passport, | 26 const std::string& passport, |
| 25 const std::string& domain, | 27 const std::string& domain, |
| (...skipping 26 matching lines...) Expand all Loading... |
| 52 class InternalAuthGeneration { | 54 class InternalAuthGeneration { |
| 53 private: | 55 private: |
| 54 // Generates passport; do this only after successful check of credentials. | 56 // Generates passport; do this only after successful check of credentials. |
| 55 static std::string GeneratePassport( | 57 static std::string GeneratePassport( |
| 56 const std::string& domain, | 58 const std::string& domain, |
| 57 const std::map<std::string, std::string>& var_value_map); | 59 const std::map<std::string, std::string>& var_value_map); |
| 58 | 60 |
| 59 // Used only by tests. | 61 // Used only by tests. |
| 60 static void GenerateNewKey(); | 62 static void GenerateNewKey(); |
| 61 | 63 |
| 62 friend class ::WebSocketProxyPrivateGetPassportForTCPFunction; | 64 friend class extensions::WebSocketProxyPrivateGetPassportForTCPFunction; |
| 63 friend class ::WebSocketProxyPrivateGetURLForTCPFunction; | 65 friend class extensions::WebSocketProxyPrivateGetURLForTCPFunction; |
| 64 | 66 |
| 65 FRIEND_TEST_ALL_PREFIXES(InternalAuthTest, BasicGeneration); | 67 FRIEND_TEST_ALL_PREFIXES(InternalAuthTest, BasicGeneration); |
| 66 FRIEND_TEST_ALL_PREFIXES(InternalAuthTest, DoubleGeneration); | 68 FRIEND_TEST_ALL_PREFIXES(InternalAuthTest, DoubleGeneration); |
| 67 FRIEND_TEST_ALL_PREFIXES(InternalAuthTest, BadGeneration); | 69 FRIEND_TEST_ALL_PREFIXES(InternalAuthTest, BadGeneration); |
| 68 FRIEND_TEST_ALL_PREFIXES(InternalAuthTest, BasicVerification); | 70 FRIEND_TEST_ALL_PREFIXES(InternalAuthTest, BasicVerification); |
| 69 FRIEND_TEST_ALL_PREFIXES(InternalAuthTest, BruteForce); | 71 FRIEND_TEST_ALL_PREFIXES(InternalAuthTest, BruteForce); |
| 70 FRIEND_TEST_ALL_PREFIXES(InternalAuthTest, ExpirationAndBruteForce); | 72 FRIEND_TEST_ALL_PREFIXES(InternalAuthTest, ExpirationAndBruteForce); |
| 71 FRIEND_TEST_ALL_PREFIXES(InternalAuthTest, ChangeKey); | 73 FRIEND_TEST_ALL_PREFIXES(InternalAuthTest, ChangeKey); |
| 72 }; | 74 }; |
| 73 | 75 |
| 74 } // namespace browser | 76 } // namespace browser |
| 75 | 77 |
| 76 #endif // CHROME_BROWSER_INTERNAL_AUTH_H_ | 78 #endif // CHROME_BROWSER_INTERNAL_AUTH_H_ |
| OLD | NEW |