Fix refresh token mecanism.
This commit is contained in:
@@ -49,6 +49,7 @@ export class JwtInterceptor implements HttpInterceptor {
|
||||
this.userRestService.refreshToken(refreshTokenRequest)
|
||||
.then(refreshTokenResponse => {
|
||||
this.authenticationService.authenticate(refreshTokenResponse.accessToken, refreshTokenResponse.refreshToken);
|
||||
this.refreshTokenSubject.next(refreshTokenResponse.accessToken);
|
||||
})
|
||||
.catch(() => {
|
||||
return this.handleNoRefreshToken(initialError);
|
||||
|
||||
@@ -29,16 +29,7 @@ export class AuthenticationService {
|
||||
}
|
||||
|
||||
isAuthenticated(): boolean {
|
||||
let result = false;
|
||||
|
||||
const userDetails = this.extractUserDetails();
|
||||
|
||||
if (userDetails) {
|
||||
const authenticationExpiration = new Date(userDetails.exp * 1000);
|
||||
result = authenticationExpiration > new Date();
|
||||
}
|
||||
|
||||
return result;
|
||||
return !!localStorage.getItem(JWT_PARAM);
|
||||
}
|
||||
|
||||
getAuthenticatedUser(): User | undefined {
|
||||
|
||||
Reference in New Issue
Block a user