欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

权限过滤

程序员文章站 2022-07-12 18:54:44
...

权限过滤的根本是通过url里面是否包含权限关键字,并且根据需求进行对应的处理。


		// TODO Auto-generated method stub
		// place your code here
		HttpServletRequest req = (HttpServletRequest) request;
		HttpServletResponse resp = (HttpServletResponse) response;
		User user = new User(1,"zhao",123456,1);
		String requestURI = req.getRequestURI();
		if(user.getUserType()==1){
			if(!requestURI.contains("user")){
				System.out.println("权限不够");
				return;
			}
			chain.doFilter(request, response);
		}
	

 

相关标签: 过滤 java