summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2025-03-19 16:22:42 -0600
committermo khan <mo@mokhan.ca>2025-03-19 16:22:42 -0600
commit45937c020872bca92ad7d8209be6eb719ec8dd53 (patch)
tree4cbff9aff037e4f99c24a1720dd11a9954f301f7 /bin
parent8f676777db5a16ff20315def95091cc2100bac56 (diff)
feat: check if jwt is still valid
Diffstat (limited to 'bin')
-rwxr-xr-xbin/idp9
1 files changed, 7 insertions, 2 deletions
diff --git a/bin/idp b/bin/idp
index 83c33e45..fdc6ab79 100755
--- a/bin/idp
+++ b/bin/idp
@@ -341,12 +341,17 @@ module Authz
iat: now,
nbf: now,
jti: SecureRandom.uuid,
+ exp: now + 3600,
}.merge(claims)
end
+ def [](claim)
+ claims.fetch(claim)
+ end
+
def active?
- # TODO:: check if current time is within valid range
- true
+ now = Time.now.to_i
+ self[:nbf] <= now && now < self[:exp]
end
def to_jwt