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

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: Fix Win GN build. Created 5 years, 1 month 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
« no previous file with comments | « chromeos/login/auth/stub_authenticator.cc ('k') | chromeos/login/auth/user_context.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 |account_id_|, |key_| pair or a GAIA
21 // |auth_code_|.
18 // The |user_id_hash_| is used to locate the user's home directory 22 // 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. 23 // mount point for the user. It is set when the mount has been completed.
20 class CHROMEOS_EXPORT UserContext { 24 class CHROMEOS_EXPORT UserContext {
21 public: 25 public:
22 // The authentication flow used during sign-in. 26 // The authentication flow used during sign-in.
23 enum AuthFlow { 27 enum AuthFlow {
24 // Online authentication against GAIA. GAIA did not redirect to a SAML IdP. 28 // Online authentication against GAIA. GAIA did not redirect to a SAML IdP.
25 AUTH_FLOW_GAIA_WITHOUT_SAML, 29 AUTH_FLOW_GAIA_WITHOUT_SAML,
26 // Online authentication against GAIA. GAIA redirected to a SAML IdP. 30 // Online authentication against GAIA. GAIA redirected to a SAML IdP.
27 AUTH_FLOW_GAIA_WITH_SAML, 31 AUTH_FLOW_GAIA_WITH_SAML,
28 // Offline authentication against a cached key. 32 // Offline authentication against a cached key.
29 AUTH_FLOW_OFFLINE, 33 AUTH_FLOW_OFFLINE,
30 // Offline authentication using and Easy unlock device (e.g. a phone). 34 // Offline authentication using and Easy unlock device (e.g. a phone).
31 AUTH_FLOW_EASY_UNLOCK, 35 AUTH_FLOW_EASY_UNLOCK,
32 // Easy bootstrap flow. 36 // Easy bootstrap flow.
33 AUTH_FLOW_EASY_BOOTSTRAP 37 AUTH_FLOW_EASY_BOOTSTRAP
34 }; 38 };
35 39
36 UserContext(); 40 UserContext();
37 UserContext(const UserContext& other); 41 UserContext(const UserContext& other);
38 explicit UserContext(const std::string& user_id); 42 explicit UserContext(const AccountId& account_id);
39 UserContext(user_manager::UserType user_type, const std::string& user_id); 43 UserContext(user_manager::UserType user_type, const std::string& user_id);
40 ~UserContext(); 44 ~UserContext();
41 45
42 bool operator==(const UserContext& context) const; 46 bool operator==(const UserContext& context) const;
43 bool operator!=(const UserContext& context) const; 47 bool operator!=(const UserContext& context) const;
44 48
45 const std::string& GetUserID() const; 49 const AccountId& GetAccountId() const;
46 const std::string& GetGaiaID() const; 50 const std::string& GetGaiaID() const;
47 const Key* GetKey() const; 51 const Key* GetKey() const;
48 Key* GetKey(); 52 Key* GetKey();
49 const std::string& GetAuthCode() const; 53 const std::string& GetAuthCode() const;
50 const std::string& GetRefreshToken() const; 54 const std::string& GetRefreshToken() const;
51 const std::string& GetAccessToken() const; 55 const std::string& GetAccessToken() const;
52 const std::string& GetUserIDHash() const; 56 const std::string& GetUserIDHash() const;
53 bool IsUsingOAuth() const; 57 bool IsUsingOAuth() const;
54 AuthFlow GetAuthFlow() const; 58 AuthFlow GetAuthFlow() const;
55 user_manager::UserType GetUserType() const; 59 user_manager::UserType GetUserType() const;
(...skipping 15 matching lines...) Expand all
71 void SetAuthFlow(AuthFlow auth_flow); 75 void SetAuthFlow(AuthFlow auth_flow);
72 void SetUserType(user_manager::UserType user_type); 76 void SetUserType(user_manager::UserType user_type);
73 void SetPublicSessionLocale(const std::string& locale); 77 void SetPublicSessionLocale(const std::string& locale);
74 void SetPublicSessionInputMethod(const std::string& input_method); 78 void SetPublicSessionInputMethod(const std::string& input_method);
75 void SetDeviceId(const std::string& device_id); 79 void SetDeviceId(const std::string& device_id);
76 void SetGAPSCookie(const std::string& gaps_cookie); 80 void SetGAPSCookie(const std::string& gaps_cookie);
77 81
78 void ClearSecrets(); 82 void ClearSecrets();
79 83
80 private: 84 private:
81 std::string user_id_; 85 AccountId account_id_;
82 std::string gaia_id_; 86 std::string gaia_id_;
83 Key key_; 87 Key key_;
84 std::string auth_code_; 88 std::string auth_code_;
85 std::string refresh_token_; 89 std::string refresh_token_;
86 std::string access_token_; // OAuthLogin scoped access token. 90 std::string access_token_; // OAuthLogin scoped access token.
87 std::string user_id_hash_; 91 std::string user_id_hash_;
88 bool is_using_oauth_; 92 bool is_using_oauth_ = true;
89 AuthFlow auth_flow_; 93 AuthFlow auth_flow_ = AUTH_FLOW_OFFLINE;
90 user_manager::UserType user_type_; 94 user_manager::UserType user_type_ = user_manager::USER_TYPE_REGULAR;
91 std::string public_session_locale_; 95 std::string public_session_locale_;
92 std::string public_session_input_method_; 96 std::string public_session_input_method_;
93 std::string device_id_; 97 std::string device_id_;
94 std::string gaps_cookie_; 98 std::string gaps_cookie_;
95 }; 99 };
96 100
97 } // namespace chromeos 101 } // namespace chromeos
98 102
99 #endif // CHROMEOS_LOGIN_AUTH_USER_CONTEXT_H_ 103 #endif // CHROMEOS_LOGIN_AUTH_USER_CONTEXT_H_
OLDNEW
« no previous file with comments | « chromeos/login/auth/stub_authenticator.cc ('k') | chromeos/login/auth/user_context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698