fix logout

This commit is contained in:
Eduard Tihomirov 2024-10-24 15:18:37 +03:00
parent 73a6dad42b
commit 541188a28d
2 changed files with 7 additions and 3 deletions

View file

@ -25,7 +25,9 @@ public class LogoutSuccessHandler
public void onLogoutSuccess(HttpServletRequest request, HttpServletResponse response,
Authentication authentication) throws IOException {
String url = esiaAuthService.logout(request, response);
response.sendRedirect(url);
response.setStatus(HttpServletResponse.SC_OK);
response.getWriter().write(url);
response.getWriter().flush();
CsrfToken csrfToken = this.csrfTokenRepository.generateToken(request);
this.csrfTokenRepository.saveToken(csrfToken, request, response);
}

View file

@ -17,8 +17,10 @@ export class AuthenticationService {
return this.appConfigService.load().then(value => this.http.get<any>("version").toPromise())
}
logout(): Promise<string> {
return this.http.post<any>('esia/logout', {}).toPromise();
logout(): Promise<any> {
return this.http.post<string>('esia/logout', {}, { responseType: 'text' as 'json' }).toPromise().then(url => {
window.open(url, "_self");
});
}
public isAuthenticated(): boolean {