@@ -68,8 +68,9 @@ function sessionToken(r) {
6868}
6969
7070/**
71- * Get the instance profile credentials needed to authenticate against Lambda from
72- * a backend cache. If the credentials cannot be found, then return undefined.
71+ * Get the instance profile credentials needed to authenticate against services
72+ * in AWS such as S3 and Lambda from a backend cache. If the credentials cannot
73+ * be found, then return undefined.
7374 * @param r {Request} HTTP request object (not used, but required for NGINX configuration)
7475 * @returns {undefined|{accessKeyId: (string), secretAccessKey: (string), sessionToken: (string|null), expiration: (string|null)} } AWS instance profile credentials or undefined
7576 */
@@ -363,14 +364,14 @@ async function _fetchEC2RoleCredentials() {
363364
364365/**
365366 * Get the credentials by assuming calling AssumeRoleWithWebIdentity with the environment variable
366- * values ROLE_ARN, AWS_WEB_IDENTITY_TOKEN_FILE and HOSTNAME
367+ * values ROLE_ARN, AWS_WEB_IDENTITY_TOKEN_FILE and AWS_ROLE_SESSION_NAME.
367368 *
368369 * @returns {Promise<{accessKeyId: (string), secretAccessKey: (string), sessionToken: (string), expiration: (string)}> }
369370 * @private
370371 */
371372async function _fetchWebIdentityCredentials ( r ) {
372373 const arn = process . env [ 'AWS_ROLE_ARN' ] ;
373- const name = process . env [ 'HOSTNAME' ] || 'nginx-lambda-gateway' ;
374+ const name = process . env [ 'AWS_ROLE_SESSION_NAME' ] ;
374375
375376 let sts_endpoint = process . env [ 'STS_ENDPOINT' ] ;
376377 if ( ! sts_endpoint ) {
@@ -426,12 +427,12 @@ async function _fetchWebIdentityCredentials(r) {
426427 *
427428 * @returns {Date } The current moment as a timestamp
428429 */
429- function getNow ( ) {
430+ function Now ( ) {
430431 return NOW ;
431432}
432433
433434export default {
434- getNow ,
435+ Now ,
435436 fetchCredentials,
436437 readCredentials,
437438 sessionToken,
0 commit comments