Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(auth): ignore all local resource #1775

Merged
merged 2 commits into from
Mar 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/auth/docs/getting-started.en-US.md
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export interface AlainAuthConfig {
*/
login_url?: string;
/**
* 忽略TOKEN的URL地址列表,默认值为:`[/\/login/, /assets\//, /passport\//]`
* 忽略TOKEN的URL地址列表,默认值为:`[/\/assets\//]`
*/
ignores?: RegExp[];
/**
Expand Down
Loading