|
@@ -35,18 +35,25 @@ public class SimpleUserToken implements UserToken {
|
|
|
|
|
|
public static SimpleUserToken of(Map<String, Object> map) {
|
|
|
Object authentication = map.get("authentication");
|
|
|
- if(authentication instanceof Authentication){
|
|
|
+ if (authentication instanceof Authentication) {
|
|
|
return FastBeanCopier.copy(map, new SimpleAuthenticationUserToken(((Authentication) authentication)));
|
|
|
}
|
|
|
return FastBeanCopier.copy(map, new SimpleUserToken());
|
|
|
}
|
|
|
|
|
|
+ public TokenState getState() {
|
|
|
+ if (state == TokenState.normal) {
|
|
|
+ checkExpired();
|
|
|
+ }
|
|
|
+ return state;
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
- public boolean isNormal() {
|
|
|
- if (checkExpired()) {
|
|
|
+ public boolean checkExpired() {
|
|
|
+ if (UserToken.super.checkExpired()) {
|
|
|
setState(TokenState.expired);
|
|
|
- return false;
|
|
|
+ return true;
|
|
|
}
|
|
|
- return UserToken.super.isNormal();
|
|
|
+ return false;
|
|
|
}
|
|
|
}
|