diff options
author | Vivien Kraus <vivien@planete-kraus.eu> | 2021-09-22 13:11:21 +0200 |
---|---|---|
committer | Vivien Kraus <vivien@planete-kraus.eu> | 2021-09-22 18:08:47 +0200 |
commit | 555e59deba33284067298ce6130c379c75e3d2a3 (patch) | |
tree | c15c823913e917bc474f1cf163caf65a117ee9c3 /src/scm/webid-oidc/token-endpoint.scm | |
parent | 0d74f8c1ca9c1e9bf9a04b85f598ba7a175d1d86 (diff) |
Use anonymous-http-request from (webid-oidc parameters) everywhere
Diffstat (limited to 'src/scm/webid-oidc/token-endpoint.scm')
-rw-r--r-- | src/scm/webid-oidc/token-endpoint.scm | 65 |
1 files changed, 31 insertions, 34 deletions
diff --git a/src/scm/webid-oidc/token-endpoint.scm b/src/scm/webid-oidc/token-endpoint.scm index 292df4d..a10c843 100644 --- a/src/scm/webid-oidc/token-endpoint.scm +++ b/src/scm/webid-oidc/token-endpoint.scm @@ -26,7 +26,6 @@ #:use-module ((webid-oidc parameters) #:prefix p:) #:use-module ((webid-oidc stubs) #:prefix stubs:) #:use-module ((webid-oidc refresh-token) #:prefix refresh:) - #:use-module (web client) #:use-module (web request) #:use-module (web response) #:use-module (web uri) @@ -179,7 +178,7 @@ port))))))) thunk)))) -(define (make-token-endpoint token-endpoint-uri iss issuer-key validity) +(define (make-token-endpoint token-endpoint-uri iss issuer-key) (lambda (request request-body) (when (bytevector? request-body) (set! request-body (utf8->string request-body))) @@ -295,35 +294,33 @@ (make-unsupported-grant-type grant-type) (make-exception-with-message final-message) (make-message-for-the-user final-user-message)))))) - (let* ((iat (time-second (date->time-utc current-time))) - (exp (+ iat validity))) - (let ((id-token - (issue <id-token> - issuer-key - #:webid webid - #:iss iss - #:aud client-id)) - (access-token - (issue <access-token> - issuer-key - #:webid webid - #:iss iss - #:client-key (jwk dpop) - #:client-id client-id)) - (refresh-token - (if (equal? grant-type "refresh_token") - (assoc-ref form-args "refresh_token") - (refresh:issue-refresh-token webid client-id - (jkt (jwk dpop)))))) - (values - (build-response #:headers '((content-type application/json) - (cache-control (no-cache no-store))) - #:port #f) - (stubs:scm->json-string - `((id_token . ,id-token) - (access_token . ,access-token) - (token_type . "DPoP") - (expires_in . ,validity) - (refresh_token . ,refresh-token))) - client-id - #f))))))))))) + (let ((id-token + (issue <id-token> + issuer-key + #:webid webid + #:iss iss + #:aud client-id)) + (access-token + (issue <access-token> + issuer-key + #:webid webid + #:iss iss + #:client-key (jwk dpop) + #:client-id client-id)) + (refresh-token + (if (equal? grant-type "refresh_token") + (assoc-ref form-args "refresh_token") + (refresh:issue-refresh-token webid client-id + (jkt (jwk dpop)))))) + (values + (build-response #:headers '((content-type application/json) + (cache-control (no-cache no-store))) + #:port #f) + (stubs:scm->json-string + `((id_token . ,id-token) + (access_token . ,access-token) + (token_type . "DPoP") + (expires_in . ,(p:oidc-token-default-validity)) + (refresh_token . ,refresh-token))) + client-id + #f)))))))))) |