summaryrefslogtreecommitdiff
path: root/tests/refresh-token-with-wrong-key.scm
diff options
context:
space:
mode:
authorVivien Kraus <vivien@planete-kraus.eu>2020-12-02 09:31:05 +0100
committerVivien Kraus <vivien@planete-kraus.eu>2021-06-05 16:15:35 +0200
commit9e4ffd421e33679ab4ae7a3e605dd64d8ff693e1 (patch)
treeedc8d6cc7e925c4917444a014236ed8c683615cc /tests/refresh-token-with-wrong-key.scm
parent8bf760384074e90dcc27c10d2c688cb5ac3dfa2f (diff)
Add the refresh token code
Diffstat (limited to 'tests/refresh-token-with-wrong-key.scm')
-rw-r--r--tests/refresh-token-with-wrong-key.scm29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/refresh-token-with-wrong-key.scm b/tests/refresh-token-with-wrong-key.scm
new file mode 100644
index 0000000..2609e1e
--- /dev/null
+++ b/tests/refresh-token-with-wrong-key.scm
@@ -0,0 +1,29 @@
+(use-modules (webid-oidc refresh-token)
+ (webid-oidc testing)
+ (webid-oidc jwk)
+ (webid-oidc errors)
+ (web uri)
+ (srfi srfi-19)
+ (web response)
+ (ice-9 optargs)
+ (ice-9 receive))
+
+(with-test-environment
+ "refresh-token-with-wrong-key"
+ (lambda ()
+ (define first-key (generate-key #:n-size 2048))
+ (define second-key (generate-key #:n-size 2048))
+ (define sub (string->uri "https://subject"))
+ (define aud (string->uri "https://audience"))
+ (define refresh-token (issue-refresh-token sub aud (jkt first-key)))
+ (with-exception-handler
+ (lambda (error)
+ (unless ((record-predicate &invalid-key-for-refresh-token) error)
+ (exit 1)))
+ (lambda ()
+ (with-refresh-token refresh-token second-key
+ (lambda (sub aud)
+ (exit 2)))
+ (exit 3))
+ #:unwind? #t
+ #:unwind-for-type &invalid-key-for-refresh-token)))