mirror of
https://github.com/cool-team-official/cool-admin-midway.git
synced 2026-03-27 15:50:47 +00:00
忽略字典校验
This commit is contained in:
parent
c2f08e8b7c
commit
9f49777b90
@ -32,13 +32,18 @@ export class BaseAuthorityMiddleware
|
|||||||
url = url.replace(this.prefix, '');
|
url = url.replace(this.prefix, '');
|
||||||
const token = ctx.get('Authorization');
|
const token = ctx.get('Authorization');
|
||||||
const adminUrl = '/admin/';
|
const adminUrl = '/admin/';
|
||||||
|
//忽略token验证的url
|
||||||
|
const ignoreUrls = ['/admin/dict/info/data'];
|
||||||
// 路由地址为 admin前缀的 需要权限校验
|
// 路由地址为 admin前缀的 需要权限校验
|
||||||
if (_.startsWith(url, adminUrl)) {
|
if (_.startsWith(url, adminUrl)) {
|
||||||
try {
|
try {
|
||||||
ctx.admin = jwt.verify(token, this.jwtConfig.jwt.secret);
|
ctx.admin = jwt.verify(token, this.jwtConfig.jwt.secret);
|
||||||
} catch (err) {}
|
} catch (err) {}
|
||||||
// 不需要登录 无需权限校验
|
// 不需要登录 无需权限校验
|
||||||
if (new RegExp(`^${adminUrl}?.*/open/`).test(url)) {
|
if (
|
||||||
|
new RegExp(`^${adminUrl}?.*/open/`).test(url) ||
|
||||||
|
ignoreUrls.includes(url)
|
||||||
|
) {
|
||||||
await next();
|
await next();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user