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 CHROMEOS_LOGIN_AUTH_USER_CONTEXT_H_ | 5 #ifndef CHROMEOS_LOGIN_AUTH_USER_CONTEXT_H_ |
6 #define CHROMEOS_LOGIN_AUTH_USER_CONTEXT_H_ | 6 #define CHROMEOS_LOGIN_AUTH_USER_CONTEXT_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "chromeos/chromeos_export.h" | 10 #include "chromeos/chromeos_export.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 AUTH_FLOW_OFFLINE, | 33 AUTH_FLOW_OFFLINE, |
34 // Offline authentication using and Easy unlock device (e.g. a phone). | 34 // Offline authentication using and Easy unlock device (e.g. a phone). |
35 AUTH_FLOW_EASY_UNLOCK, | 35 AUTH_FLOW_EASY_UNLOCK, |
36 // Easy bootstrap flow. | 36 // Easy bootstrap flow. |
37 AUTH_FLOW_EASY_BOOTSTRAP | 37 AUTH_FLOW_EASY_BOOTSTRAP |
38 }; | 38 }; |
39 | 39 |
40 UserContext(); | 40 UserContext(); |
41 UserContext(const UserContext& other); | 41 UserContext(const UserContext& other); |
42 explicit UserContext(const AccountId& account_id); | 42 explicit UserContext(const AccountId& account_id); |
43 UserContext(user_manager::UserType user_type, const std::string& user_id); | 43 UserContext(user_manager::UserType user_type, const AccountId& account_id); |
44 ~UserContext(); | 44 ~UserContext(); |
45 | 45 |
46 bool operator==(const UserContext& context) const; | 46 bool operator==(const UserContext& context) const; |
47 bool operator!=(const UserContext& context) const; | 47 bool operator!=(const UserContext& context) const; |
48 | 48 |
49 const AccountId& GetAccountId() const; | 49 const AccountId& GetAccountId() const; |
50 const std::string& GetGaiaID() const; | 50 const std::string& GetGaiaID() const; |
51 const Key* GetKey() const; | 51 const Key* GetKey() const; |
52 Key* GetKey(); | 52 Key* GetKey(); |
53 const std::string& GetAuthCode() const; | 53 const std::string& GetAuthCode() const; |
54 const std::string& GetRefreshToken() const; | 54 const std::string& GetRefreshToken() const; |
55 const std::string& GetAccessToken() const; | 55 const std::string& GetAccessToken() const; |
56 const std::string& GetUserIDHash() const; | 56 const std::string& GetUserIDHash() const; |
57 bool IsUsingOAuth() const; | 57 bool IsUsingOAuth() const; |
58 AuthFlow GetAuthFlow() const; | 58 AuthFlow GetAuthFlow() const; |
59 user_manager::UserType GetUserType() const; | 59 user_manager::UserType GetUserType() const; |
60 const std::string& GetPublicSessionLocale() const; | 60 const std::string& GetPublicSessionLocale() const; |
61 const std::string& GetPublicSessionInputMethod() const; | 61 const std::string& GetPublicSessionInputMethod() const; |
62 const std::string& GetDeviceId() const; | 62 const std::string& GetDeviceId() const; |
63 const std::string& GetGAPSCookie() const; | 63 const std::string& GetGAPSCookie() const; |
64 | 64 |
65 bool HasCredentials() const; | 65 bool HasCredentials() const; |
66 | 66 |
67 void SetUserID(const std::string& user_id); | 67 void SetAccountId(const AccountId& account_id); |
68 void SetGaiaID(const std::string& gaia_id); | |
69 void SetKey(const Key& key); | 68 void SetKey(const Key& key); |
70 void SetAuthCode(const std::string& auth_code); | 69 void SetAuthCode(const std::string& auth_code); |
71 void SetRefreshToken(const std::string& refresh_token); | 70 void SetRefreshToken(const std::string& refresh_token); |
72 void SetAccessToken(const std::string& access_token); | 71 void SetAccessToken(const std::string& access_token); |
73 void SetUserIDHash(const std::string& user_id_hash); | 72 void SetUserIDHash(const std::string& user_id_hash); |
74 void SetIsUsingOAuth(bool is_using_oauth); | 73 void SetIsUsingOAuth(bool is_using_oauth); |
75 void SetAuthFlow(AuthFlow auth_flow); | 74 void SetAuthFlow(AuthFlow auth_flow); |
76 void SetUserType(user_manager::UserType user_type); | 75 void SetUserType(user_manager::UserType user_type); |
77 void SetPublicSessionLocale(const std::string& locale); | 76 void SetPublicSessionLocale(const std::string& locale); |
78 void SetPublicSessionInputMethod(const std::string& input_method); | 77 void SetPublicSessionInputMethod(const std::string& input_method); |
79 void SetDeviceId(const std::string& device_id); | 78 void SetDeviceId(const std::string& device_id); |
80 void SetGAPSCookie(const std::string& gaps_cookie); | 79 void SetGAPSCookie(const std::string& gaps_cookie); |
81 | 80 |
82 void ClearSecrets(); | 81 void ClearSecrets(); |
83 | 82 |
84 private: | 83 private: |
85 AccountId account_id_; | 84 AccountId account_id_; |
86 std::string gaia_id_; | |
87 Key key_; | 85 Key key_; |
88 std::string auth_code_; | 86 std::string auth_code_; |
89 std::string refresh_token_; | 87 std::string refresh_token_; |
90 std::string access_token_; // OAuthLogin scoped access token. | 88 std::string access_token_; // OAuthLogin scoped access token. |
91 std::string user_id_hash_; | 89 std::string user_id_hash_; |
92 bool is_using_oauth_ = true; | 90 bool is_using_oauth_ = true; |
93 AuthFlow auth_flow_ = AUTH_FLOW_OFFLINE; | 91 AuthFlow auth_flow_ = AUTH_FLOW_OFFLINE; |
94 user_manager::UserType user_type_ = user_manager::USER_TYPE_REGULAR; | 92 user_manager::UserType user_type_ = user_manager::USER_TYPE_REGULAR; |
95 std::string public_session_locale_; | 93 std::string public_session_locale_; |
96 std::string public_session_input_method_; | 94 std::string public_session_input_method_; |
97 std::string device_id_; | 95 std::string device_id_; |
98 std::string gaps_cookie_; | 96 std::string gaps_cookie_; |
99 }; | 97 }; |
100 | 98 |
101 } // namespace chromeos | 99 } // namespace chromeos |
102 | 100 |
103 #endif // CHROMEOS_LOGIN_AUTH_USER_CONTEXT_H_ | 101 #endif // CHROMEOS_LOGIN_AUTH_USER_CONTEXT_H_ |
OLD | NEW |