From 1b126c7792c9fe122afa7b1ed5b4b0ce7c03818b Mon Sep 17 00:00:00 2001 From: BuildTools Date: Sun, 8 Nov 2020 17:06:08 +0100 Subject: [PATCH] Token expiration fixed --- .../exceptions/TokenExpiredException.java | 13 +++++++++++++ .../plannaplan/security/AuthenticationProvider.java | 6 +++++- 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100755 buisnesslogic/src/main/java/com/plannaplan/exceptions/TokenExpiredException.java diff --git a/buisnesslogic/src/main/java/com/plannaplan/exceptions/TokenExpiredException.java b/buisnesslogic/src/main/java/com/plannaplan/exceptions/TokenExpiredException.java new file mode 100755 index 0000000..2507ad6 --- /dev/null +++ b/buisnesslogic/src/main/java/com/plannaplan/exceptions/TokenExpiredException.java @@ -0,0 +1,13 @@ +package com.plannaplan.exceptions; + +public class TokenExpiredException extends RuntimeException { + /** + * + */ + private static final long serialVersionUID = 1L; + + public TokenExpiredException(String message) { + super(message); + } + +} \ No newline at end of file diff --git a/restservice/src/main/java/com/plannaplan/security/AuthenticationProvider.java b/restservice/src/main/java/com/plannaplan/security/AuthenticationProvider.java index 562609d..e094488 100755 --- a/restservice/src/main/java/com/plannaplan/security/AuthenticationProvider.java +++ b/restservice/src/main/java/com/plannaplan/security/AuthenticationProvider.java @@ -70,7 +70,11 @@ public class AuthenticationProvider extends AbstractUserDetailsAuthenticationPro @Override public boolean isCredentialsNonExpired() { - return user.isCredentialsNonExpired(); + if (user.isCredentialsNonExpired()) { + userService.save(user); + return true; + } + return false; } @Override