[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libeufin] 04/04: Testing token default lifetime.
From: |
gnunet |
Subject: |
[libeufin] 04/04: Testing token default lifetime. |
Date: |
Tue, 26 Sep 2023 11:12:30 +0200 |
This is an automated email from the git hooks/post-receive script.
ms pushed a commit to branch master
in repository libeufin.
commit 59900a472fb3a474b4ba6401637dca1d550e5bca
Author: MS <ms@taler.net>
AuthorDate: Tue Sep 26 11:12:12 2023 +0200
Testing token default lifetime.
---
bank/src/test/kotlin/LibeuFinApiTest.kt | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/bank/src/test/kotlin/LibeuFinApiTest.kt
b/bank/src/test/kotlin/LibeuFinApiTest.kt
index c0cbaaa5..4cd2323f 100644
--- a/bank/src/test/kotlin/LibeuFinApiTest.kt
+++ b/bank/src/test/kotlin/LibeuFinApiTest.kt
@@ -141,7 +141,7 @@ class LibeuFinApiTest {
application {
corebankWebApp(db, ctx)
}
- client.post("/accounts/foo/token") {
+ val newTok = client.post("/accounts/foo/token") {
expectSuccess = true
contentType(ContentType.Application.Json)
basicAuth("foo", "pw")
@@ -151,6 +151,11 @@ class LibeuFinApiTest {
""".trimIndent()
)
}
+ // Checking that the token lifetime defaulted to 24 hours.
+ val newTokObj =
Json.decodeFromString<TokenSuccessResponse>(newTok.bodyAsText())
+ val newTokDb =
db.bearerTokenGet(Base32Crockford.decode(newTokObj.access_token))
+ val lifeTime = newTokDb!!.expirationTime - newTokDb.creationTime
+ assert(Duration.ofHours(24).seconds * 1000000 == lifeTime)
// foo tries on bar endpoint
val r = client.post("/accounts/bar/token") {
expectSuccess = false
@@ -171,7 +176,7 @@ class LibeuFinApiTest {
)
)
)
- // Testing the bearer-token:-scheme.
+ // Testing the secret-token:-scheme.
client.post("/accounts/foo/token") {
headers.set("Authorization", "Bearer
secret-token:${Base32Crockford.encode(fooTok)}")
contentType(ContentType.Application.Json)
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.