Skip to content

Commit

Permalink
mics secdist: prevent settings copy
Browse files Browse the repository at this point in the history
  • Loading branch information
mnink275 committed May 8, 2024
1 parent f139635 commit 05215b5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 2 additions & 1 deletion core/src/storages/secdist/default_provider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,8 @@ void UpdateFromEnv(formats::json::Value& doc,

} // namespace

DefaultProvider::DefaultProvider(Settings settings) : settings_{settings} {}
DefaultProvider::DefaultProvider(Settings settings)
: settings_{std::move(settings)} {}

formats::json::Value DefaultProvider::Get() const {
auto doc =
Expand Down
2 changes: 0 additions & 2 deletions core/src/storages/secdist/secdist_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,15 +99,13 @@ TEST(SecdistYamlConfig, Sample) {
{std::make_unique<storages::secdist::DefaultProvider>(
std::move(provider_settings))}};

/// [Secdist Usage Sample - SecdistConfig]
const auto& user_passwords = secdist_config.Get<UserPasswords>();

const auto password = UserPasswords::Password{"drowssap"};
const auto another_password = UserPasswords::Password{"drowssap rehtona"};
EXPECT_TRUE(user_passwords.IsMatching("username", password));
EXPECT_FALSE(user_passwords.IsMatching("username2", password));
EXPECT_TRUE(user_passwords.IsMatching("another username", another_password));
/// [Secdist Usage Sample - SecdistConfig]
}

UTEST(SecdistConfig, EnvironmentVariable) {
Expand Down

0 comments on commit 05215b5

Please sign in to comment.