[M85 Dev][EFL] Fix errors to generate ninja files
[platform/framework/web/chromium-efl.git] / chrome / browser / internal_auth.h
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_INTERNAL_AUTH_H_
6 #define CHROME_BROWSER_INTERNAL_AUTH_H_
7
8 #include <map>
9 #include <string>
10
11 #include "base/gtest_prod_util.h"
12 #include "base/macros.h"
13
14 // Call InternalAuthVerification methods on any thread.
15 class InternalAuthVerification {
16  public:
17   // Used by consumer of passport in order to verify credentials.
18   static bool VerifyPassport(
19       const std::string& passport,
20       const std::string& domain,
21       const std::map<std::string, std::string>& var_value_map);
22
23  private:
24   friend class InternalAuthGeneration;
25   friend class InternalAuthVerificationService;
26   friend class InternalAuthGenerationService;
27   FRIEND_TEST_ALL_PREFIXES(InternalAuthTest, ExpirationAndBruteForce);
28
29   // We allow for easy separation of InternalAuthVerification and
30   // InternalAuthGeneration so the only thing they share (besides time) is
31   // a key (regenerated infrequently).
32   static void ChangeKey(const std::string& key);
33
34 #ifdef UNIT_TEST
35   static void set_verification_window_seconds(int seconds) {
36     verification_window_seconds_ = seconds;
37   }
38 #endif
39
40   static int get_verification_window_ticks();
41
42   static int verification_window_seconds_;
43
44   DISALLOW_IMPLICIT_CONSTRUCTORS(InternalAuthVerification);
45 };
46
47 // Not thread-safe. Make all calls on the same thread (UI thread).
48 class InternalAuthGeneration {
49  private:
50   FRIEND_TEST_ALL_PREFIXES(InternalAuthTest, BasicGeneration);
51   FRIEND_TEST_ALL_PREFIXES(InternalAuthTest, DoubleGeneration);
52   FRIEND_TEST_ALL_PREFIXES(InternalAuthTest, BadGeneration);
53   FRIEND_TEST_ALL_PREFIXES(InternalAuthTest, BasicVerification);
54   FRIEND_TEST_ALL_PREFIXES(InternalAuthTest, BruteForce);
55   FRIEND_TEST_ALL_PREFIXES(InternalAuthTest, ExpirationAndBruteForce);
56   FRIEND_TEST_ALL_PREFIXES(InternalAuthTest, ChangeKey);
57
58   // Generates passport; do this only after successful check of credentials.
59   static std::string GeneratePassport(
60       const std::string& domain,
61       const std::map<std::string, std::string>& var_value_map);
62
63   // Used only by tests.
64   static void GenerateNewKey();
65 };
66
67 #endif  // CHROME_BROWSER_INTERNAL_AUTH_H_