Skip to content

Commit

Permalink
Merge pull request #20 from Bahmni-Covid19/327-redirect-on-login
Browse files Browse the repository at this point in the history
327 | Resolves redirection issue after login
  • Loading branch information
rohit-yawalkar authored Nov 19, 2021
2 parents 31af760 + b9d11f0 commit 824baa2
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/main/java/in/org/projecteka/hiu/user/JWTGenerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.time.temporal.ChronoUnit;

import static in.org.projecteka.hiu.common.Constants.IST;
Expand All @@ -28,7 +29,7 @@ public String tokenFrom(User user) {
.claim("username", user.getUsername())
.claim("role", user.getRole())
.claim("isVerified", user.isVerified())
.claim("exp", LocalDateTime.now().plus(1, ChronoUnit.HOURS).atZone(ZoneId.of(IST)).toInstant().toEpochMilli())
.claim("exp", ZonedDateTime.of(LocalDateTime.now(ZoneId.of(IST)), ZoneId.systemDefault()).plus(1, ChronoUnit.HOURS).toInstant().toEpochMilli())
.build();
JWSObject jwsObject = new JWSObject(new JWSHeader(JWSAlgorithm.HS256), new Payload(claims.toJSONObject()));
jwsObject.sign(signer);
Expand Down

0 comments on commit 824baa2

Please sign in to comment.