Skip to content

采用spring-security实现的权限控制

License

Notifications You must be signed in to change notification settings

LuomingXu/OAuth

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OAuth

Build Status Build status image image

利用spring-security实现的权限控制

使用说明

controller
//在需要进行权限的控制的地方加@PreAuthorize注解
//具体如何使用此注解请自行查阅资料

//并且Mapping最后的结尾为"/kkn"
//则会进行是否授权的校验
@RestController
public class controller
{
    @PreAuthorize("hasRole('user')")
    @GetMapping("/test/kkn")
    public Object test()
    {
        return "test/kkn";
    }

    @GetMapping("/test")
    public Object test1()
    {
        return "test";
    }
}
resources
在maven项目的resources目下要有jwt.jks文件
resources
|---application.yml
└---jwt.jks
application.yml
配置文件如下填写

luomingxu:
  oauth:
    aes-conf:
      aes-pwd: 123456 #不可为null
    jwt-token-expiration: 7 #单位为天; 默认为7天, 可不填
    jwt-pwd: 123456 #不可为null

依赖

maven dependency
<dependency>
    <groupId>com.github.luomingxuorg</groupId>
    <artifactId>oauth-boot-starter</artifactId>
     <version>$version</version>
</dependency>
gradle
compile 'com.github.luomingxuorg:oauth-boot-starter:$version'

About

采用spring-security实现的权限控制

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages