Add logout endpoint
parent
281930e3a0
commit
41339cf26a
|
@ -61,6 +61,14 @@ public class AuthenticationController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@RequestMapping(path = "/accesstoken/{token}", method = RequestMethod.DELETE)
|
||||||
|
public ResponseEntity<?> removeToken(@PathVariable String token) {
|
||||||
|
tokenStore.removeToken(token);
|
||||||
|
return ResponseEntity
|
||||||
|
.noContent()
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
@RequestMapping(path = "/accesstoken/{token}", method = RequestMethod.GET)
|
@RequestMapping(path = "/accesstoken/{token}", method = RequestMethod.GET)
|
||||||
public ResponseEntity<?> validateToken(@PathVariable String token) {
|
public ResponseEntity<?> validateToken(@PathVariable String token) {
|
||||||
if (tokenStore.isValidToken(token)) {
|
if (tokenStore.isValidToken(token)) {
|
||||||
|
|
|
@ -36,6 +36,7 @@ public class BasicTokenStore implements TokenStore {
|
||||||
|
|
||||||
// Token is invalid, it has expired
|
// Token is invalid, it has expired
|
||||||
if(basicToken.saveTime + ttl < CalendarUtils.getUTCCalendar().getTimeInMillis()) {
|
if(basicToken.saveTime + ttl < CalendarUtils.getUTCCalendar().getTimeInMillis()) {
|
||||||
|
tokenStore.remove(token);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Reference in New Issue