[java-idp-oidc] 02/02: Use epoch seconds for Instant -variables in JSON.

Henri Mikkonen henri.mikkonen at iki.fi
Fri Feb 18 07:10:14 UTC 2022


This is an automated email from the git hooks/post-receive script.

hjmikkon pushed a commit to branch main
in repository java-idp-oidc.

View the commit online:
http://git.shibboleth.net/view/?p=java-idp-oidc.git;a=commit;h=ac5c661c8fb6ba3937a7614a1f0fc45cd2576d42

commit ac5c661c8fb6ba3937a7614a1f0fc45cd2576d42
Author: Henri Mikkonen <henri.mikkonen at iki.fi>
AuthorDate: Fri Feb 18 09:09:26 2022 +0200

    Use epoch seconds for Instant -variables in JSON.
---
 .../op/token/support/RegistrationClaimsSet.java    | 45 +++++++++++++++++++++-
 1 file changed, 44 insertions(+), 1 deletion(-)

diff --git a/idp-oidc-extension-api/src/main/java/net/shibboleth/idp/plugin/oidc/op/token/support/RegistrationClaimsSet.java b/idp-oidc-extension-api/src/main/java/net/shibboleth/idp/plugin/oidc/op/token/support/RegistrationClaimsSet.java
index 30fef29e..2139be0b 100644
--- a/idp-oidc-extension-api/src/main/java/net/shibboleth/idp/plugin/oidc/op/token/support/RegistrationClaimsSet.java
+++ b/idp-oidc-extension-api/src/main/java/net/shibboleth/idp/plugin/oidc/op/token/support/RegistrationClaimsSet.java
@@ -25,7 +25,10 @@ import javax.annotation.Nonnull;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fasterxml.jackson.annotation.JsonGetter;
 import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonSetter;
 
 import net.shibboleth.oidc.metadata.policy.MetadataPolicy;
 
@@ -158,6 +161,26 @@ public final class RegistrationClaimsSet {
         this.expiration = exp;
     }
 
+    /**
+     * Get the expiration time of the token using epoch seconds.
+     * 
+     * @return The expiration time of the token using epoch seconds.
+     */
+    @JsonGetter("exp")
+    public long getExpirationEpoch() {
+        return expiration.getEpochSecond();
+    }
+
+    /**
+     * Set the expiration time of the token using epoch seconds.
+     * 
+     * @param exp What to set.
+     */
+    @JsonSetter("exp")
+    public void setExpirationEpoch(final long exp) {
+        this.expiration = Instant.ofEpochSecond(exp);
+    }
+
     /**
      * Get the issuance time of the token.
      * 
@@ -175,7 +198,27 @@ public final class RegistrationClaimsSet {
     public void setIssuedAt(final Instant iat) {
         this.issuedAt = iat;
     }
-    
+
+    /**
+     * Set the issuance time of the token using epoch seconds.
+     * 
+     * @param iat What to set.
+     */
+    @JsonSetter("iat")
+    public void setIssuedAtEpoch(final long iat) {
+        this.issuedAt = Instant.ofEpochSecond(iat);
+    }
+
+    /**
+     * Get the issuance time of the token using epoch seconds.
+     * 
+     * @return The issuance time of the token using epoch seconds.
+     */
+    @JsonGetter("iat")
+    public long getIssuedAtEpoch() {
+        return issuedAt.getEpochSecond();
+    }
+
     /**
      * Get the principal who issued the token.
      * 

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list