MCPcopy
hub / github.com/mongodb/node-mongodb-native / makeMongoCredentialsFromAWSTemp

Function makeMongoCredentialsFromAWSTemp

src/cmap/auth/mongodb_aws.ts:151–166  ·  view source on GitHub ↗
(creds: AWSTempCredentials)

Source from the content-addressed store, hash-verified

149 awsCredentialFetcher: AWSSDKCredentialProvider
150): Promise<MongoCredentials> {
151 function makeMongoCredentialsFromAWSTemp(creds: AWSTempCredentials) {
152 // The AWS session token (creds.Token) may or may not be set.
153 if (!creds.AccessKeyId || !creds.SecretAccessKey) {
154 throw new MongoMissingCredentialsError('Could not obtain temporary MONGODB-AWS credentials');
155 }
156
157 return new MongoCredentials({
158 username: creds.AccessKeyId,
159 password: creds.SecretAccessKey,
160 source: credentials.source,
161 mechanism: AuthMechanism.MONGODB_AWS,
162 mechanismProperties: {
163 AWS_SESSION_TOKEN: creds.Token
164 }
165 });
166 }
167 const temporaryCredentials = await awsCredentialFetcher.getCredentials();
168
169 return makeMongoCredentialsFromAWSTemp(temporaryCredentials);

Callers 1

makeTempCredentialsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected