Skip to content

Commit

Permalink
Merge pull request #339 from ase-101/feature-ES-4
Browse files Browse the repository at this point in the history
Test case failure fix
  • Loading branch information
vishwa-vyom authored Sep 6, 2023
2 parents 56a8ef8 + 74c069c commit 61b4df4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,9 @@ private String getValidClientNonce() {
String cNonce = (transaction == null) ?
(String) parsedAccessToken.getClaims().get(C_NONCE) :
transaction.getCNonce();
long cNonceExpire = (transaction == null) ?
(long) parsedAccessToken.getClaims().getOrDefault(C_NONCE_EXPIRES_IN, 0):
Object nonceExpireSeconds = parsedAccessToken.getClaims().getOrDefault(C_NONCE_EXPIRES_IN, 0);
int cNonceExpire = (transaction == null) ?
nonceExpireSeconds instanceof Long ? (int)(long)nonceExpireSeconds : (int)nonceExpireSeconds :
transaction.getCNonceExpireSeconds();
long issuedEpoch = (transaction == null) ?
((Instant) parsedAccessToken.getClaims().getOrDefault(JwtClaimNames.IAT, Instant.MIN)).getEpochSecond():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
import java.security.NoSuchAlgorithmException;
import java.security.interfaces.RSAPrivateKey;
import java.security.interfaces.RSAPublicKey;
import java.time.Clock;
import java.time.Instant;
import java.time.LocalDateTime;
import java.time.ZoneOffset;
import java.util.*;
Expand Down Expand Up @@ -74,7 +76,7 @@ public void setup() {
public void getCredential_withValidDetails_thenPass() {
Map<String, Object> claims = new HashMap<>();
claims.put("scope", "sample_vc_ldp");
claims.put("iat", LocalDateTime.now(ZoneOffset.UTC).minusSeconds(10).toEpochSecond(ZoneOffset.UTC));
claims.put("iat", Instant.now(Clock.systemUTC()).minusSeconds(10));
claims.put("c_nonce", "test-nonce");
claims.put("c_nonce_expires_in", 60);
claims.put("accessTokenHash", "access-token-hash");
Expand Down

0 comments on commit 61b4df4

Please sign in to comment.