Commit 5b5211e5 authored by Maksim Ivanov's avatar Maksim Ivanov Committed by Commit Bot

Fix legacy auth mode name in LoginPerformer

Rename the AuthorizationMode enum to stop referring to the
"extension" that performs authentication.

The extension-based authentication was removed a couple of years ago in
favor of the webview-based one (see also https://crbug.com/688565 ).

Bug: 470893
Change-Id: I80bc9d662719a2bbc83eb42ec04be78dd9527b3f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1816573Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Commit-Queue: Maksim Ivanov <emaxx@chromium.org>
Cr-Commit-Position: refs/heads/master@{#698935}
parent a39e9ff1
...@@ -635,7 +635,7 @@ void ExistingUserController::PerformLogin( ...@@ -635,7 +635,7 @@ void ExistingUserController::PerformLogin(
base::UTF8ToUTF16(new_user_context.GetKey()->GetSecret())); base::UTF8ToUTF16(new_user_context.GetKey()->GetSecret()));
new_user_context.SetSyncPasswordData(password_manager::PasswordHashData( new_user_context.SetSyncPasswordData(password_manager::PasswordHashData(
user_context.GetAccountId().GetUserEmail(), password, user_context.GetAccountId().GetUserEmail(), password,
auth_mode == LoginPerformer::AUTH_MODE_EXTENSION)); auth_mode == LoginPerformer::AuthorizationMode::kExternal));
} }
if (new_user_context.IsUsingPin()) { if (new_user_context.IsUsingPin()) {
...@@ -946,7 +946,8 @@ void ExistingUserController::OnAuthSuccess(const UserContext& user_context) { ...@@ -946,7 +946,8 @@ void ExistingUserController::OnAuthSuccess(const UserContext& user_context) {
// /ServiceLogin T T // /ServiceLogin T T
// /ChromeOsEmbeddedSetup F T // /ChromeOsEmbeddedSetup F T
const bool has_auth_cookies = const bool has_auth_cookies =
login_performer_->auth_mode() == LoginPerformer::AUTH_MODE_EXTENSION && login_performer_->auth_mode() ==
LoginPerformer::AuthorizationMode::kExternal &&
(user_context.GetAccessToken().empty() || (user_context.GetAccessToken().empty() ||
user_context.GetAuthFlow() == UserContext::AUTH_FLOW_GAIA_WITH_SAML); user_context.GetAuthFlow() == UserContext::AUTH_FLOW_GAIA_WITH_SAML);
...@@ -1749,7 +1750,7 @@ void ExistingUserController::DoCompleteLogin( ...@@ -1749,7 +1750,7 @@ void ExistingUserController::DoCompleteLogin(
return; return;
} }
PerformLogin(user_context, LoginPerformer::AUTH_MODE_EXTENSION); PerformLogin(user_context, LoginPerformer::AuthorizationMode::kExternal);
} }
void ExistingUserController::DoLogin(const UserContext& user_context, void ExistingUserController::DoLogin(const UserContext& user_context,
...@@ -1796,7 +1797,7 @@ void ExistingUserController::DoLogin(const UserContext& user_context, ...@@ -1796,7 +1797,7 @@ void ExistingUserController::DoLogin(const UserContext& user_context,
} }
PerformPreLoginActions(user_context); PerformPreLoginActions(user_context);
PerformLogin(user_context, LoginPerformer::AUTH_MODE_INTERNAL); PerformLogin(user_context, LoginPerformer::AuthorizationMode::kInternal);
} }
void ExistingUserController::OnOAuth2TokensFetched( void ExistingUserController::OnOAuth2TokensFetched(
...@@ -1808,7 +1809,7 @@ void ExistingUserController::OnOAuth2TokensFetched( ...@@ -1808,7 +1809,7 @@ void ExistingUserController::OnOAuth2TokensFetched(
return; return;
} }
UserSessionManager::GetInstance()->OnOAuth2TokensFetched(user_context); UserSessionManager::GetInstance()->OnOAuth2TokensFetched(user_context);
PerformLogin(user_context, LoginPerformer::AUTH_MODE_EXTENSION); PerformLogin(user_context, LoginPerformer::AuthorizationMode::kExternal);
} }
void ExistingUserController::ClearRecordedNames() { void ExistingUserController::ClearRecordedNames() {
......
...@@ -383,9 +383,9 @@ class ExistingUserController ...@@ -383,9 +383,9 @@ class ExistingUserController
bool password_changed_ = false; bool password_changed_ = false;
// Set in OnLoginSuccess. Before that use LoginPerformer::auth_mode(). // Set in OnLoginSuccess. Before that use LoginPerformer::auth_mode().
// Initialized with AUTH_MODE_EXTENSION as more restricted mode. // Initialized with |kExternal| as more restricted mode.
LoginPerformer::AuthorizationMode auth_mode_ = LoginPerformer::AuthorizationMode auth_mode_ =
LoginPerformer::AUTH_MODE_EXTENSION; LoginPerformer::AuthorizationMode::kExternal;
// Indicates use of local (not GAIA) authentication. // Indicates use of local (not GAIA) authentication.
bool auth_flow_offline_ = false; bool auth_flow_offline_ = false;
......
...@@ -364,7 +364,7 @@ bool CanPerformEarlyRestart() { ...@@ -364,7 +364,7 @@ bool CanPerformEarlyRestart() {
if (controller->password_changed()) if (controller->password_changed())
return false; return false;
if (controller->auth_mode() != LoginPerformer::AUTH_MODE_INTERNAL) if (controller->auth_mode() != LoginPerformer::AuthorizationMode::kInternal)
return false; return false;
// No early restart if Easy unlock key needs to be updated. // No early restart if Easy unlock key needs to be updated.
......
...@@ -33,10 +33,7 @@ LoginPerformer::LoginPerformer(scoped_refptr<base::TaskRunner> task_runner, ...@@ -33,10 +33,7 @@ LoginPerformer::LoginPerformer(scoped_refptr<base::TaskRunner> task_runner,
Delegate* delegate) Delegate* delegate)
: delegate_(delegate), : delegate_(delegate),
task_runner_(task_runner), task_runner_(task_runner),
last_login_failure_(AuthFailure::AuthFailureNone()), last_login_failure_(AuthFailure::AuthFailureNone()) {}
password_changed_(false),
password_changed_callback_count_(0),
auth_mode_(AUTH_MODE_INTERNAL) {}
LoginPerformer::~LoginPerformer() { LoginPerformer::~LoginPerformer() {
DVLOG(1) << "Deleting LoginPerformer"; DVLOG(1) << "Deleting LoginPerformer";
...@@ -158,7 +155,7 @@ void LoginPerformer::DoPerformLogin(const UserContext& user_context, ...@@ -158,7 +155,7 @@ void LoginPerformer::DoPerformLogin(const UserContext& user_context,
SetupEasyUnlockUserFlow(user_context.GetAccountId()); SetupEasyUnlockUserFlow(user_context.GetAccountId());
switch (auth_mode_) { switch (auth_mode_) {
case AUTH_MODE_EXTENSION: { case AuthorizationMode::kExternal: {
RunOnlineWhitelistCheck( RunOnlineWhitelistCheck(
account_id, wildcard_match, user_context.GetRefreshToken(), account_id, wildcard_match, user_context.GetRefreshToken(),
base::Bind(&LoginPerformer::StartLoginCompletion, base::Bind(&LoginPerformer::StartLoginCompletion,
...@@ -167,7 +164,7 @@ void LoginPerformer::DoPerformLogin(const UserContext& user_context, ...@@ -167,7 +164,7 @@ void LoginPerformer::DoPerformLogin(const UserContext& user_context,
weak_factory_.GetWeakPtr())); weak_factory_.GetWeakPtr()));
break; break;
} }
case AUTH_MODE_INTERNAL: case AuthorizationMode::kInternal:
StartAuthentication(); StartAuthentication();
break; break;
} }
......
...@@ -46,12 +46,13 @@ namespace chromeos { ...@@ -46,12 +46,13 @@ namespace chromeos {
class COMPONENT_EXPORT(CHROMEOS_LOGIN_AUTH) LoginPerformer class COMPONENT_EXPORT(CHROMEOS_LOGIN_AUTH) LoginPerformer
: public AuthStatusConsumer { : public AuthStatusConsumer {
public: public:
typedef enum AuthorizationMode { enum class AuthorizationMode {
// Authorization performed internally by Chrome. // Authorization performed internally by Chrome.
AUTH_MODE_INTERNAL, kInternal,
// Authorization performed by an extension. // Authorization performed by an external service (e.g., Gaia, or Active
AUTH_MODE_EXTENSION // Directory).
} AuthorizationMode; kExternal
};
// Delegate class to get notifications from the LoginPerformer. // Delegate class to get notifications from the LoginPerformer.
class Delegate : public AuthStatusConsumer { class Delegate : public AuthStatusConsumer {
...@@ -67,8 +68,8 @@ class COMPONENT_EXPORT(CHROMEOS_LOGIN_AUTH) LoginPerformer ...@@ -67,8 +68,8 @@ class COMPONENT_EXPORT(CHROMEOS_LOGIN_AUTH) LoginPerformer
~LoginPerformer() override; ~LoginPerformer() override;
// Performs a login for |user_context|. // Performs a login for |user_context|.
// If auth_mode is AUTH_MODE_EXTENSION, there are no further auth checks, // If auth_mode is |kExternal|, there are no further auth checks, |kInternal|
// AUTH_MODE_INTERNAL will perform auth checks. // will perform auth checks.
void PerformLogin(const UserContext& user_context, void PerformLogin(const UserContext& user_context,
AuthorizationMode auth_mode); AuthorizationMode auth_mode);
...@@ -125,7 +126,7 @@ class COMPONENT_EXPORT(CHROMEOS_LOGIN_AUTH) LoginPerformer ...@@ -125,7 +126,7 @@ class COMPONENT_EXPORT(CHROMEOS_LOGIN_AUTH) LoginPerformer
// Check if user is allowed to sign in on device. |wildcard_match| will // Check if user is allowed to sign in on device. |wildcard_match| will
// contain additional information whether this user is explicitly listed or // contain additional information whether this user is explicitly listed or
// not (may be relevant for extension-based sign-in). // not (may be relevant for external-based sign-in).
virtual bool IsUserWhitelisted(const AccountId& account_id, virtual bool IsUserWhitelisted(const AccountId& account_id,
bool* wildcard_match) = 0; bool* wildcard_match) = 0;
...@@ -222,11 +223,11 @@ class COMPONENT_EXPORT(CHROMEOS_LOGIN_AUTH) LoginPerformer ...@@ -222,11 +223,11 @@ class COMPONENT_EXPORT(CHROMEOS_LOGIN_AUTH) LoginPerformer
// True if password change has been detected. // True if password change has been detected.
// Once correct password is entered homedir migration is executed. // Once correct password is entered homedir migration is executed.
bool password_changed_; bool password_changed_ = false;
int password_changed_callback_count_; int password_changed_callback_count_ = 0;
// Authorization mode type. // Authorization mode type.
AuthorizationMode auth_mode_; AuthorizationMode auth_mode_ = AuthorizationMode::kInternal;
base::WeakPtrFactory<LoginPerformer> weak_factory_{this}; base::WeakPtrFactory<LoginPerformer> weak_factory_{this};
DISALLOW_COPY_AND_ASSIGN(LoginPerformer); DISALLOW_COPY_AND_ASSIGN(LoginPerformer);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment