controller接口上带@PreAuthorize的注解如何访问 (postman请求示例)

发布于:2023-09-09 ⋅ 阅读:(81) ⋅ 点赞:(0)

1. 访问接口

    /**
     * 查询时段列表
     */
    @RateLimiter(time = 10,count = 10)
    @ApiOperation("查询时段列表")
    @PreAuthorize("@ss.hasPermi('ls/sy:time:list')")
    @GetMapping("/list")
    public TableDataInfo list(LsTime lsTime)
    {
        startPage();
        List<LsTime> list = lsTimeService.selectLsTimeList(lsTime);
        return getDataTable(list);
    }

2. 非法请求, 直接拦截

 

 

3. 生成验证码

4. 登录, 获取token

5. token令牌, 带上访问接口
Authorization: xxx.xxx.xxx