From bae1843f1a1d644fb3bd4f8c40b1dbb900aa3325 Mon Sep 17 00:00:00 2001 From: Vivien Kraus Date: Sun, 1 Aug 2021 14:51:28 +0200 Subject: Use guile parameters With parameters, the API does not need to care about the directory where to load files and how to get the time. --- src/scm/webid-oidc/oidc-id-token.scm | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/scm/webid-oidc/oidc-id-token.scm') diff --git a/src/scm/webid-oidc/oidc-id-token.scm b/src/scm/webid-oidc/oidc-id-token.scm index 9fe276c..e95efaf 100644 --- a/src/scm/webid-oidc/oidc-id-token.scm +++ b/src/scm/webid-oidc/oidc-id-token.scm @@ -20,6 +20,7 @@ #:use-module (webid-oidc jws) #:use-module (webid-oidc jti) #:use-module ((webid-oidc stubs) #:prefix stubs:) + #:use-module ((webid-oidc parameters) #:prefix p:) #:use-module (web uri) #:use-module (web client) #:use-module (ice-9 optargs) @@ -206,12 +207,13 @@ (iss #f) (sub #f) (aud #f) - (exp #f) - (iat #f)) + (validity 3600)) (unless sub (set! sub webid)) (id-token-encode (make-id-token `((alg . ,(symbol->string alg))) - (make-id-token-payload webid iss sub aud (stubs:random 12) exp iat)) + (let ((iat (time-second (date->time-utc ((p:current-date)))))) + (make-id-token-payload webid iss sub aud (stubs:random 12) + (+ iat validity) iat))) issuer-key)) -- cgit v1.2.3