Skip to content

Commit

Permalink
feat(auth): ignore all local resource (#1775)
Browse files Browse the repository at this point in the history
  • Loading branch information
cipchk committed Mar 11, 2024
1 parent af1f0e4 commit cd8641e
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/auth/docs/getting-started.en-US.md
Expand Up @@ -64,7 +64,7 @@ providers: [
| `[token_send_template]` | `string` | `${token}` | Send a token template with a `${property name}` placeholder ||
| `[token_send_place]` | `header,body,url` | `header` | Send token parameter position ||
| `[login_url]` | `string` | `/login` | Login page routing address ||
| `[ignores]` | `RegExp[]` | `[ /\/login/, /assets\// ]` | Ignore the list of URL addresses. In addition, you can also control whether to ignore through [ALLOW_ANONYMOUS](/auth/qa/en). ||
| `[ignores]` | `RegExp[]` | `[/\/assets\//]` | Ignore the list of URL addresses. In addition, you can also control whether to ignore through [ALLOW_ANONYMOUS](/auth/qa/en). ||
| `[refreshTime]` | `number` | `3000` | Refresh time (unit: ms) ||
| `[refreshOffset]` | `number` | `6000` | Offset value (unit: ms), it is recommended to set according to the multiple of `refreshTime` ||

Expand Down
2 changes: 1 addition & 1 deletion packages/auth/docs/getting-started.zh-CN.md
Expand Up @@ -64,7 +64,7 @@ providers: [
| `[token_send_template]` | `string` | `${token}` | 发送token模板,以 `${属性名}` 表示占位符,属性名要确保存在否则以空字符代替 ||
| `[token_send_place]` | `header,body,url` | `header` | 发送token参数位置 ||
| `[login_url]` | `string` | `/login` | 登录页路由地址 ||
| `[ignores]` | `RegExp[]` | `[ /\/login/, /assets\// ]` | 忽略 URL 地址清单,除此之外还可以通过 [ALLOW_ANONYMOUS](/auth/qa/zh) 进行控制是否忽略。 ||
| `[ignores]` | `RegExp[]` | `[/\/assets\//]` | 忽略 URL 地址清单,除此之外还可以通过 [ALLOW_ANONYMOUS](/auth/qa/zh) 进行控制是否忽略。 ||
| `[refreshTime]` | `number` | `3000` | 刷新时长(单位:ms) ||
| `[refreshOffset]` | `number` | `6000` | 偏移值(单位:ms),建议根据 `refreshTime` 倍数来设置 ||

Expand Down
3 changes: 2 additions & 1 deletion packages/auth/src/auth.config.ts
Expand Up @@ -9,7 +9,8 @@ export const AUTH_DEFAULT_CONFIG: AlainAuthConfig = {
token_send_place: 'header',
login_url: '/login',
refreshTime: 3000,
refreshOffset: 6000
refreshOffset: 6000,
ignores: [/\/assets\//]
};

export function mergeConfig(srv: AlainConfigService): AlainAuthConfig {
Expand Down
2 changes: 1 addition & 1 deletion packages/util/config/auth/auth.type.ts
Expand Up @@ -32,7 +32,7 @@ export interface AlainAuthConfig {
*/
login_url?: string;
/**
* 忽略TOKEN的URL地址列表,默认值为:`[/\/login/, /assets\//, /passport\//]`
* 忽略TOKEN的URL地址列表,默认值为:`[/\/assets\//]`
*/
ignores?: RegExp[];
/**
Expand Down

0 comments on commit cd8641e

Please sign in to comment.