Commit fed2683c authored by Denis Kuznetsov's avatar Denis Kuznetsov Committed by Commit Bot

Remove unused CryptohomeAuthenticator::AuthenticateToUnlock method.

Bug: 1150430
Change-Id: Idbfa4e0fc570ff243fa97e65883f9a62557937f9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2547289Reviewed-by: default avatarRoman Sorokin [CET] <rsorokin@chromium.org>
Commit-Queue: Denis Kuznetsov [CET] <antrim@chromium.org>
Cr-Commit-Position: refs/heads/master@{#829671}
parent f98421ba
...@@ -824,18 +824,6 @@ TEST_F(CryptohomeAuthenticatorTest, DriveOnlineLogin) { ...@@ -824,18 +824,6 @@ TEST_F(CryptohomeAuthenticatorTest, DriveOnlineLogin) {
RunResolve(auth_.get()); RunResolve(auth_.get());
} }
TEST_F(CryptohomeAuthenticatorTest, DriveUnlock) {
ExpectLoginSuccess(user_context_);
FailOnLoginFailure();
// Set up fake cryptohome client to respond successfully to a cryptohome
// key-check attempt.
ExpectCheckKeyExCall();
auth_->AuthenticateToUnlock(user_context_);
run_loop_.Run();
}
TEST_F(CryptohomeAuthenticatorTest, DriveLoginWithPreHashedPassword) { TEST_F(CryptohomeAuthenticatorTest, DriveLoginWithPreHashedPassword) {
CreateTransformedKey(Key::KEY_TYPE_SALTED_SHA256, kSalt); CreateTransformedKey(Key::KEY_TYPE_SALTED_SHA256, kSalt);
......
...@@ -44,11 +44,6 @@ class COMPONENT_EXPORT(CHROMEOS_LOGIN_AUTH) Authenticator ...@@ -44,11 +44,6 @@ class COMPONENT_EXPORT(CHROMEOS_LOGIN_AUTH) Authenticator
virtual void AuthenticateToLogin(content::BrowserContext* browser_context, virtual void AuthenticateToLogin(content::BrowserContext* browser_context,
const UserContext& user_context) = 0; const UserContext& user_context) = 0;
// Given a user credentials in |user_context|, this method attempts to
// authenticate to unlock the computer.
// Must be called on the UI thread.
virtual void AuthenticateToUnlock(const UserContext& user_context) = 0;
// Initiates supervised user login. // Initiates supervised user login.
// TODO(crbug.com/866790): Remove this as a part of Supervised users cleanup. // TODO(crbug.com/866790): Remove this as a part of Supervised users cleanup.
virtual void LoginAsSupervisedUser(const UserContext& user_context) = 0; virtual void LoginAsSupervisedUser(const UserContext& user_context) = 0;
......
...@@ -556,28 +556,6 @@ void Remove(const base::WeakPtr<AuthAttemptState>& attempt, ...@@ -556,28 +556,6 @@ void Remove(const base::WeakPtr<AuthAttemptState>& attempt,
"CryptohomeRemove-End")); "CryptohomeRemove-End"));
} }
void OnKeyChecked(const base::WeakPtr<AuthAttemptState>& attempt,
scoped_refptr<CryptohomeAuthenticator> resolver,
base::Optional<cryptohome::BaseReply> reply) {
attempt->RecordCryptohomeStatus(BaseReplyToMountError(reply));
resolver->Resolve();
}
// Calls cryptohome's key check method.
void CheckKey(const base::WeakPtr<AuthAttemptState>& attempt,
scoped_refptr<CryptohomeAuthenticator> resolver,
const std::string& system_salt) {
std::unique_ptr<Key> key =
TransformKeyIfNeeded(*attempt->user_context.GetKey(), system_salt);
cryptohome::AuthorizationRequest auth;
auth.mutable_key()->set_secret(key->GetSecret());
CryptohomeClient::Get()->CheckKeyEx(
cryptohome::CreateAccountIdentifierFromAccountId(
attempt->user_context.GetAccountId()),
auth, cryptohome::CheckKeyRequest(),
base::BindOnce(&OnKeyChecked, attempt, resolver));
}
} // namespace } // namespace
CryptohomeAuthenticator::CryptohomeAuthenticator( CryptohomeAuthenticator::CryptohomeAuthenticator(
...@@ -589,7 +567,6 @@ CryptohomeAuthenticator::CryptohomeAuthenticator( ...@@ -589,7 +567,6 @@ CryptohomeAuthenticator::CryptohomeAuthenticator(
remove_attempted_(false), remove_attempted_(false),
resync_attempted_(false), resync_attempted_(false),
ephemeral_mount_attempted_(false), ephemeral_mount_attempted_(false),
check_key_attempted_(false),
already_reported_success_(false), already_reported_success_(false),
owner_is_verified_(false), owner_is_verified_(false),
user_can_login_(false), user_can_login_(false),
...@@ -649,20 +626,6 @@ void CryptohomeAuthenticator::CompleteLogin(content::BrowserContext* context, ...@@ -649,20 +626,6 @@ void CryptohomeAuthenticator::CompleteLogin(content::BrowserContext* context,
this)); this));
} }
void CryptohomeAuthenticator::AuthenticateToUnlock(
const UserContext& user_context) {
DCHECK_EQ(user_manager::USER_TYPE_REGULAR, user_context.GetUserType());
current_state_.reset(new AuthAttemptState(user_context,
true, // unlock
true, // online_complete
false)); // user_is_new
remove_user_data_on_failure_ = false;
check_key_attempted_ = true;
SystemSaltGetter::Get()->GetSystemSalt(
base::BindOnce(&CheckKey, current_state_->AsWeakPtr(),
scoped_refptr<CryptohomeAuthenticator>(this)));
}
void CryptohomeAuthenticator::LoginAsSupervisedUser( void CryptohomeAuthenticator::LoginAsSupervisedUser(
const UserContext& user_context) { const UserContext& user_context) {
DCHECK(task_runner_->RunsTasksInCurrentSequence()); DCHECK(task_runner_->RunsTasksInCurrentSequence());
...@@ -971,14 +934,13 @@ void CryptohomeAuthenticator::Resolve() { ...@@ -971,14 +934,13 @@ void CryptohomeAuthenticator::Resolve() {
case ONLINE_FAILED: case ONLINE_FAILED:
case NEED_NEW_PW: case NEED_NEW_PW:
case HAVE_NEW_PW: case HAVE_NEW_PW:
case UNLOCK:
case LOGIN_FAILED:
NOTREACHED() << "Using obsolete ClientLogin code path."; NOTREACHED() << "Using obsolete ClientLogin code path.";
break; break;
case OFFLINE_LOGIN: case OFFLINE_LOGIN:
VLOG(2) << "Offline login"; VLOG(2) << "Offline login";
FALLTHROUGH; FALLTHROUGH;
case UNLOCK:
VLOG(2) << "Unlock";
FALLTHROUGH;
case ONLINE_LOGIN: case ONLINE_LOGIN:
VLOG(2) << "Online login"; VLOG(2) << "Online login";
task_runner_->PostTask( task_runner_->PostTask(
...@@ -1004,12 +966,6 @@ void CryptohomeAuthenticator::Resolve() { ...@@ -1004,12 +966,6 @@ void CryptohomeAuthenticator::Resolve() {
FROM_HERE, FROM_HERE,
base::BindOnce(&CryptohomeAuthenticator::OnAuthSuccess, this)); base::BindOnce(&CryptohomeAuthenticator::OnAuthSuccess, this));
break; break;
case LOGIN_FAILED:
current_state_->ResetCryptohomeStatus();
task_runner_->PostTask(
FROM_HERE, base::BindOnce(&CryptohomeAuthenticator::OnAuthFailure,
this, current_state_->online_outcome()));
break;
case OWNER_REQUIRED: { case OWNER_REQUIRED: {
current_state_->ResetCryptohomeStatus(); current_state_->ResetCryptohomeStatus();
CryptohomeClient::Get()->UnmountEx( CryptohomeClient::Get()->UnmountEx(
...@@ -1077,7 +1033,6 @@ CryptohomeAuthenticator::AuthState CryptohomeAuthenticator::ResolveState() { ...@@ -1077,7 +1033,6 @@ CryptohomeAuthenticator::AuthState CryptohomeAuthenticator::ResolveState() {
remove_attempted_ = false; remove_attempted_ = false;
resync_attempted_ = false; resync_attempted_ = false;
ephemeral_mount_attempted_ = false; ephemeral_mount_attempted_ = false;
check_key_attempted_ = false;
if (state != POSSIBLE_PW_CHANGE && state != NO_MOUNT && if (state != POSSIBLE_PW_CHANGE && state != NO_MOUNT &&
state != OFFLINE_LOGIN) state != OFFLINE_LOGIN)
...@@ -1103,8 +1058,6 @@ CryptohomeAuthenticator::ResolveCryptohomeFailureState() { ...@@ -1103,8 +1058,6 @@ CryptohomeAuthenticator::ResolveCryptohomeFailureState() {
return FAILED_TMPFS; return FAILED_TMPFS;
if (migrate_attempted_) if (migrate_attempted_)
return NEED_OLD_PW; return NEED_OLD_PW;
if (check_key_attempted_)
return LOGIN_FAILED;
if (current_state_->cryptohome_code() == if (current_state_->cryptohome_code() ==
cryptohome::MOUNT_ERROR_TPM_NEEDS_REBOOT) { cryptohome::MOUNT_ERROR_TPM_NEEDS_REBOOT) {
...@@ -1164,8 +1117,6 @@ CryptohomeAuthenticator::ResolveCryptohomeSuccessState() { ...@@ -1164,8 +1117,6 @@ CryptohomeAuthenticator::ResolveCryptohomeSuccessState() {
return REMOVED_DATA_AFTER_FAILURE; return REMOVED_DATA_AFTER_FAILURE;
if (migrate_attempted_) if (migrate_attempted_)
return RECOVER_MOUNT; return RECOVER_MOUNT;
if (check_key_attempted_)
return UNLOCK;
const user_manager::UserType user_type = const user_manager::UserType user_type =
current_state_->user_context.GetUserType(); current_state_->user_context.GetUserType();
......
...@@ -82,13 +82,13 @@ class COMPONENT_EXPORT(CHROMEOS_LOGIN_AUTH) CryptohomeAuthenticator ...@@ -82,13 +82,13 @@ class COMPONENT_EXPORT(CHROMEOS_LOGIN_AUTH) CryptohomeAuthenticator
// time to migrate key. // time to migrate key.
OFFLINE_LOGIN = 12, // Login succeeded offline. OFFLINE_LOGIN = 12, // Login succeeded offline.
ONLINE_LOGIN = 13, // Offline and online login succeeded. ONLINE_LOGIN = 13, // Offline and online login succeeded.
UNLOCK = 14, // Screen unlock succeeded. UNLOCK = 14, // Obsolete: Screen unlock succeeded.
ONLINE_FAILED = 15, // Obsolete (ClientLogin): Online login disallowed, ONLINE_FAILED = 15, // Obsolete (ClientLogin): Online login disallowed,
// but offline succeeded. // but offline succeeded.
GUEST_LOGIN = 16, // Logged in guest mode. GUEST_LOGIN = 16, // Logged in guest mode.
PUBLIC_ACCOUNT_LOGIN = 17, // Logged into a public account. PUBLIC_ACCOUNT_LOGIN = 17, // Logged into a public account.
SUPERVISED_USER_LOGIN = 18, // Logged in as a supervised user. SUPERVISED_USER_LOGIN = 18, // Logged in as a supervised user.
LOGIN_FAILED = 19, // Login denied. LOGIN_FAILED = 19, // Obsolete: Login denied.
OWNER_REQUIRED = 20, // Login is restricted to the owner only. OWNER_REQUIRED = 20, // Login is restricted to the owner only.
FAILED_USERNAME_HASH = 21, // Failed GetSanitizedUsername request. FAILED_USERNAME_HASH = 21, // Failed GetSanitizedUsername request.
KIOSK_ACCOUNT_LOGIN = 22, // Logged into a kiosk account. KIOSK_ACCOUNT_LOGIN = 22, // Logged into a kiosk account.
...@@ -121,12 +121,6 @@ class COMPONENT_EXPORT(CHROMEOS_LOGIN_AUTH) CryptohomeAuthenticator ...@@ -121,12 +121,6 @@ class COMPONENT_EXPORT(CHROMEOS_LOGIN_AUTH) CryptohomeAuthenticator
void AuthenticateToLogin(content::BrowserContext* context, void AuthenticateToLogin(content::BrowserContext* context,
const UserContext& user_context) override; const UserContext& user_context) override;
// Given |user_context|, this method attempts to authenticate to the cached
// user_context. This will never contact the server even if it's online.
// The auth result is sent to AuthStatusConsumer in a same way as
// AuthenticateToLogin does.
void AuthenticateToUnlock(const UserContext& user_context) override;
// Initiates supervised user login. // Initiates supervised user login.
// Creates cryptohome if missing or mounts existing one and // Creates cryptohome if missing or mounts existing one and
// notifies consumer on the success/failure. // notifies consumer on the success/failure.
...@@ -274,7 +268,6 @@ class COMPONENT_EXPORT(CHROMEOS_LOGIN_AUTH) CryptohomeAuthenticator ...@@ -274,7 +268,6 @@ class COMPONENT_EXPORT(CHROMEOS_LOGIN_AUTH) CryptohomeAuthenticator
bool remove_attempted_; bool remove_attempted_;
bool resync_attempted_; bool resync_attempted_;
bool ephemeral_mount_attempted_; bool ephemeral_mount_attempted_;
bool check_key_attempted_;
// When the user has changed their password, but gives us the old one, we will // When the user has changed their password, but gives us the old one, we will
// be able to mount their cryptohome, but online authentication will fail. // be able to mount their cryptohome, but online authentication will fail.
......
...@@ -80,10 +80,6 @@ void StubAuthenticator::AuthenticateToLogin(content::BrowserContext* context, ...@@ -80,10 +80,6 @@ void StubAuthenticator::AuthenticateToLogin(content::BrowserContext* context,
AuthFailure::FromNetworkAuthFailure(error))); AuthFailure::FromNetworkAuthFailure(error)));
} }
void StubAuthenticator::AuthenticateToUnlock(const UserContext& user_context) {
AuthenticateToLogin(NULL /* not used */, user_context);
}
void StubAuthenticator::LoginAsSupervisedUser(const UserContext& user_context) { void StubAuthenticator::LoginAsSupervisedUser(const UserContext& user_context) {
UserContext new_user_context = user_context; UserContext new_user_context = user_context;
new_user_context.SetUserIDHash(user_context.GetAccountId().GetUserEmail() + new_user_context.SetUserIDHash(user_context.GetAccountId().GetUserEmail() +
......
...@@ -46,7 +46,6 @@ class COMPONENT_EXPORT(CHROMEOS_LOGIN_AUTH) StubAuthenticator ...@@ -46,7 +46,6 @@ class COMPONENT_EXPORT(CHROMEOS_LOGIN_AUTH) StubAuthenticator
const UserContext& user_context) override; const UserContext& user_context) override;
void AuthenticateToLogin(content::BrowserContext* context, void AuthenticateToLogin(content::BrowserContext* context,
const UserContext& user_context) override; const UserContext& user_context) override;
void AuthenticateToUnlock(const UserContext& user_context) override;
void LoginAsSupervisedUser(const UserContext& user_context) override; void LoginAsSupervisedUser(const UserContext& user_context) override;
void LoginOffTheRecord() override; void LoginOffTheRecord() override;
void LoginAsPublicSession(const UserContext& user_context) override; void LoginAsPublicSession(const UserContext& user_context) override;
......
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