OLD | NEW |
(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 namespace chromeos { |
| 11 |
| 12 // Information that is passed around while authentication is in progress. The |
| 13 // credentials may consist of a |user_id|, |password| pair or a GAIA |
| 14 // |auth_code|. The |user_id_hash| is used to locate the user's home directory |
| 15 // mount point for the user. It is set when the mount has been completed. |
| 16 class UserContext { |
| 17 public: |
| 18 // The authentication flow used during sign-in. |
| 19 enum AuthFlow { |
| 20 // Online authentication against GAIA. GAIA did not redirect to a SAML IdP. |
| 21 AUTH_FLOW_GAIA_WITHOUT_SAML, |
| 22 // Online authentication against GAIA. GAIA redirected to a SAML IdP. |
| 23 AUTH_FLOW_GAIA_WITH_SAML, |
| 24 // Offline authentication against a cached key. |
| 25 AUTH_FLOW_OFFLINE |
| 26 }; |
| 27 |
| 28 UserContext(); |
| 29 UserContext(const UserContext& other); |
| 30 explicit UserContext(const std::string& user_id); |
| 31 ~UserContext(); |
| 32 |
| 33 bool operator==(const UserContext& context) const; |
| 34 |
| 35 const std::string& GetUserID() const; |
| 36 const std::string& GetPassword() const; |
| 37 bool DoesNeedPasswordHashing() const; |
| 38 const std::string& GetKeyLabel() const; |
| 39 const std::string& GetAuthCode() const; |
| 40 const std::string& GetUserIDHash() const; |
| 41 bool IsUsingOAuth() const; |
| 42 AuthFlow GetAuthFlow() const; |
| 43 |
| 44 bool HasCredentials() const; |
| 45 |
| 46 void SetUserID(const std::string& user_id); |
| 47 void SetPassword(const std::string& password); |
| 48 void SetDoesNeedPasswordHashing(bool does_need_password_hashing); |
| 49 void SetKeyLabel(const std::string& key_label); |
| 50 void SetAuthCode(const std::string& auth_code); |
| 51 void SetUserIDHash(const std::string& user_id_hash); |
| 52 void SetIsUsingOAuth(bool is_using_oauth); |
| 53 void SetAuthFlow(AuthFlow auth_flow); |
| 54 |
| 55 void ClearSecrets(); |
| 56 |
| 57 private: |
| 58 std::string user_id_; |
| 59 std::string password_; |
| 60 bool does_need_password_hashing_; |
| 61 std::string key_label_; |
| 62 std::string auth_code_; |
| 63 std::string user_id_hash_; |
| 64 bool is_using_oauth_; |
| 65 AuthFlow auth_flow_; |
| 66 }; |
| 67 |
| 68 } // namespace chromeos |
| 69 |
| 70 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_AUTH_USER_CONTEXT_H_ |
OLD | NEW |