|
@@ -20,6 +20,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.data.redis.core.RedisTemplate;
|
|
import org.springframework.data.redis.core.RedisTemplate;
|
|
import org.springframework.http.HttpStatus;
|
|
import org.springframework.http.HttpStatus;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
+import springfox.documentation.annotations.ApiIgnore;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import java.util.HashMap;
|
|
import java.util.HashMap;
|
|
@@ -69,6 +70,7 @@ public class UserController {
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
@GetMapping("/logout")
|
|
@GetMapping("/logout")
|
|
public R logout(HttpServletRequest request) {
|
|
public R logout(HttpServletRequest request) {
|
|
log.info("run logout");
|
|
log.info("run logout");
|
|
@@ -91,6 +93,7 @@ public class UserController {
|
|
*
|
|
*
|
|
* 用postman 模拟请求头,Authorization
|
|
* 用postman 模拟请求头,Authorization
|
|
*/
|
|
*/
|
|
|
|
+ @ApiIgnore
|
|
@GetMapping("free")
|
|
@GetMapping("free")
|
|
private R free(){
|
|
private R free(){
|
|
log.info("run free");
|
|
log.info("run free");
|
|
@@ -106,6 +109,7 @@ public class UserController {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @ApiIgnore
|
|
@GetMapping("free1")
|
|
@GetMapping("free1")
|
|
private R free1(HttpServletRequest req){
|
|
private R free1(HttpServletRequest req){
|
|
log.info("run free");
|
|
log.info("run free");
|
|
@@ -125,6 +129,7 @@ public class UserController {
|
|
/**
|
|
/**
|
|
* 只用登录用户才能访问
|
|
* 只用登录用户才能访问
|
|
*/
|
|
*/
|
|
|
|
+ @ApiIgnore
|
|
@GetMapping("/auth/a")
|
|
@GetMapping("/auth/a")
|
|
@RequiresAuthentication
|
|
@RequiresAuthentication
|
|
public R requireAuth() {
|
|
public R requireAuth() {
|
|
@@ -134,6 +139,7 @@ public class UserController {
|
|
return new R(200, "已经登录, 登录模式………………");
|
|
return new R(200, "已经登录, 登录模式………………");
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @ApiIgnore
|
|
@GetMapping("/auth/k")
|
|
@GetMapping("/auth/k")
|
|
@RequiresAuthentication
|
|
@RequiresAuthentication
|
|
public R list() {
|
|
public R list() {
|
|
@@ -147,6 +153,7 @@ public class UserController {
|
|
* 需要登录
|
|
* 需要登录
|
|
* 只有admin角色可以看
|
|
* 只有admin角色可以看
|
|
*/
|
|
*/
|
|
|
|
+ @ApiIgnore
|
|
@GetMapping("/auth/role")
|
|
@GetMapping("/auth/role")
|
|
@RequiresRoles("admin")
|
|
@RequiresRoles("admin")
|
|
public R requireRole() {
|
|
public R requireRole() {
|
|
@@ -158,6 +165,7 @@ public class UserController {
|
|
* 需要登录
|
|
* 需要登录
|
|
* 需要有view和edit 权限才可以看
|
|
* 需要有view和edit 权限才可以看
|
|
*/
|
|
*/
|
|
|
|
+ @ApiIgnore
|
|
@GetMapping("/auth/edit")
|
|
@GetMapping("/auth/edit")
|
|
@RequiresPermissions(logical = Logical.AND, value = {"view", "edit"})
|
|
@RequiresPermissions(logical = Logical.AND, value = {"view", "edit"})
|
|
public R requirePermission() {
|
|
public R requirePermission() {
|
|
@@ -168,13 +176,14 @@ public class UserController {
|
|
* 需要登录
|
|
* 需要登录
|
|
* 只要有view 权限都可以看
|
|
* 只要有view 权限都可以看
|
|
*/
|
|
*/
|
|
|
|
+ @ApiIgnore
|
|
@GetMapping("/auth/view")
|
|
@GetMapping("/auth/view")
|
|
@RequiresPermissions(logical = Logical.AND, value = {"view"})
|
|
@RequiresPermissions(logical = Logical.AND, value = {"view"})
|
|
public R requirePermissionView() {
|
|
public R requirePermissionView() {
|
|
return new R(200, "你拥有view的权限");
|
|
return new R(200, "你拥有view的权限");
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
|
|
+ @ApiIgnore
|
|
@RequestMapping(path = "/401")
|
|
@RequestMapping(path = "/401")
|
|
@ResponseStatus(HttpStatus.UNAUTHORIZED)
|
|
@ResponseStatus(HttpStatus.UNAUTHORIZED)
|
|
public R unauthorized() {
|
|
public R unauthorized() {
|