summaryrefslogtreecommitdiff
path: root/tests/dpop-proof-wrong-htu.scm
diff options
context:
space:
mode:
Diffstat (limited to 'tests/dpop-proof-wrong-htu.scm')
-rw-r--r--tests/dpop-proof-wrong-htu.scm37
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/dpop-proof-wrong-htu.scm b/tests/dpop-proof-wrong-htu.scm
new file mode 100644
index 0000000..f8ecb29
--- /dev/null
+++ b/tests/dpop-proof-wrong-htu.scm
@@ -0,0 +1,37 @@
+(use-modules (webid-oidc dpop-proof)
+ (webid-oidc jti)
+ (webid-oidc jwk)
+ (webid-oidc testing)
+ (webid-oidc errors)
+ (web uri)
+ (srfi srfi-19)
+ (web response))
+
+(with-test-environment
+ "dpop-proof-wrong-htu"
+ (lambda ()
+ (define jwk (generate-key #:n-size 2048))
+ (define cnf (jkt jwk))
+ (define blacklist (make-jti-list))
+ (define proof
+ (issue-dpop-proof
+ jwk
+ #:alg 'RS256
+ #:htm 'GET
+ #:htu (string->uri "https://example.com/other-res#frag")
+ #:iat (time-utc->date (make-time time-utc 0 0))))
+ (with-exception-handler
+ (lambda (error)
+ (unless ((record-predicate &dpop-uri-mismatch)
+ ((record-accessor &cannot-decode-dpop-proof 'cause) error))
+ (raise-exception error)))
+ (lambda ()
+ (dpop-proof-decode (time-utc->date (make-time time-utc 0 10))
+ blacklist
+ 'GET
+ (string->uri "https://example.com/res?query")
+ proof
+ cnf)
+ (exit 2))
+ #:unwind? #t
+ #:unwind-for-type &cannot-decode-dpop-proof)))