OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_CHROMEOS_LOGIN_AUTH_USER_CONTEXT_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_AUTH_USER_CONTEXT_H_ |
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_AUTH_USER_CONTEXT_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_AUTH_USER_CONTEXT_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "chrome/browser/chromeos/login/auth/key.h" | 10 #include "chrome/browser/chromeos/login/auth/key.h" |
11 #include "chrome/browser/chromeos/login/users/user.h" | |
12 | 11 |
13 namespace chromeos { | 12 namespace chromeos { |
14 | 13 |
15 // Information that is passed around while authentication is in progress. The | 14 // Information that is passed around while authentication is in progress. The |
16 // credentials may consist of a |user_id_|, |key_| pair or a GAIA |auth_code_|. | 15 // credentials may consist of a |user_id_|, |key_| pair or a GAIA |auth_code_|. |
17 // The |user_id_hash_| is used to locate the user's home directory | 16 // The |user_id_hash_| is used to locate the user's home directory |
18 // mount point for the user. It is set when the mount has been completed. | 17 // mount point for the user. It is set when the mount has been completed. |
19 class UserContext { | 18 class UserContext { |
20 public: | 19 public: |
21 // The authentication flow used during sign-in. | 20 // The authentication flow used during sign-in. |
(...skipping 14 matching lines...) Expand all Loading... |
36 bool operator==(const UserContext& context) const; | 35 bool operator==(const UserContext& context) const; |
37 bool operator!=(const UserContext& context) const; | 36 bool operator!=(const UserContext& context) const; |
38 | 37 |
39 const std::string& GetUserID() const; | 38 const std::string& GetUserID() const; |
40 const Key* GetKey() const; | 39 const Key* GetKey() const; |
41 Key* GetKey(); | 40 Key* GetKey(); |
42 const std::string& GetAuthCode() const; | 41 const std::string& GetAuthCode() const; |
43 const std::string& GetUserIDHash() const; | 42 const std::string& GetUserIDHash() const; |
44 bool IsUsingOAuth() const; | 43 bool IsUsingOAuth() const; |
45 AuthFlow GetAuthFlow() const; | 44 AuthFlow GetAuthFlow() const; |
46 User::UserType GetUserType() const; | |
47 | 45 |
48 bool HasCredentials() const; | 46 bool HasCredentials() const; |
49 | 47 |
50 void SetUserID(const std::string& user_id); | 48 void SetUserID(const std::string& user_id); |
51 void SetKey(const Key& key); | 49 void SetKey(const Key& key); |
52 void SetAuthCode(const std::string& auth_code); | 50 void SetAuthCode(const std::string& auth_code); |
53 void SetUserIDHash(const std::string& user_id_hash); | 51 void SetUserIDHash(const std::string& user_id_hash); |
54 void SetIsUsingOAuth(bool is_using_oauth); | 52 void SetIsUsingOAuth(bool is_using_oauth); |
55 void SetAuthFlow(AuthFlow auth_flow); | 53 void SetAuthFlow(AuthFlow auth_flow); |
56 void SetUserType(User::UserType user_type); | |
57 | 54 |
58 void ClearSecrets(); | 55 void ClearSecrets(); |
59 | 56 |
60 private: | 57 private: |
61 std::string user_id_; | 58 std::string user_id_; |
62 Key key_; | 59 Key key_; |
63 std::string auth_code_; | 60 std::string auth_code_; |
64 std::string user_id_hash_; | 61 std::string user_id_hash_; |
65 bool is_using_oauth_; | 62 bool is_using_oauth_; |
66 AuthFlow auth_flow_; | 63 AuthFlow auth_flow_; |
67 User::UserType user_type_; | |
68 }; | 64 }; |
69 | 65 |
70 } // namespace chromeos | 66 } // namespace chromeos |
71 | 67 |
72 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_AUTH_USER_CONTEXT_H_ | 68 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_AUTH_USER_CONTEXT_H_ |
OLD | NEW |