summaryrefslogtreecommitdiff
path: root/src/scm/webid-oidc/errors.scm
diff options
context:
space:
mode:
authorVivien Kraus <vivien@planete-kraus.eu>2020-11-30 23:13:17 +0100
committerVivien Kraus <vivien@planete-kraus.eu>2021-06-19 15:44:36 +0200
commit197da00a94a2fecee59c5d7a090316e9dd82fe90 (patch)
tree1487ba9452b79703773e3855933ace5194e94bce /src/scm/webid-oidc/errors.scm
parent37c019d143a70bc6261eb8addcb24550b829e9bb (diff)
Fetch a client manifest on the web
Diffstat (limited to 'src/scm/webid-oidc/errors.scm')
-rw-r--r--src/scm/webid-oidc/errors.scm92
1 files changed, 92 insertions, 0 deletions
diff --git a/src/scm/webid-oidc/errors.scm b/src/scm/webid-oidc/errors.scm
index 2dc9edc..d6f685a 100644
--- a/src/scm/webid-oidc/errors.scm
+++ b/src/scm/webid-oidc/errors.scm
@@ -309,6 +309,16 @@
(raise-exception
((record-constructor &incorrect-client-id-field) value)))
+(define-public &incorrect-redirect-uris-field
+ (make-exception-type
+ '&incorrect-redirect-uris-field
+ &external-error
+ '(value)))
+
+(define-public (raise-incorrect-redirect-uris-field value)
+ (raise-exception
+ ((record-constructor &incorrect-redirect-uris-field) value)))
+
(define-public &incorrect-typ-field
(make-exception-type
'&incorrect-typ-field
@@ -549,6 +559,66 @@
(raise-exception
((record-constructor &cannot-fetch-linked-data) uri cause)))
+(define-public &not-a-client-manifest
+ (make-exception-type
+ '&not-a-client-manifest
+ &external-error
+ '(value cause)))
+
+(define-public (raise-not-a-client-manifest value cause)
+ (raise-exception
+ ((record-constructor &not-a-client-manifest) value cause)))
+
+(define-public &unauthorized-redirection-uri
+ (make-exception-type
+ '&unauthorized-redirection-uri
+ &external-error
+ '(manifest uri)))
+
+(define-public (raise-unauthorized-redirection-uri manifest uri)
+ (raise-exception
+ ((record-constructor &unauthorized-redirection-uri) manifest uri)))
+
+(define-public &cannot-serve-public-manifest
+ (make-exception-type
+ '&cannot-serve-public-manifest
+ &external-error
+ '()))
+
+(define-public (raise-cannot-serve-public-manifest)
+ (raise-exception
+ ((record-constructor &cannot-serve-public-manifest))))
+
+(define-public &no-client-manifest-registration
+ (make-exception-type
+ '&no-client-manifest-registration
+ &external-error
+ '(id)))
+
+(define-public (raise-no-client-manifest-registration id)
+ (raise-exception
+ ((record-constructor &no-client-manifest-registration) id)))
+
+(define-public &inconsistent-client-manifest-id
+ (make-exception-type
+ '&inconsistent-client-manifest-id
+ &external-error
+ '(id advertised-id)))
+
+(define-public (raise-inconsistent-client-manifest-id id advertised-id)
+ (raise-exception
+ ((record-constructor &inconsistent-client-manifest-id) id advertised-id)))
+
+(define-public &cannot-fetch-client-manifest
+ (make-exception-type
+ '&cannot-fetch-client-manifest
+ &external-error
+ '(id cause)))
+
+(define-public (raise-cannot-fetch-client-manifest id cause)
+ (raise-exception
+ ((record-constructor &cannot-fetch-client-manifest) id cause)))
+
(define*-public (error->str err #:key (max-depth #f))
(if (record? err)
(let* ((type (record-type-descriptor err))
@@ -682,6 +752,11 @@
(if value
(format #f (G_ "the client-id field is incorrect: ~s") value)
(format #f (G_ "the client-id field is missing")))))
+ ((&incorrect-redirect-uris-field)
+ (let ((value (get 'value)))
+ (if value
+ (format #f (G_ "the redirect_uris field is incorrect: ~s") value)
+ (format #f (G_ "the redirect_uris field is missing")))))
((&incorrect-typ-field)
(let ((value (get 'value)))
(if value
@@ -787,6 +862,23 @@
((&cannot-fetch-linked-data)
(format #f (G_ "I could not fetch a RDF graph at ~a (because ~a)")
(uri->string (get 'uri)) (recurse (get 'cause))))
+ ((&not-a-client-manifest)
+ (format #f (G_ "~s is not a client manifest (because ~a)")
+ (get 'value) (recurse (get 'cause))))
+ ((&unauthorized-redirection-uri)
+ (format #f (G_ "~s does not authorize redirection URI ~a")
+ (get 'manifest) (uri->string (get 'uri))))
+ ((&cannot-serve-public-manifest)
+ (format #f (G_ "I cannot serve a public manifest")))
+ ((&no-client-manifest-registration)
+ (format #f (G_ "~a does not have a client manifest registration triple")
+ (uri->string (get 'id))))
+ ((&inconsistent-client-manifest-id)
+ (format #f (G_ "the client manifest at ~a is advertised for ~a")
+ (uri->string (get 'id)) (uri->string (get 'advertised-id))))
+ ((&cannot-fetch-client-manifest)
+ (format #f (G_ "I could not fetch the client manifest of ~a (because ~a)")
+ (uri->string (get 'id)) (recurse (get 'cause))))
((&compound-exception)
(let ((components (get 'components)))
(if (null? components)