Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
AuthSession: Implement password changed flow
Bug: 1298660 Change-Id: I7900b125a9a2872bc662c3be744b94e99487870a Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3473223 Reviewed-by: Alexander Alekseev <alemate@chromium.org> Reviewed-by: Ryo Hashimoto <hashimoto@chromium.org> Commit-Queue: Denis Kuznetsov <antrim@chromium.org> Cr-Commit-Position: refs/heads/main@{#984978}
- Loading branch information
Denis Kuznetsov
authored and
Chromium LUCI CQ
committed
Mar 24, 2022
1 parent
7ff1bce
commit 9ca63f9
Showing
23 changed files
with
503 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// Copyright 2022 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#include "ash/components/login/auth/auth_factors_data.h" | ||
|
||
#include "ash/components/cryptohome/cryptohome_parameters.h" | ||
#include "ash/components/login/auth/cryptohome_key_constants.h" | ||
|
||
namespace ash { | ||
|
||
AuthFactorsData::AuthFactorsData(std::vector<cryptohome::KeyDefinition> keys) | ||
: keys_(std::move(keys)) {} | ||
|
||
AuthFactorsData::AuthFactorsData() = default; | ||
AuthFactorsData::AuthFactorsData(const AuthFactorsData&) = default; | ||
AuthFactorsData::AuthFactorsData(AuthFactorsData&&) = default; | ||
AuthFactorsData::~AuthFactorsData() = default; | ||
AuthFactorsData& AuthFactorsData::operator=(const AuthFactorsData&) = default; | ||
|
||
const cryptohome::KeyDefinition* AuthFactorsData::FindOnlinePasswordKey() | ||
const { | ||
for (const cryptohome::KeyDefinition& key_def : keys_) { | ||
if (key_def.label == kCryptohomeGaiaKeyLabel) | ||
return &key_def; | ||
} | ||
for (const cryptohome::KeyDefinition& key_def : keys_) { | ||
// Check if label starts with prefix and has required type. | ||
if ((key_def.label.find(kCryptohomeGaiaKeyLegacyLabelPrefix) == 0) && | ||
key_def.type == cryptohome::KeyDefinition::TYPE_PASSWORD) | ||
return &key_def; | ||
} | ||
return nullptr; | ||
} | ||
|
||
} // namespace ash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// Copyright 2022 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#ifndef ASH_COMPONENTS_LOGIN_AUTH_AUTH_FACTORS_DATA_H_ | ||
#define ASH_COMPONENTS_LOGIN_AUTH_AUTH_FACTORS_DATA_H_ | ||
|
||
#include <string> | ||
|
||
#include "ash/components/cryptohome/cryptohome_parameters.h" | ||
|
||
namespace ash { | ||
|
||
// Public information about authentication keys configured for particular user. | ||
// This class partially encapsulates implementation details of key definition | ||
// (cryptohome::KeyData vs cryptohome::AuthFactor). | ||
// Note that this information does not contain any key secrets. | ||
class COMPONENT_EXPORT(ASH_LOGIN_AUTH) AuthFactorsData { | ||
public: | ||
explicit AuthFactorsData(std::vector<cryptohome::KeyDefinition> keys); | ||
|
||
// Empty constructor is needed so that UserContext can be created. | ||
AuthFactorsData(); | ||
// Copy constructor (and operator) are needed because UserContext is copyable. | ||
AuthFactorsData(const AuthFactorsData&); | ||
AuthFactorsData(AuthFactorsData&&); | ||
|
||
~AuthFactorsData(); | ||
|
||
AuthFactorsData& operator=(const AuthFactorsData&); | ||
|
||
// Returns metadata for the Password key, so that it can be identified for | ||
// further operations. | ||
const cryptohome::KeyDefinition* FindOnlinePasswordKey() const; | ||
|
||
private: | ||
std::vector<cryptohome::KeyDefinition> keys_; | ||
}; | ||
|
||
} // namespace ash | ||
|
||
#endif // ASH_COMPONENTS_LOGIN_AUTH_AUTH_FACTORS_DATA_H_ |
Oops, something went wrong.