@EnableGlobalMethodSecurity(securedEnabled = true,jsr250Enabled = true)
@Secured({"ADMIN","ADMIN1"})
@RolesAllowed({"ADMIN","ADMIN1"})
使用方式相似,RolesAllowed更正式
@PreAuthorize("hasRole('ADMIN') AND hasRole('ADMIN1')") 的string参数是一个SpEL表达式
@PreAuthorize("hasRole('ADMIN') and #user.username.length() <=6")
@PostAuthorize("returnObject.username == principal.username")
过滤方法
@PostFilter("hasRole('ADMIN') || filterObject.username == principal.username")
@PreFilter("hasRole('ADMIN') || #filterObject.endsWith('admin')")
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
mysecurity.zip (49个子文件)
mysecurity
pom.xml 3KB
target
test-classes
com
young
security
mysecurity
MysecurityApplicationTests.class 1015B
classes
application.yml 253B
templates
admin
center.html 502B
admin1
index.html 511B
login.html 824B
index.html 1KB
hello.html 503B
com
young
security
mysecurity
config
SecurityConfig.class 6KB
repository
RoleRepository.class 523B
UserRepository.class 458B
pojo
User.class 1KB
Role.class 1KB
MysecurityApplication.class 747B
security
MyPermissionEvaluator.class 1KB
MyUserDetailService.class 4KB
controller
UrlCcontroller.class 2KB
UserController.class 3KB
static
data.txt 564B
error.txtx 52B
mvnw 6KB
.settings
org.eclipse.m2e.core.prefs 90B
org.eclipse.core.resources.prefs 155B
org.eclipse.jdt.core.prefs 243B
src
test
java
com
young
security
mysecurity
MysecurityApplicationTests.java 533B
main
resources
application.yml 253B
templates
admin
center.html 502B
admin1
index.html 511B
login.html 824B
index.html 1KB
hello.html 503B
static
data.txt 564B
error.txtx 52B
java
com
young
security
mysecurity
config
SecurityConfig.java 4KB
repository
RoleRepository.java 393B
UserRepository.java 363B
pojo
User.java 883B
Role.java 758B
MysecurityApplication.java 329B
security
MyUserDetailService.java 2KB
MyPermissionEvaluator.java 808B
controller
UserController.java 2KB
UrlCcontroller.java 1KB
.project 768B
.classpath 1KB
.gitignore 268B
.mvn
wrapper
maven-wrapper.jar 46KB
maven-wrapper.properties 110B
mvnw.cmd 5KB
共 49 条
- 1
资源评论
qq_16308429
- 粉丝: 7
- 资源: 10
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功