mirror of
https://gitee.com/dromara/sa-token.git
synced 2025-09-20 02:29:27 +08:00
v1.11.0 新特性:AOP注解鉴权
This commit is contained in:
@@ -3,6 +3,7 @@ package com.pj.test;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
@@ -218,7 +219,19 @@ public class TestController {
|
||||
}
|
||||
|
||||
|
||||
// 测试 浏览器访问: http://localhost:8081/test/test
|
||||
@Autowired
|
||||
TestService TestService;
|
||||
|
||||
// 测试AOP注解鉴权: http://localhost:8081/test/testAOP
|
||||
@RequestMapping("testAOP")
|
||||
public AjaxJson testAOP() {
|
||||
System.out.println("testAOP");
|
||||
TestService.getList();
|
||||
return AjaxJson.getSuccess();
|
||||
}
|
||||
|
||||
|
||||
// 测试 浏览器访问: http://localhost:8081/test/test
|
||||
@RequestMapping("test")
|
||||
public AjaxJson test() {
|
||||
StpUtil.getTokenSession().logout();
|
||||
|
@@ -0,0 +1,26 @@
|
||||
package com.pj.test;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckLogin;
|
||||
|
||||
/**
|
||||
* 用来测试AOP注解鉴权
|
||||
* @author kong
|
||||
*
|
||||
*/
|
||||
@Service
|
||||
//@SaCheckLogin
|
||||
public class TestService {
|
||||
|
||||
@SaCheckLogin
|
||||
public List<String> getList() {
|
||||
System.out.println("getList");
|
||||
return new ArrayList<String>();
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user