diff options
author | Sara Golemon <sara.golemon@mongodb.com> | 2022-01-26 21:08:41 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-01-29 02:28:33 +0000 |
commit | 4f5c7688766e550d32863923ae6c23c09e2cb5e3 (patch) | |
tree | df6fbb1446b3c4fc3881bb59aac52bf6e6ca71b0 /src/mongo/rpc | |
parent | 8c067fed75dd4d986e61d6a675ba7133a4dce3a7 (diff) | |
download | mongo-4f5c7688766e550d32863923ae6c23c09e2cb5e3.tar.gz |
SERVER-63025 Unify security token placeholder implementations
Diffstat (limited to 'src/mongo/rpc')
-rw-r--r-- | src/mongo/rpc/metadata/security_token_metadata_test.cpp | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/src/mongo/rpc/metadata/security_token_metadata_test.cpp b/src/mongo/rpc/metadata/security_token_metadata_test.cpp index 9fcb2a55adc..40c0e8e3cea 100644 --- a/src/mongo/rpc/metadata/security_token_metadata_test.cpp +++ b/src/mongo/rpc/metadata/security_token_metadata_test.cpp @@ -45,21 +45,13 @@ namespace rpc { namespace test { namespace { -constexpr auto kAuthenticatedUserFieldName = "authenticatedUser"_sd; constexpr auto kPingFieldName = "ping"_sd; -constexpr auto kSigFieldName = "sig"_sd; BSONObj makeSecurityToken(const UserName& userName) { + constexpr auto authUserFieldName = auth::SecurityToken::kAuthenticatedUserFieldName; auto authUser = userName.toBSON(true /* serialize token */); ASSERT_EQ(authUser["tenant"_sd].type(), jstOID); - - BSONObjBuilder token; - token.append(kAuthenticatedUserFieldName, authUser); - - auto block = SHA256Block::computeHash({ConstDataRange(authUser.objdata(), authUser.objsize())}); - token.appendBinData(kSigFieldName, block.size(), BinDataGeneral, block.data()); - - return token.obj(); + return auth::signSecurityToken(BSON(authUserFieldName << authUser)); } class SecurityTokenMetadataTest : public LockerNoopServiceContextTest {}; |