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

Side by Side Diff: chromeos/login/auth/user_context.h

Issue 1412813003: This CL replaces user_manager::UserID with AccountId. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@468875--Chrome-OS-handles-deletion-of-Gmail-account-poorly--Create-AccountID-structure-part2--user_names
Patch Set: Rebased. Created 5 years, 2 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
OLDNEW
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"
11 #include "chromeos/login/auth/key.h" 11 #include "chromeos/login/auth/key.h"
12 #include "components/signin/core/account_id/account_id.h"
12 #include "components/user_manager/user_type.h" 13 #include "components/user_manager/user_type.h"
13 14
15 class AccountId;
16
14 namespace chromeos { 17 namespace chromeos {
15 18
16 // Information that is passed around while authentication is in progress. The 19 // Information that is passed around while authentication is in progress. The
17 // credentials may consist of a |user_id_|, |key_| pair or a GAIA |auth_code_|. 20 // credentials may consist of a |user_id_|, |key_| pair or a GAIA |auth_code_|.
18 // The |user_id_hash_| is used to locate the user's home directory 21 // The |user_id_hash_| is used to locate the user's home directory
19 // mount point for the user. It is set when the mount has been completed. 22 // mount point for the user. It is set when the mount has been completed.
20 class CHROMEOS_EXPORT UserContext { 23 class CHROMEOS_EXPORT UserContext {
21 public: 24 public:
22 // The authentication flow used during sign-in. 25 // The authentication flow used during sign-in.
23 enum AuthFlow { 26 enum AuthFlow {
24 // Online authentication against GAIA. GAIA did not redirect to a SAML IdP. 27 // Online authentication against GAIA. GAIA did not redirect to a SAML IdP.
25 AUTH_FLOW_GAIA_WITHOUT_SAML, 28 AUTH_FLOW_GAIA_WITHOUT_SAML,
26 // Online authentication against GAIA. GAIA redirected to a SAML IdP. 29 // Online authentication against GAIA. GAIA redirected to a SAML IdP.
27 AUTH_FLOW_GAIA_WITH_SAML, 30 AUTH_FLOW_GAIA_WITH_SAML,
28 // Offline authentication against a cached key. 31 // Offline authentication against a cached key.
29 AUTH_FLOW_OFFLINE, 32 AUTH_FLOW_OFFLINE,
30 // Offline authentication using and Easy unlock device (e.g. a phone). 33 // Offline authentication using and Easy unlock device (e.g. a phone).
31 AUTH_FLOW_EASY_UNLOCK, 34 AUTH_FLOW_EASY_UNLOCK,
32 // Easy bootstrap flow. 35 // Easy bootstrap flow.
33 AUTH_FLOW_EASY_BOOTSTRAP 36 AUTH_FLOW_EASY_BOOTSTRAP
34 }; 37 };
35 38
36 UserContext(); 39 UserContext();
37 UserContext(const UserContext& other); 40 UserContext(const UserContext& other);
38 explicit UserContext(const std::string& user_id); 41 explicit UserContext(const AccountId& user_id);
39 UserContext(user_manager::UserType user_type, const std::string& user_id); 42 UserContext(user_manager::UserType user_type, const std::string& user_id);
40 ~UserContext(); 43 ~UserContext();
41 44
42 bool operator==(const UserContext& context) const; 45 bool operator==(const UserContext& context) const;
43 bool operator!=(const UserContext& context) const; 46 bool operator!=(const UserContext& context) const;
44 47
45 const std::string& GetUserID() const; 48 const AccountId& GetUserID() const;
achuithb 2015/10/23 00:08:52 I think this should be GetAccountID(). I know it's
Alexander Alekseev 2015/10/23 09:11:24 Done.
46 const std::string& GetGaiaID() const; 49 const std::string& GetGaiaID() const;
47 const Key* GetKey() const; 50 const Key* GetKey() const;
48 Key* GetKey(); 51 Key* GetKey();
49 const std::string& GetAuthCode() const; 52 const std::string& GetAuthCode() const;
50 const std::string& GetRefreshToken() const; 53 const std::string& GetRefreshToken() const;
51 const std::string& GetAccessToken() const; 54 const std::string& GetAccessToken() const;
52 const std::string& GetUserIDHash() const; 55 const std::string& GetUserIDHash() const;
53 bool IsUsingOAuth() const; 56 bool IsUsingOAuth() const;
54 AuthFlow GetAuthFlow() const; 57 AuthFlow GetAuthFlow() const;
55 user_manager::UserType GetUserType() const; 58 user_manager::UserType GetUserType() const;
(...skipping 15 matching lines...) Expand all
71 void SetAuthFlow(AuthFlow auth_flow); 74 void SetAuthFlow(AuthFlow auth_flow);
72 void SetUserType(user_manager::UserType user_type); 75 void SetUserType(user_manager::UserType user_type);
73 void SetPublicSessionLocale(const std::string& locale); 76 void SetPublicSessionLocale(const std::string& locale);
74 void SetPublicSessionInputMethod(const std::string& input_method); 77 void SetPublicSessionInputMethod(const std::string& input_method);
75 void SetDeviceId(const std::string& device_id); 78 void SetDeviceId(const std::string& device_id);
76 void SetGAPSCookie(const std::string& gaps_cookie); 79 void SetGAPSCookie(const std::string& gaps_cookie);
77 80
78 void ClearSecrets(); 81 void ClearSecrets();
79 82
80 private: 83 private:
81 std::string user_id_; 84 AccountId user_id_;
achuithb 2015/10/23 00:08:51 account_id_
Alexander Alekseev 2015/10/23 09:11:24 Done.
82 std::string gaia_id_; 85 std::string gaia_id_;
83 Key key_; 86 Key key_;
84 std::string auth_code_; 87 std::string auth_code_;
85 std::string refresh_token_; 88 std::string refresh_token_;
86 std::string access_token_; // OAuthLogin scoped access token. 89 std::string access_token_; // OAuthLogin scoped access token.
87 std::string user_id_hash_; 90 std::string user_id_hash_;
88 bool is_using_oauth_; 91 bool is_using_oauth_;
89 AuthFlow auth_flow_; 92 AuthFlow auth_flow_;
90 user_manager::UserType user_type_; 93 user_manager::UserType user_type_;
91 std::string public_session_locale_; 94 std::string public_session_locale_;
92 std::string public_session_input_method_; 95 std::string public_session_input_method_;
93 std::string device_id_; 96 std::string device_id_;
94 std::string gaps_cookie_; 97 std::string gaps_cookie_;
95 }; 98 };
96 99
97 } // namespace chromeos 100 } // namespace chromeos
98 101
99 #endif // CHROMEOS_LOGIN_AUTH_USER_CONTEXT_H_ 102 #endif // CHROMEOS_LOGIN_AUTH_USER_CONTEXT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698