mirror of
https://gitee.com/yudaocode/SpringBoot-Labs.git
synced 2026-09-03 05:53:54 +08:00
增加 SSO 示例(增加注释)
This commit is contained in:
@@ -4,4 +4,4 @@ INSERT INTO oauth_client_details
|
||||
refresh_token_validity, additional_information, autoapprove)
|
||||
VALUES
|
||||
('clientapp', '112233', 'read_userinfo,read_contacts',
|
||||
'password,refresh_token', null, null, 3600, 864000, null, true);
|
||||
'password,authorization_code,refresh_token', 'http://127.0.0.1:9090/login', null, 3600, 864000, null, true);
|
||||
|
||||
@@ -13,13 +13,13 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
public class DemoController {
|
||||
|
||||
@GetMapping("/admin-list")
|
||||
@PreAuthorize("hasRole('ADMIN')")
|
||||
@PreAuthorize("hasRole('ADMIN')") // 要求管理员 ROLE_ADMIN 角色
|
||||
public String adminList() {
|
||||
return "管理员列表";
|
||||
}
|
||||
|
||||
@GetMapping("/user-list")
|
||||
@PreAuthorize("hasRole('USER')")
|
||||
@PreAuthorize("hasRole('USER')") // 要求普通用户 ROLE_USER 角色
|
||||
public String userList() {
|
||||
return "用户列表";
|
||||
}
|
||||
|
||||
1
lab-68/《芋道 Spring Security OAuth2 单点登陆》.md
Normal file
1
lab-68/《芋道 Spring Security OAuth2 单点登陆》.md
Normal file
@@ -0,0 +1 @@
|
||||
<http://www.iocoder.cn/Spring-Security/OAuth2-learning-sso/?github>
|
||||
Reference in New Issue
Block a user