增加 @PreAuthenticated 注解,实现登陆的拦截
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
package cn.iocoder.yudao.userserver.modules.infra.controller;
|
||||
|
||||
import cn.iocoder.yudao.framework.security.core.annotations.PreAuthenticated;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.security.access.annotation.Secured;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@@ -15,4 +18,11 @@ public class HelloController {
|
||||
public String hello(String hello) {
|
||||
return "echo + " + hello;
|
||||
}
|
||||
|
||||
@RequestMapping("/user/info")
|
||||
@PreAuthenticated
|
||||
public String xx() {
|
||||
return "none";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user