diff --git a/authentication/pom.xml b/authentication/pom.xml index f478be9..7975937 100644 --- a/authentication/pom.xml +++ b/authentication/pom.xml @@ -5,7 +5,7 @@ authentication-sdk jar APS Java SDK : Authentication SDK - 0.1.0-beta + 0.1.1-beta Client SDK for Authentication API https://aps.autodesk.com/ @@ -152,7 +152,7 @@ UTF-8 1.3.2 2.2.30 - 0.1.0-beta + 0.1.1-beta 3.0.2 3.8.1 3.5.0 diff --git a/authentication/src/main/java/com/autodesk/aps/authentication/model/TwoLeggedToken.java b/authentication/src/main/java/com/autodesk/aps/authentication/model/TwoLeggedToken.java index ea79994..ce71947 100644 --- a/authentication/src/main/java/com/autodesk/aps/authentication/model/TwoLeggedToken.java +++ b/authentication/src/main/java/com/autodesk/aps/authentication/model/TwoLeggedToken.java @@ -23,6 +23,7 @@ package com.autodesk.aps.authentication.model; +import java.time.Instant; import java.util.Objects; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; @@ -58,7 +59,7 @@ public class TwoLeggedToken { private Integer expiresIn; public static final String JSON_PROPERTY_EXPIRES_AT = "expires_at"; - private Integer expiresAt; + private Long expiresAt; public TwoLeggedToken accessToken(String accessToken) { @@ -134,10 +135,11 @@ public Integer getExpiresIn() { @JsonInclude(value = JsonInclude.Include.ALWAYS) public void setExpiresIn(Integer expiresIn) { this.expiresIn = expiresIn; + // set expiresAt based on expiresIn + this.expiresAt = Instant.now().getEpochSecond() + expiresIn; } - public TwoLeggedToken expiresAt(Integer expiresAt) { - + public TwoLeggedToken expiresAt(Long expiresAt) { this.expiresAt = expiresAt; return this; } @@ -152,13 +154,13 @@ public TwoLeggedToken expiresAt(Integer expiresAt) { @JsonProperty(JSON_PROPERTY_EXPIRES_AT) @JsonInclude(value = JsonInclude.Include.NON_NULL) - public Integer getExpiresAt() { + public Long getExpiresAt() { return expiresAt; } @JsonProperty(JSON_PROPERTY_EXPIRES_AT) @JsonInclude(value = JsonInclude.Include.NON_NULL) - public void setExpiresAt(Integer expiresAt) { + public void setExpiresAt(Long expiresAt) { this.expiresAt = expiresAt; } diff --git a/samples/pom.xml b/samples/pom.xml index 4eabe80..4c1a53a 100644 --- a/samples/pom.xml +++ b/samples/pom.xml @@ -77,7 +77,7 @@ UTF-8 0.1.0-beta 0.1.0-beta - 0.1.0-beta + 0.1.1-beta 0.1.0-beta 0.1.0-beta 3.8.1 diff --git a/samples/src/main/java/com/autodesk/aps/samples/AuthenticationSample.java b/samples/src/main/java/com/autodesk/aps/samples/AuthenticationSample.java index da2551d..9dd5c73 100644 --- a/samples/src/main/java/com/autodesk/aps/samples/AuthenticationSample.java +++ b/samples/src/main/java/com/autodesk/aps/samples/AuthenticationSample.java @@ -34,7 +34,6 @@ public class AuthenticationSample { String clientSecret = dotenv.get("CLIENT_SECRET"); String accessToken = dotenv.get("ACCESS_TOKEN"); - void initialize() { SdkManager sdkManager = SdkManagerBuilder.create() .addLogger(new ApsLogger(Level.DEBUG)) @@ -50,8 +49,8 @@ void getTwoLeggedToken() { System.out.println("ExpiresIn : " + response.getExpiresIn()); System.out.println("TokenType : " + response.getTokenType()); - Instant expiresAtInstant = Instant.ofEpochMilli(response.getExpiresIn()); - LocalDateTime expiresAtLocal = LocalDateTime.ofInstant(expiresAtInstant, ZoneId.systemDefault()); + LocalDateTime expiresAtLocal = LocalDateTime.ofInstant(Instant.ofEpochSecond(response.getExpiresAt()), + ZoneId.systemDefault()); System.out.println("ExpiresAt (Local Time) : " + expiresAtLocal); } catch (Exception e) { diff --git a/sdkmanager/pom.xml b/sdkmanager/pom.xml index 82041a4..28fdff6 100644 --- a/sdkmanager/pom.xml +++ b/sdkmanager/pom.xml @@ -5,7 +5,7 @@ sdkmanager jar APS Java SDK : SDK Manager - 0.1.0-beta + 0.1.1-beta Common SDK Manager to support the various Autodesk Platform Services SDKs. https://aps.autodesk.com/ @@ -119,9 +119,9 @@ 17 17 2.2.0 - 5.5 + 5.5.1 2.15.3 - 2.0.9 - 1.4.12 + 2.0.17 + 1.5.21 \ No newline at end of file