配置登录安全验证接口返回JSON数据
This commit is contained in:
parent
fd756fe7b3
commit
b93aa6f844
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
.idea
|
||||||
|
*.iml
|
@ -8,7 +8,7 @@
|
|||||||
</list>
|
</list>
|
||||||
</option>
|
</option>
|
||||||
</component>
|
</component>
|
||||||
<component name="ProjectRootManager">
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="17" project-jdk-type="JavaSDK">
|
||||||
<output url="file://$PROJECT_DIR$/out" />
|
<output url="file://$PROJECT_DIR$/out" />
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
@ -26,15 +26,16 @@ public class SecurityConfiguration {
|
|||||||
.anyRequest().authenticated()
|
.anyRequest().authenticated()
|
||||||
.and()
|
.and()
|
||||||
.formLogin()
|
.formLogin()
|
||||||
.loginProcessingUrl("/api/auth/login")
|
.loginProcessingUrl("/api/auth/login")//登录页面
|
||||||
.successHandler(this::onAuthenticationSuccess)
|
.successHandler(this::onAuthenticationSuccess)//登录成功返回
|
||||||
.failureHandler(this::onAuthenticationFailure)
|
.failureHandler(this::onAuthenticationFailure)//登录失败返回
|
||||||
.and()
|
.and()
|
||||||
.logout()
|
.logout()
|
||||||
.logoutUrl("api/auth/logout")
|
.logoutUrl("api/auth/logout")
|
||||||
.and()
|
.and()
|
||||||
.csrf()
|
.csrf()
|
||||||
.disable()
|
.disable()
|
||||||
|
//无权限返回
|
||||||
.exceptionHandling()
|
.exceptionHandling()
|
||||||
.authenticationEntryPoint(this::onAuthenticationFailure)
|
.authenticationEntryPoint(this::onAuthenticationFailure)
|
||||||
.and()
|
.and()
|
||||||
|
Loading…
Reference in New Issue
Block a user