| OLD | NEW |
| 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_LOGIN_PERFORMER_H_ | 5 #ifndef CHROMEOS_LOGIN_AUTH_LOGIN_PERFORMER_H_ |
| 6 #define CHROMEOS_LOGIN_AUTH_LOGIN_PERFORMER_H_ | 6 #define CHROMEOS_LOGIN_AUTH_LOGIN_PERFORMER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/callback.h" | 11 #include "base/callback.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
| 14 #include "chromeos/chromeos_export.h" | 14 #include "chromeos/chromeos_export.h" |
| 15 #include "chromeos/login/auth/auth_status_consumer.h" | 15 #include "chromeos/login/auth/auth_status_consumer.h" |
| 16 #include "chromeos/login/auth/authenticator.h" | 16 #include "chromeos/login/auth/authenticator.h" |
| 17 #include "chromeos/login/auth/extended_authenticator.h" | 17 #include "chromeos/login/auth/extended_authenticator.h" |
| 18 #include "chromeos/login/auth/user_context.h" | 18 #include "chromeos/login/auth/user_context.h" |
| 19 #include "google_apis/gaia/google_service_auth_error.h" | 19 #include "google_apis/gaia/google_service_auth_error.h" |
| 20 | 20 |
| 21 class AccountId; |
| 22 |
| 21 namespace net { | 23 namespace net { |
| 22 class URLRequestContextGetter; | 24 class URLRequestContextGetter; |
| 23 } | 25 } |
| 24 | 26 |
| 25 namespace policy { | 27 namespace policy { |
| 26 class WildcardLoginChecker; | 28 class WildcardLoginChecker; |
| 27 } | 29 } |
| 28 | 30 |
| 29 namespace content { | 31 namespace content { |
| 30 class BrowserContext; | 32 class BrowserContext; |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 return password_changed_callback_count_; | 111 return password_changed_callback_count_; |
| 110 } | 112 } |
| 111 | 113 |
| 112 void set_delegate(Delegate* delegate) { delegate_ = delegate; } | 114 void set_delegate(Delegate* delegate) { delegate_ = delegate; } |
| 113 | 115 |
| 114 AuthorizationMode auth_mode() const { return auth_mode_; } | 116 AuthorizationMode auth_mode() const { return auth_mode_; } |
| 115 | 117 |
| 116 // Check if user is allowed to sign in on device. |wildcard_match| will | 118 // Check if user is allowed to sign in on device. |wildcard_match| will |
| 117 // contain additional information whether this user is explicitly listed or | 119 // contain additional information whether this user is explicitly listed or |
| 118 // not (may be relevant for extension-based sign-in). | 120 // not (may be relevant for extension-based sign-in). |
| 119 virtual bool IsUserWhitelisted(const std::string& user_id, | 121 virtual bool IsUserWhitelisted(const AccountId& account_id, |
| 120 bool* wildcard_match) = 0; | 122 bool* wildcard_match) = 0; |
| 121 | 123 |
| 122 protected: | 124 protected: |
| 123 // Platform-dependant methods to be implemented by concrete class. | 125 // Platform-dependant methods to be implemented by concrete class. |
| 124 | 126 |
| 125 // Run trusted check for a platform. If trusted check have to be performed | 127 // Run trusted check for a platform. If trusted check have to be performed |
| 126 // asynchronously, |false| will be returned, and either delegate's | 128 // asynchronously, |false| will be returned, and either delegate's |
| 127 // PolicyLoadFailed() or |callback| will be called upon actual check. | 129 // PolicyLoadFailed() or |callback| will be called upon actual check. |
| 128 virtual bool RunTrustedCheck(const base::Closure& callback) = 0; | 130 virtual bool RunTrustedCheck(const base::Closure& callback) = 0; |
| 129 | 131 |
| 130 // This method should run addional online check if user can sign in on device. | 132 // This method should run addional online check if user can sign in on device. |
| 131 // Either |success_callback| or |failure_callback| should be called upon this | 133 // Either |success_callback| or |failure_callback| should be called upon this |
| 132 // check. | 134 // check. |
| 133 virtual void RunOnlineWhitelistCheck( | 135 virtual void RunOnlineWhitelistCheck( |
| 134 const std::string& user_id, | 136 const AccountId& account_id, |
| 135 bool wildcard_match, | 137 bool wildcard_match, |
| 136 const std::string& refresh_token, | 138 const std::string& refresh_token, |
| 137 const base::Closure& success_callback, | 139 const base::Closure& success_callback, |
| 138 const base::Closure& failure_callback) = 0; | 140 const base::Closure& failure_callback) = 0; |
| 139 | 141 |
| 140 // Supervised users-related methods. | 142 // Supervised users-related methods. |
| 141 | 143 |
| 142 // Check if supervised users are allowed on this device. | 144 // Check if supervised users are allowed on this device. |
| 143 virtual bool AreSupervisedUsersAllowed() = 0; | 145 virtual bool AreSupervisedUsersAllowed() = 0; |
| 144 | 146 |
| 145 // Check which authenticator should be used for supervised user. | 147 // Check which authenticator should be used for supervised user. |
| 146 virtual bool UseExtendedAuthenticatorForSupervisedUser( | 148 virtual bool UseExtendedAuthenticatorForSupervisedUser( |
| 147 const UserContext& user_context) = 0; | 149 const UserContext& user_context) = 0; |
| 148 | 150 |
| 149 // Probably transform supervised user's authentication key. | 151 // Probably transform supervised user's authentication key. |
| 150 virtual UserContext TransformSupervisedKey(const UserContext& context) = 0; | 152 virtual UserContext TransformSupervisedKey(const UserContext& context) = 0; |
| 151 | 153 |
| 152 // Set up sign-in flow for supervised user. | 154 // Set up sign-in flow for supervised user. |
| 153 virtual void SetupSupervisedUserFlow(const std::string& user_id) = 0; | 155 virtual void SetupSupervisedUserFlow(const AccountId& account_id) = 0; |
| 154 | 156 |
| 155 // Set up sign-in flow for Easy Unlock. | 157 // Set up sign-in flow for Easy Unlock. |
| 156 virtual void SetupEasyUnlockUserFlow(const std::string& user_id) = 0; | 158 virtual void SetupEasyUnlockUserFlow(const AccountId& account_id) = 0; |
| 157 | 159 |
| 158 // Run policy check for |user_id|. If something is wrong, delegate's | 160 // Run policy check for |account_id|. If something is wrong, delegate's |
| 159 // PolicyLoadFailed is called. | 161 // PolicyLoadFailed is called. |
| 160 virtual bool CheckPolicyForUser(const std::string& user_id) = 0; | 162 virtual bool CheckPolicyForUser(const AccountId& account_id) = 0; |
| 161 | 163 |
| 162 // Look up browser context to use during signin. | 164 // Look up browser context to use during signin. |
| 163 virtual content::BrowserContext* GetSigninContext() = 0; | 165 virtual content::BrowserContext* GetSigninContext() = 0; |
| 164 | 166 |
| 165 // Get RequestContext used for sign in. | 167 // Get RequestContext used for sign in. |
| 166 virtual net::URLRequestContextGetter* GetSigninRequestContext() = 0; | 168 virtual net::URLRequestContextGetter* GetSigninRequestContext() = 0; |
| 167 | 169 |
| 168 // Create authenticator implementation. | 170 // Create authenticator implementation. |
| 169 virtual scoped_refptr<Authenticator> CreateAuthenticator() = 0; | 171 virtual scoped_refptr<Authenticator> CreateAuthenticator() = 0; |
| 170 | 172 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 // Authorization mode type. | 219 // Authorization mode type. |
| 218 AuthorizationMode auth_mode_; | 220 AuthorizationMode auth_mode_; |
| 219 | 221 |
| 220 base::WeakPtrFactory<LoginPerformer> weak_factory_; | 222 base::WeakPtrFactory<LoginPerformer> weak_factory_; |
| 221 DISALLOW_COPY_AND_ASSIGN(LoginPerformer); | 223 DISALLOW_COPY_AND_ASSIGN(LoginPerformer); |
| 222 }; | 224 }; |
| 223 | 225 |
| 224 } // namespace chromeos | 226 } // namespace chromeos |
| 225 | 227 |
| 226 #endif // CHROMEOS_LOGIN_AUTH_LOGIN_PERFORMER_H_ | 228 #endif // CHROMEOS_LOGIN_AUTH_LOGIN_PERFORMER_H_ |
| OLD | NEW |