mirror of
https://github.com/FatttSnake/Pinnacle-OA.git
synced 2026-04-05 23:11:24 +08:00
Added unauthorized access response. Added logout.
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
package com.cfive.pinnacle.handler;
|
||||
|
||||
import com.cfive.pinnacle.entity.common.ResponseCode;
|
||||
import com.cfive.pinnacle.utils.WebUtil;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.springframework.security.core.AuthenticationException;
|
||||
import org.springframework.security.web.AuthenticationEntryPoint;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@Component
|
||||
public class AuthenticationEntryPointHandler implements AuthenticationEntryPoint {
|
||||
@Override
|
||||
public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException authException) throws IOException {
|
||||
String objectResponse = WebUtil.objectResponse(ResponseCode.UNAUTHORIZED, "Unauthorized access", null);
|
||||
WebUtil.renderString(response, objectResponse);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user