Improve expiredAt calculation
This commit is contained in:
parent
8ffb306913
commit
1dbe320706
|
@ -20,7 +20,9 @@ import org.slf4j.LoggerFactory;
|
|||
import org.springframework.core.env.Environment;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
import java.time.Instant;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
|
||||
public abstract class AbstractAuthenticationService implements AuthenticationService {
|
||||
|
@ -98,7 +100,7 @@ public abstract class AbstractAuthenticationService implements AuthenticationSer
|
|||
|
||||
UserToken userToken = this.apiContext.getOperationsContext().getBuilderFactory().getBuilder(UserTokenBuilder.class)
|
||||
.issuedAt(new Date()).user(credential.getUserInfo())
|
||||
.token(UUID.randomUUID()).expiresAt(addADay(new Date()))
|
||||
.token(UUID.randomUUID()).expiresAt(Timestamp.valueOf(LocalDateTime.now().plusDays(1)))
|
||||
.build();
|
||||
|
||||
userToken = apiContext.getOperationsContext().getDatabaseRepository().getUserTokenDao().createOrUpdate(userToken);
|
||||
|
@ -187,7 +189,7 @@ public abstract class AbstractAuthenticationService implements AuthenticationSer
|
|||
|
||||
UserToken userToken = this.apiContext.getOperationsContext().getBuilderFactory().getBuilder(UserTokenBuilder.class)
|
||||
.token(UUID.randomUUID()).user(userInfo)
|
||||
.expiresAt(addADay(new Date())).issuedAt(new Date())
|
||||
.expiresAt(Timestamp.valueOf(LocalDateTime.now().plusDays(1))).issuedAt(new Date())
|
||||
.build();
|
||||
|
||||
apiContext.getOperationsContext().getDatabaseRepository().getUserTokenDao().createOrUpdate(userToken);
|
||||
|
|
Loading…
Reference in New Issue