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

docs(auth): typo #1830

Merged
merged 1 commit into from
Aug 20, 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
3 changes: 2 additions & 1 deletion packages/auth/docs/getting-started.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ Configure the `provideAuth` environment in `app.config.ts`:
```typescript
providers: [
// Indicates using JWT style and using `localStorage` to store Token
provideAuth(withJWT(), withLocalStorage()),
provideHttpClient(withInterceptors([...(environment.interceptorFns ?? []), authJWTInterceptor, defaultInterceptor])),
provideAuth(withLocalStorage()),
]
```

Expand Down
3 changes: 2 additions & 1 deletion packages/auth/docs/getting-started.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ npm i -S @delon/auth
```typescript
providers: [
// 表示使用JWT风格并用 `localStorage` 存储 Token
provideAuth(withJWT(), withLocalStorage()),
provideHttpClient(withInterceptors([...(environment.interceptorFns ?? []), authJWTInterceptor, defaultInterceptor])),
provideAuth(withLocalStorage()),
]
```

Expand Down
12 changes: 6 additions & 6 deletions packages/auth/docs/send.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ type: Documents

It is better to add the corresponding authentication information to each request through the HTTP interceptor. `@delonn/auth` implements two separate HTTP interceptors based on two different authentication styles.

### withSimple
### authSimpleInterceptor

The parameter name and its sending location can be specified via `DelonAuthConfig`, for example:

Expand All @@ -22,25 +22,25 @@ token_send_place = 'header';

Indicates the `{ token: 'Bearer token_string' }` data in the `header` of each request.

### withJWT
### authJWTInterceptor

It is a standard JWT sending rule that automatically adds `{ Authorization: 'Bearer token_string' }` to `header`.

### How to choose?

`withSimple` is a very liberal style, you can put `token` in the request body, request header, etc.
`authSimpleInterceptor` is a very liberal style, you can put `token` in the request body, request header, etc.

`withJWT` is a JWT standard, which needs to ensure that the backend also uses such standards.
`authJWTInterceptor` is a JWT standard, which needs to ensure that the backend also uses such standards.

## How to load

In `app.config.ts` file:

```ts
providers: [
provideAuth(withSimple()),
provideHttpClient(withInterceptors([...(environment.interceptorFns ?? []), authSimpleInterceptor, defaultInterceptor])),
// Or JWT
provideAuth(withJWT()),
provideHttpClient(withInterceptors([...(environment.interceptorFns ?? []), authJWTInterceptor, defaultInterceptor])),
]
```

Expand Down
13 changes: 7 additions & 6 deletions packages/auth/docs/send.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ type: Documents

通过HTTP拦截器在每一个请求中加入相应的认证信息,这是再好不过。`@delonn/auth` 根据两种不同认证风格,实现两种各自的HTTP拦截器。

### withSimple
### authSimpleInterceptor

透过 `DelonAuthConfig` 可以指定参数名以及其发送位置,例如:

Expand All @@ -20,25 +20,26 @@ token_send_place = 'header';

表示在每一个请求的 `header` 加上 `{ token: 'Bearer token_string' }` 数据。

### withJWT
### authJWTInterceptor

它是一个标准JWT的发送规则,即在 `header` 自动加上 `{ Authorization: 'Bearer token_string' }`。

### 如何选择?

`withSimple` 是一种自由度非常高的风格,你可以将 `token` 放在请求体、请求头等当中。
`authSimpleInterceptor` 是一种自由度非常高的风格,你可以将 `token` 放在请求体、请求头等当中。

`withJWT` 是一个 JWT 标准,这需要确保后端也采用这类标准。
`authJWTInterceptor` 是一个 JWT 标准,这需要确保后端也采用这类标准。

## 如何加载

在 `app.config.ts` 加入:

```ts
providers: [
provideAuth(withSimple()),
// 表示使用JWT风格并用 `localStorage` 存储 Token
provideHttpClient(withInterceptors([...(environment.interceptorFns ?? []), authSimpleInterceptor, defaultInterceptor])),
// Or JWT
provideAuth(withJWT()),
provideHttpClient(withInterceptors([...(environment.interceptorFns ?? []), authJWTInterceptor, defaultInterceptor])),
]
```

Expand Down
3 changes: 2 additions & 1 deletion packages/auth/docs/set.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ The default is to use `withLocalStorage` persistent storage. You can change othe

```ts
providers: [
provideAuth(withJWT(), withLocalStorage()),
provideHttpClient(withInterceptors([...(environment.interceptorFns ?? []), authJWTInterceptor, defaultInterceptor])),
provideAuth(withLocalStorage()),
]
```

Expand Down
3 changes: 2 additions & 1 deletion packages/auth/docs/set.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ constructor(@Inject(DA_SERVICE_TOKEN) service: ITokenService) {

```ts
providers: [
provideAuth(withJWT(), withLocalStorage()),
provideHttpClient(withInterceptors([...(environment.interceptorFns ?? []), authJWTInterceptor, defaultInterceptor])),
provideAuth(withLocalStorage()),
]
```

Expand Down
3 changes: 2 additions & 1 deletion packages/auth/src/store/cookie-storage.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ import { IStore } from './interface';
* `cookie` storage
*
* ```ts
* provideAuth(withJWT(), withCookie())
provideHttpClient(withInterceptors([...(environment.interceptorFns ?? []), authJWTInterceptor, defaultInterceptor])),
provideAuth(withCookie()),
* ```
*/
export class CookieStorageStore implements IStore {
Expand Down
3 changes: 2 additions & 1 deletion packages/auth/src/store/local-storage.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ export function DA_STORE_TOKEN_LOCAL_FACTORY(): IStore {
* `localStorage` storage, **not lost after closing the browser**.
*
* ```ts
* provideAuth(withJWT(), withLocalStorage())
provideHttpClient(withInterceptors([...(environment.interceptorFns ?? []), authJWTInterceptor, defaultInterceptor])),
provideAuth(withLocalStorage()),
* ```
*/
export class LocalStorageStore implements IStore {
Expand Down
3 changes: 2 additions & 1 deletion packages/auth/src/store/session-storage.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import { IStore } from './interface';
* `sessionStorage` storage, **lost after closing the browser**.
*
* ```ts
* provideAuth(withJWT(), withSessionStorage())
provideHttpClient(withInterceptors([...(environment.interceptorFns ?? []), authJWTInterceptor, defaultInterceptor])),
provideAuth(withSessionStorage()),
* ```
*/
export class SessionStorageStore implements IStore {
Expand Down
Loading