From f5f7d4e8253481e59ad89f7ec993c7739a47c81c Mon Sep 17 00:00:00 2001 From: Vivien Kraus Date: Wed, 2 Dec 2020 09:31:05 +0100 Subject: Add the refresh token code --- src/scm/webid-oidc/errors.scm | 34 ++++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) (limited to 'src/scm/webid-oidc/errors.scm') diff --git a/src/scm/webid-oidc/errors.scm b/src/scm/webid-oidc/errors.scm index 879b23c..e8ab5af 100644 --- a/src/scm/webid-oidc/errors.scm +++ b/src/scm/webid-oidc/errors.scm @@ -687,6 +687,26 @@ (raise-exception ((record-constructor &cannot-encode-authorization-code) authorization-code key cause))) +(define-public &invalid-refresh-token + (make-exception-type + '&invalid-refresh-token + &external-error + '(refresh-token))) + +(define-public (raise-invalid-refresh-token refresh-token) + (raise-exception + ((record-constructor &invalid-refresh-token) refresh-token))) + +(define-public &invalid-key-for-refresh-token + (make-exception-type + '&invalid-key-for-refresh-token + &external-error + '(key jkt))) + +(define-public (raise-invalid-key-for-refresh-token key jkt) + (raise-exception + ((record-constructor &invalid-key-for-refresh-token) key jkt))) + (define*-public (error->str err #:key (max-depth #f)) (if (record? err) (let* ((type (record-type-descriptor err)) @@ -956,16 +976,22 @@ ((¬-an-authorization-code-payload) (format #f (G_ "~s is not an authorization code payload (because ~a)") (get 'value) (recurse (get 'cause)))) - ((&authorization-code-expired) - (format #f (G_ "the current time is ~a, and the authorization code expired at ~a") - (time-second (date->time-utc (get 'current-time))) - (time-second (date->time-utc (get 'exp))))) + ((&authorization-code-expired) + (format #f (G_ "the current time is ~a, and the authorization code expired at ~a") + (time-second (date->time-utc (get 'current-time))) + (time-second (date->time-utc (get 'exp))))) ((&cannot-decode-authorization-code) (format #f (G_ "I cannot decode ~s as an authorization code (because ~a)") (get 'value) (recurse (get 'cause)))) ((&cannot-encode-authorization-code) (format #f (G_ "I cannot encode ~s as an authorization code (because ~a)") (get 'value) (recurse (get 'cause)))) + ((&invalid-refresh-token) + (format #f (G_ "there is no such refresh token as ~s") + (get 'refresh-token))) + ((&invalid-key-for-refresh-token) + (format #f (G_ "the refresh token is bound to a key confirmed as ~s, but it is used with key ~s") + (get 'jkt) (get 'key))) ((&compound-exception) (let ((components (get 'components))) (if (null? components) -- cgit v1.2.3