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

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

Issue 378513005: [Athena] Extract Chrome OS authentication stack (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix includes in one more test Created 6 years, 5 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 | Annotate | Revision Log
OLDNEW
(Empty)
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.
4
5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_AUTH_USER_CONTEXT_H_
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_AUTH_USER_CONTEXT_H_
7
8 #include <string>
9
10 #include "chrome/browser/chromeos/login/auth/key.h"
11 #include "components/user_manager/user_type.h"
12
13 namespace chromeos {
14
15 // 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_|.
17 // 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.
19 class UserContext {
20 public:
21 // The authentication flow used during sign-in.
22 enum AuthFlow {
23 // Online authentication against GAIA. GAIA did not redirect to a SAML IdP.
24 AUTH_FLOW_GAIA_WITHOUT_SAML,
25 // Online authentication against GAIA. GAIA redirected to a SAML IdP.
26 AUTH_FLOW_GAIA_WITH_SAML,
27 // Offline authentication against a cached key.
28 AUTH_FLOW_OFFLINE
29 };
30
31 UserContext();
32 UserContext(const UserContext& other);
33 explicit UserContext(const std::string& user_id);
34 UserContext(user_manager::UserType user_type, const std::string& user_id);
35 ~UserContext();
36
37 bool operator==(const UserContext& context) const;
38 bool operator!=(const UserContext& context) const;
39
40 const std::string& GetUserID() const;
41 const Key* GetKey() const;
42 Key* GetKey();
43 const std::string& GetAuthCode() const;
44 const std::string& GetUserIDHash() const;
45 bool IsUsingOAuth() const;
46 AuthFlow GetAuthFlow() const;
47 user_manager::UserType GetUserType() const;
48
49 bool HasCredentials() const;
50
51 void SetUserID(const std::string& user_id);
52 void SetKey(const Key& key);
53 void SetAuthCode(const std::string& auth_code);
54 void SetUserIDHash(const std::string& user_id_hash);
55 void SetIsUsingOAuth(bool is_using_oauth);
56 void SetAuthFlow(AuthFlow auth_flow);
57 void SetUserType(user_manager::UserType user_type);
58
59 void ClearSecrets();
60
61 private:
62 std::string user_id_;
63 Key key_;
64 std::string auth_code_;
65 std::string user_id_hash_;
66 bool is_using_oauth_;
67 AuthFlow auth_flow_;
68 user_manager::UserType user_type_;
69 };
70
71 } // namespace chromeos
72
73 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_AUTH_USER_CONTEXT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698