summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorVivien Kraus <vivien@planete-kraus.eu>2021-07-06 13:11:14 +0200
committerVivien Kraus <vivien@planete-kraus.eu>2021-07-06 13:11:14 +0200
commit366cc89e8ccaf519d973c507b8534f5527141d84 (patch)
tree2a601b591f4ca58189e853885383f7abd4e5024d /src
parent9d23792481d7ae8d75d9565dd2a0b1e17d08943b (diff)
Make sure that all dates in errors are actually dates and not timestamps
Diffstat (limited to 'src')
-rw-r--r--src/scm/webid-oidc/errors.scm25
1 files changed, 13 insertions, 12 deletions
diff --git a/src/scm/webid-oidc/errors.scm b/src/scm/webid-oidc/errors.scm
index 1eb5a78..6cd337a 100644
--- a/src/scm/webid-oidc/errors.scm
+++ b/src/scm/webid-oidc/errors.scm
@@ -512,9 +512,16 @@
&external-error
'(signed requested)))
+(define (the-date object)
+ (when (integer? object)
+ (set! object (make-time time-utc 0 object)))
+ (when (time? object)
+ (set! object (time-utc->date object)))
+ object)
+
(define-public (raise-dpop-signed-in-future signed requested)
(raise-exception
- ((record-constructor &dpop-signed-in-future) signed requested)))
+ ((record-constructor &dpop-signed-in-future) (the-date signed) (the-date requested))))
(define-public &dpop-too-old
(make-exception-type
@@ -524,7 +531,7 @@
(define-public (raise-dpop-too-old signed requested)
(raise-exception
- ((record-constructor &dpop-too-old) signed requested)))
+ ((record-constructor &dpop-too-old) (the-date signed) (the-date requested))))
(define-public &dpop-unconfirmed-key
(make-exception-type
@@ -693,16 +700,10 @@
'(exp current-time)))
(define-public (raise-authorization-code-expired exp current-time)
- (when (integer? exp)
- (set! exp (make-time time-utc 0 exp)))
- (when (time? exp)
- (set! exp (time-utc->date exp)))
- (when (integer? current-time)
- (set! current-time (make-time time-utc 0 current-time)))
- (when (time? current-time)
- (set! current-time (time-utc->date current-time)))
- (raise-exception
- ((record-constructor &authorization-code-expired) exp current-time)))
+ (raise-exception
+ ((record-constructor &authorization-code-expired)
+ (the-date exp)
+ (the-date current-time))))
(define-public &cannot-decode-authorization-code
(make-exception-type