Commit eca27cd18faef135a9b226334a2b265b074b3353
1 parent
4ed18c0f
修复退出页面 退出后重定向到登录页
Showing
2 changed files
with
3 additions
and
2 deletions
src/main/java/cn/iocoder/dashboard/framework/security/config/SecurityConfiguration.java
| ... | ... | @@ -152,7 +152,7 @@ public class SecurityConfiguration extends WebSecurityConfigurerAdapter { |
| 152 | 152 | .anyRequest().authenticated() |
| 153 | 153 | .and() |
| 154 | 154 | .headers().frameOptions().disable(); |
| 155 | - httpSecurity.logout().logoutUrl("/logout").logoutSuccessHandler(logoutSuccessHandler); | |
| 155 | + httpSecurity.logout().logoutUrl(webProperties.getApiPrefix() + "/logout").logoutSuccessHandler(logoutSuccessHandler); | |
| 156 | 156 | // 添加 JWT Filter |
| 157 | 157 | httpSecurity.addFilterBefore(authenticationTokenFilter, UsernamePasswordAuthenticationFilter.class); |
| 158 | 158 | } | ... | ... |
src/main/java/cn/iocoder/dashboard/framework/security/core/handler/LogoutSuccessHandlerImpl.java
| 1 | 1 | package cn.iocoder.dashboard.framework.security.core.handler; |
| 2 | 2 | |
| 3 | 3 | import cn.hutool.core.util.StrUtil; |
| 4 | +import cn.iocoder.dashboard.common.pojo.CommonResult; | |
| 4 | 5 | import cn.iocoder.dashboard.framework.security.config.SecurityProperties; |
| 5 | 6 | import cn.iocoder.dashboard.framework.security.core.service.SecurityAuthFrameworkService; |
| 6 | 7 | import cn.iocoder.dashboard.framework.security.core.util.SecurityFrameworkUtils; |
| ... | ... | @@ -36,6 +37,6 @@ public class LogoutSuccessHandlerImpl implements LogoutSuccessHandler { |
| 36 | 37 | securityFrameworkService.logout(token); |
| 37 | 38 | } |
| 38 | 39 | // 返回成功 |
| 39 | - ServletUtils.writeJSON(response, null); | |
| 40 | + ServletUtils.writeJSON(response, CommonResult.success(null)); | |
| 40 | 41 | } |
| 41 | 42 | } | ... | ... |