Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(389)

Side by Side Diff: chrome/browser/internal_auth.h

Issue 6683060: Private API for extensions like ssh-client that need access to TCP. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sigh-nedness Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_INTERNAL_AUTH_H_
6 #define CHROME_BROWSER_INTERNAL_AUTH_H_
7 #pragma once
8
9 #include <map>
10 #include <string>
11 #include <vector>
12
13 class InternalAuthGetTokenFunction;
14
15 namespace browser {
16
17 // Helper fuction to convert list of var=value strings into map. Returns true
18 // on success.
19 bool ConvertArgListToVarValueMap(
20 const std::vector<std::string>& arg_list,
21 std::map<std::string, std::string>* out);
22
23 // Call InternalAuthVerification methods on any thread.
24 class InternalAuthVerification {
25 public:
26 // Used by consumer of token in order to verify credentials.
27 static bool VerifyToken(
28 const std::string& token,
29 const std::string& holder_id,
30 const std::vector<std::string>& arg_list);
31
32 // Used by consumer of token in order to verify credentials.
33 static bool VerifyToken(
34 const std::string& token,
35 const std::string& holder_id,
36 const std::map<std::string, std::string>& var_value_map);
37
38 private:
39 friend class InternalAuthGeneration;
40
41 // We allow easy separation of InternalAuthVerification and
42 // InternalAuthGeneration so the only thing they share is a key (regenerated
43 // infrequently).
44 static void ChangeKey(const std::string& key);
45 };
46
47 // Call InternalAuthGeneration methods on UI thread.
48 class InternalAuthGeneration {
49 private:
50 friend class ::InternalAuthGetTokenFunction;
51
52 // Generates token; do this only after successful check of credentials.
53 static std::string GenerateToken(
54 const std::string& holder_id,
55 const std::vector<std::string>& arg_list);
56
57 // Generates token; do this only after successful check of credentials.
58 static std::string GenerateToken(
59 const std::string& holder_id,
60 const std::map<std::string, std::string>& var_value_map);
61 };
62
63 } // namespace browser
64
65 #endif // CHROME_BROWSER_INTERNAL_AUTH_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698