Browse Source

1、shiro权限配置

2、swagger权限配置
master
Aug 1 month ago
parent
commit
d32b8b5c9b
4 changed files with 74 additions and 0 deletions
  1. +3
    -0
      jeecg-boot/jeecg-boot-base-core/src/main/java/org/jeecg/config/shiro/ShiroConfig.java
  2. +42
    -0
      jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/app/controller/AppController.java
  3. +24
    -0
      jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/app/controller/AppController2.java
  4. +5
    -0
      jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/application-dev.yml

+ 3
- 0
jeecg-boot/jeecg-boot-base-core/src/main/java/org/jeecg/config/shiro/ShiroConfig.java View File

@ -82,6 +82,9 @@ public class ShiroConfig {
}
}
//小程序相关接口不会被拦截
filterChainDefinitionMap.put("/app/**", "anon"); //小程序相关接口
// 配置不会被拦截的链接 顺序判断
filterChainDefinitionMap.put("/sys/cas/client/validateLogin", "anon"); //cas验证登录
filterChainDefinitionMap.put("/sys/randomImage/**", "anon"); //登录验证码接口排除


+ 42
- 0
jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/app/controller/AppController.java View File

@ -0,0 +1,42 @@
package org.jeecg.modules.app.controller;
import com.alibaba.fastjson.JSONObject;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.system.model.SysLoginModel;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
@RestController
@RequestMapping("/app/A")
@Tag(name="测试模块A")
@Slf4j
public class AppController {
@Operation(summary = "测试接口一")
@RequestMapping(value = "/testOne", method = RequestMethod.POST)
public Result<JSONObject> testOne(String testA){
Result<JSONObject> result = new Result<JSONObject>();
log.info("输出内容:{}", testA);
result.error500("测试失败!");
return result;
}
@Operation(summary = "测试接口二")
@RequestMapping(value = "/testTwo", method = RequestMethod.POST)
public Result<JSONObject> testTwo(String testB){
Result<JSONObject> result = new Result<JSONObject>();
log.info("输出内容:{}", testB);
result.success("测试成功");
return result;
}
}

+ 24
- 0
jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/app/controller/AppController2.java View File

@ -0,0 +1,24 @@
package org.jeecg.modules.app.controller;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/app/B")
@Tag(name="测试模块B")
@Slf4j
public class AppController2 {
@Operation(summary = "测试接口一", description = "测试一相关接口")
@RequestMapping(value = "/queryBannerList", method = {RequestMethod.GET})
public Result<?> queryBannerList(String type){
log.info("输出内容:{}", type);
return Result.OK("测试成功");
}
}

+ 5
- 0
jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/application-dev.yml View File

@ -324,3 +324,8 @@ justauth:
type: default
prefix: 'demo::'
timeout: 1h
#swagger文档接口展示
springdoc:
packages-to-scan: org.jeecg.modules.app.controller # 只扫描你的自定义包
# paths-to-match: /app/** # 只匹配特定路径

Loading…
Cancel
Save