Skip to content

Commit 1e0bb18

Browse files
authored
chore: update auth token generator default expiry time (#3067)
1 parent 41bcd4a commit 1e0bb18

File tree

3 files changed

+24
-1
lines changed

3 files changed

+24
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[
2+
{
3+
"type": "bugfix",
4+
"category": "DSQL",
5+
"description": "Updates default `AuthTokenGenerator` token expiration time from 700 to 900 seconds."
6+
}
7+
]

src/DSQL/AuthTokenGenerator.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class AuthTokenGenerator
1818
private const DB_CONNECT = 'DbConnect';
1919
private const DB_CONNECT_ADMIN = 'DbConnectAdmin';
2020
private const SIGNING_NAME = 'dsql';
21-
private const DEFAULT_EXPIRATION_TIME_SECONDS = 700;
21+
private const DEFAULT_EXPIRATION_TIME_SECONDS = 900;
2222

2323
/**
2424
* @var Credentials|callable

tests/DSQL/AuthTokenGeneratorTest.php

+16
Original file line numberDiff line numberDiff line change
@@ -143,4 +143,20 @@ public function testThrowsExceptionWithInvalidLifetime($expiration, $action)
143143
$expiration
144144
);
145145
}
146+
147+
public function testTokenGenerationDefaultExpiration()
148+
{
149+
$accessKeyId = 'AKID';
150+
$secretKeyId = 'SECRET';
151+
$credentials = new Credentials($accessKeyId, $secretKeyId);
152+
$tokenGenerator = new AuthTokenGenerator($credentials);
153+
$token = $tokenGenerator->generateDbConnectAuthToken(
154+
'peccy.dsql.us-east-1.on.aws',
155+
'us-east-1'
156+
);
157+
158+
$this->assertStringContainsString('X-Amz-Credential=AKID', $token);
159+
$this->assertStringContainsString('X-Amz-Expires=900', $token);
160+
$this->assertStringContainsString('us-east-1%2Fdsql', $token);
161+
}
146162
}

0 commit comments

Comments
 (0)