cygprofile: increase timeouts to allow showing web contents
[chromium-blink-merge.git] / chromeos / login / auth / user_context.h
blob4dbd71b272a698111f1a76abf808937ff33599cf
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
3 // found in the LICENSE file.
5 #ifndef CHROMEOS_LOGIN_AUTH_USER_CONTEXT_H_
6 #define CHROMEOS_LOGIN_AUTH_USER_CONTEXT_H_
8 #include <string>
10 #include "chromeos/chromeos_export.h"
11 #include "chromeos/login/auth/key.h"
12 #include "components/user_manager/user_type.h"
14 namespace chromeos {
16 // 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_|.
18 // 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.
20 class CHROMEOS_EXPORT UserContext {
21 public:
22 // The authentication flow used during sign-in.
23 enum AuthFlow {
24 // Online authentication against GAIA. GAIA did not redirect to a SAML IdP.
25 AUTH_FLOW_GAIA_WITHOUT_SAML,
26 // Online authentication against GAIA. GAIA redirected to a SAML IdP.
27 AUTH_FLOW_GAIA_WITH_SAML,
28 // Offline authentication against a cached key.
29 AUTH_FLOW_OFFLINE,
30 // Offline authentication using and Easy unlock device (e.g. a phone).
31 AUTH_FLOW_EASY_UNLOCK,
32 // Easy bootstrap flow.
33 AUTH_FLOW_EASY_BOOTSTRAP
36 UserContext();
37 UserContext(const UserContext& other);
38 explicit UserContext(const std::string& user_id);
39 UserContext(user_manager::UserType user_type, const std::string& user_id);
40 ~UserContext();
42 bool operator==(const UserContext& context) const;
43 bool operator!=(const UserContext& context) const;
45 const std::string& GetUserID() const;
46 const std::string& GetGaiaID() const;
47 const Key* GetKey() const;
48 Key* GetKey();
49 const std::string& GetAuthCode() const;
50 const std::string& GetRefreshToken() const;
51 const std::string& GetAccessToken() const;
52 const std::string& GetUserIDHash() const;
53 bool IsUsingOAuth() const;
54 AuthFlow GetAuthFlow() const;
55 user_manager::UserType GetUserType() const;
56 const std::string& GetPublicSessionLocale() const;
57 const std::string& GetPublicSessionInputMethod() const;
58 const std::string& GetDeviceId() const;
59 const std::string& GetGAPSCookie() const;
61 bool HasCredentials() const;
63 void SetUserID(const std::string& user_id);
64 void SetGaiaID(const std::string& gaia_id);
65 void SetKey(const Key& key);
66 void SetAuthCode(const std::string& auth_code);
67 void SetRefreshToken(const std::string& refresh_token);
68 void SetAccessToken(const std::string& access_token);
69 void SetUserIDHash(const std::string& user_id_hash);
70 void SetIsUsingOAuth(bool is_using_oauth);
71 void SetAuthFlow(AuthFlow auth_flow);
72 void SetUserType(user_manager::UserType user_type);
73 void SetPublicSessionLocale(const std::string& locale);
74 void SetPublicSessionInputMethod(const std::string& input_method);
75 void SetDeviceId(const std::string& device_id);
76 void SetGAPSCookie(const std::string& gaps_cookie);
78 void ClearSecrets();
80 private:
81 std::string user_id_;
82 std::string gaia_id_;
83 Key key_;
84 std::string auth_code_;
85 std::string refresh_token_;
86 std::string access_token_; // OAuthLogin scoped access token.
87 std::string user_id_hash_;
88 bool is_using_oauth_;
89 AuthFlow auth_flow_;
90 user_manager::UserType user_type_;
91 std::string public_session_locale_;
92 std::string public_session_input_method_;
93 std::string device_id_;
94 std::string gaps_cookie_;
97 } // namespace chromeos
99 #endif // CHROMEOS_LOGIN_AUTH_USER_CONTEXT_H_