鉴权写入前对权限的非空校验
This commit is contained in:
parent
363e7f40bf
commit
b804fa68cf
@ -61,16 +61,19 @@ public class ManagerAuthenticationFilter extends BasicAuthenticationFilter {
|
|||||||
//获取用户信息,存入context
|
//获取用户信息,存入context
|
||||||
UsernamePasswordAuthenticationToken authentication = getAuthentication(jwt, response);
|
UsernamePasswordAuthenticationToken authentication = getAuthentication(jwt, response);
|
||||||
//自定义权限过滤
|
//自定义权限过滤
|
||||||
customAuthentication(request, response, authentication);
|
if (authentication != null) {
|
||||||
SecurityContextHolder.getContext().setAuthentication(authentication);
|
customAuthentication(request, response, authentication);
|
||||||
|
SecurityContextHolder.getContext().setAuthentication(authentication);
|
||||||
|
}
|
||||||
chain.doFilter(request, response);
|
chain.doFilter(request, response);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 自定义权限过滤
|
* 自定义权限过滤
|
||||||
*
|
*
|
||||||
* @param request
|
* @param request 请求
|
||||||
* @param authentication
|
* @param response 响应
|
||||||
|
* @param authentication 用户信息
|
||||||
*/
|
*/
|
||||||
private void customAuthentication(HttpServletRequest request, HttpServletResponse response, UsernamePasswordAuthenticationToken authentication) throws NoPermissionException {
|
private void customAuthentication(HttpServletRequest request, HttpServletResponse response, UsernamePasswordAuthenticationToken authentication) throws NoPermissionException {
|
||||||
AuthUser authUser = (AuthUser) authentication.getDetails();
|
AuthUser authUser = (AuthUser) authentication.getDetails();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user