From b93f1cb85a9e61418c9418462ac7549e04c7edaa Mon Sep 17 00:00:00 2001 From: Vivien Kraus Date: Mon, 30 Nov 2020 21:39:32 +0100 Subject: Implement the DPoP proof --- tests/dpop-proof-wrong-htm.scm | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 tests/dpop-proof-wrong-htm.scm (limited to 'tests/dpop-proof-wrong-htm.scm') diff --git a/tests/dpop-proof-wrong-htm.scm b/tests/dpop-proof-wrong-htm.scm new file mode 100644 index 0000000..4531a44 --- /dev/null +++ b/tests/dpop-proof-wrong-htm.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-htm" + (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 'POST + #:htu (string->uri "https://example.com/res#frag") + #:iat (time-utc->date (make-time time-utc 0 0)))) + (with-exception-handler + (lambda (error) + (unless ((record-predicate &dpop-method-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))) -- cgit v1.2.3