# spring-boot-author-test **Repository Path**: shuhao/spring-boot-author-test ## Basic Information - **Project Name**: spring-boot-author-test - **Description**: 使用springboot开发的一个权限校验的小栗子 - **Primary Language**: Java - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2017-08-02 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README #spring-boot-author-test 使用springboot开发的一个权限校验的小栗子。 1、使用filter,在进入系统时,获取用户的权限,将权限放到session中。(getParam和getAttribute的区别) 2、在对应的资源(方法)上添加校验权限的注解@Access。校验当前用户的权限与访问资源的权限是否匹配 3、通过aop来处理@Access注解验权 4、通过抛异常来提示用户权限不对。采用全局异常处理,如果请求的资源返回的是页面,则抛出NoAuthorToPageException,如果请求的资源是一个json接口,则抛出NoAuthorToJsonException 5、全局异常捕获抛出来的没有权限的异常,并返回相应的请求给用户 注意springboot中返回html页面时的spring-boot-starter-thymeleaf模块。默认将资源页面放在resources/templates目录下