Skip to content

Commit e6afb2c

Browse files
committed
docs(readme): update redame
1 parent f4df947 commit e6afb2c

File tree

2 files changed

+120
-114
lines changed

2 files changed

+120
-114
lines changed

README.ja.md

+60-57
Original file line numberDiff line numberDiff line change
@@ -108,12 +108,70 @@ const rp = await OidcClient.create(options);
108108
- [OIDCClientLogger](https://macropygia.github.io/elysia-openid-client/interfaces/types.OIDCClientLogger.html)
109109
- 本文書の `ロガー` の項を参照
110110
- `ClientMetadata`
111-
- `openid-client`[型定義](https://github.com/panva/node-openid-client/blob/main/types/index.d.ts)
111+
- `openid-client`[`ClientMetadata` の型定義](https://github.com/panva/node-openid-client/blob/main/types/index.d.ts)
112112
- および `OpenID Connect Dynamic Client Registration 1.0`[Client Metadata](https://openid.net/specs/openid-connect-registration-1_0.html#ClientMetadata) の章を参照
113113
- `AuthorizationParameters`
114-
- `openid-client`[型定義](https://github.com/panva/node-openid-client/blob/main/types/index.d.ts)
114+
- `openid-client`[`AuthorizationParameters` の型定義](https://github.com/panva/node-openid-client/blob/main/types/index.d.ts)
115115
- および `OpenID Connect Core 1.0`[Authentication Request](https://openid.net/specs/openid-connect-core-1_0.html#AuthRequest) の章を参照
116116

117+
## エンドポイント
118+
119+
- ElysiaJSプラグインとしてのメタデータ
120+
- 名称: `elysia-openid-client-endpoints`
121+
- [シード](https://elysiajs.com/essential/plugin#plugin-deduplication): `settings.pluginSeed` 、未指定なら `issuerUrl`
122+
- 参照: [openid-client API Documentation - Client](https://github.com/panva/node-openid-client/blob/main/docs/README.md#client)
123+
124+
### 内訳
125+
126+
- Login (GET: `/auth/login` )
127+
- `openid-client``client.authorizationUrl` を呼び出す
128+
- OPの認証エンドポイントにリダイレクトする
129+
- Callback (GET: `/auth/callback` )
130+
- `openid-client``client.callbackParams``client.callback` を呼び出す
131+
- OPからリダイレクトされた後、ログイン完了ページにリダイレクトする
132+
- Logout (GET: `/auth/logout` )
133+
- `openid-client``client.endSessionUrl` を呼び出す
134+
- OPのログアウトエンドポイントにリダイレクトする
135+
- UserInfo (ALL: `/auth/userinfo` )
136+
- `openid-client``client.userinfo` を呼び出す
137+
- レスポンス(ユーザー情報)をそのまま返す
138+
- Introspect (ALL: `/auth/introspect` )
139+
- `openid-client``client.introspect` を呼び出す
140+
- レスポンスをそのまま返す
141+
- Refresh (ALL: `/auth/refresh` )
142+
- `openid-client``client.refresh` を呼び出す
143+
- ID Tokenに含まれるクレームを返す
144+
- Resource (GET: `/auth/resource?url=<resource-url>`)
145+
- `openid-client``client.requestResource` を呼び出す
146+
- リソースプロバイダーからのレスポンスを返す
147+
- Revoke (ALL: `/auth/revoke` )
148+
- `openid-client``client.revoke` を呼び出す
149+
- `204` を返す
150+
- Status (ALL: `/auth/status` )
151+
- 内部データベースからセッションステータスを取得する
152+
- OPにはアクセスしない
153+
- Claims (ALL: `/auth/claims` )
154+
- ID Tokenに含まれるクレームを取得する
155+
- OPにはアクセスしない
156+
157+
## フック
158+
159+
`onBeforeHandle` フックでCookieを元にセッションが有効かどうかを判断し、 [`resolve` フック](https://elysiajs.com/life-cycle/before-handle.html#resolve)から `sessionStatus``sessionClaims` を返す。
160+
161+
- セッションが有効な場合
162+
- `sessionStatus` : セッションステータス
163+
- 参照: [OIDCClientSessionStatus](https://macropygia.github.io/elysia-openid-client/interfaces/types.OIDCClientSessionStatus.html)
164+
- `sessionClaims` : ID Token Claims
165+
- 参照: [`IdTokenClaims` type definition](https://github.com/panva/node-openid-client/blob/main/types/index.d.ts) of `openid-client`.
166+
- 参照: `OpenID Connect Core 1.0`[Claims](https://openid.net/specs/openid-connect-core-1_0.html#Claims) 及び [IDToken](https://openid.net/specs/openid-connect-core-1_0.html#IDToken) の章
167+
- セッションが無効な場合
168+
- `loginRedirectUrl` にリダイレクト
169+
- `disableRedirect``true` の場合は `sessionStatus` , `sessionClaims` 共に `null` になる
170+
- ElysiaJSプラグインとしてのメタデータ
171+
- 名称: `elysia-openid-client-auth-hook`
172+
- [シード](https://elysiajs.com/essential/plugin#plugin-deduplication): `settings.pluginSeed` 、未指定なら `issuerUrl`
173+
- 参照: [AuthHookOptions](https://macropygia.github.io/elysia-openid-client/interfaces/types.AuthHookOptions.html)
174+
117175
## データアダプター
118176

119177
セッション情報の保存方法を定義したもの。
@@ -294,61 +352,6 @@ const rp = await OidcClient.create({
294352

295353
[OIDCClientLogger](https://macropygia.github.io/elysia-openid-client/interfaces/types.OIDCClientLogger.html)の型定義と `consoleLogger` の実装を参照のこと。
296354

297-
## エンドポイント
298-
299-
- ElysiaJSプラグインとしてのメタデータ
300-
- 名称: `elysia-openid-client-endpoints`
301-
- [シード](https://elysiajs.com/essential/plugin#plugin-deduplication): `settings.pluginSeed` 、未指定なら `issuerUrl`
302-
- 参照: [openid-client API Documentation - Client](https://github.com/panva/node-openid-client/blob/main/docs/README.md#client)
303-
304-
### 内訳
305-
306-
- Login (GET: `/auth/login` )
307-
- `openid-client``client.authorizationUrl` を呼び出す
308-
- OPの認証エンドポイントにリダイレクトする
309-
- Callback (GET: `/auth/callback` )
310-
- `openid-client``client.callbackParams``client.callback` を呼び出す
311-
- OPからリダイレクトされた後、ログイン完了ページにリダイレクトする
312-
- Logout (GET: `/auth/logout` )
313-
- `openid-client``client.endSessionUrl` を呼び出す
314-
- OPのログアウトエンドポイントにリダイレクトする
315-
- UserInfo (ALL: `/auth/userinfo` )
316-
- `openid-client``client.userinfo` を呼び出す
317-
- レスポンス(ユーザー情報)をそのまま返す
318-
- Introspect (ALL: `/auth/introspect` )
319-
- `openid-client``client.introspect` を呼び出す
320-
- レスポンスをそのまま返す
321-
- Refresh (ALL: `/auth/refresh` )
322-
- `openid-client``client.refresh` を呼び出す
323-
- ID Tokenに含まれるクレームを返す
324-
- Resouce (GET: `/auth/resource?url=<resource-url>`)
325-
- `openid-client``client.requestResource` を呼び出す
326-
- リソースプロバイダーからのレスポンスを返す
327-
- Revoke (ALL: `/auth/revoke` )
328-
- `openid-client``client.revoke` を呼び出す
329-
- `204` を返す
330-
- Status (ALL: `/auth/status` )
331-
- 内部データベースからセッションステータスを取得する
332-
- OPにはアクセスしない
333-
- Claims (ALL: `/auth/claims` )
334-
- ID Tokenに含まれるクレームを取得する
335-
- OPにはアクセスしない
336-
337-
## フック
338-
339-
`onBeforeHandle` フックでCookieを元にセッションが有効かどうかを判断し、 [`resolve` フック](https://elysiajs.com/life-cycle/before-handle.html#resolve)から `sessionStatus``sessionClaims` を返す。
340-
341-
- セッションが有効な場合
342-
- `sessionStatus` : セッションステータス
343-
- `sessionClaims` : ID Token Claims
344-
- セッションが無効な場合
345-
- `loginRedirectUrl` にリダイレクト
346-
- `disableRedirect``false` の場合は `sessionStatus` , `sessionClaims` 共に `null`
347-
- ElysiaJSプラグインとしてのメタデータ
348-
- 名称: `elysia-openid-client-auth-hook`
349-
- [シード](https://elysiajs.com/essential/plugin#plugin-deduplication): `settings.pluginSeed` 、未指定なら `issuerUrl`
350-
- 参照: [AuthHookOptions](https://macropygia.github.io/elysia-openid-client/interfaces/types.AuthHookOptions.html)
351-
352355
## Contributing
353356

354357
本リポジトリに提供するコードを `GitHub Copilot` で生成する場合、必ず `Suggestions matching public code` オプションを `Block` に設定すること。同様のオプションが存在する類似のサービスを使用する場合も同様。

README.md

+60-57
Original file line numberDiff line numberDiff line change
@@ -108,12 +108,70 @@ const rp = await OidcClient.create(options);
108108
- [OIDCClientLogger](https://macropygia.github.io/elysia-openid-client/interfaces/types.OIDCClientLogger.html)
109109
- See `Logger` section in this document.
110110
- `ClientMetadata`
111-
- See [type definition](https://github.com/panva/node-openid-client/blob/main/types/index.d.ts) of `openid-client`.
111+
- See [`ClientMetadata` type definition](https://github.com/panva/node-openid-client/blob/main/types/index.d.ts) of `openid-client`.
112112
- See [Client Metadata](https://openid.net/specs/openid-connect-registration-1_0.html#ClientMetadata) section in the `OpenID Connect Dynamic Client Registration 1.0`.
113113
- `AuthorizationParameters`
114-
- See [type definition](https://github.com/panva/node-openid-client/blob/main/types/index.d.ts) of `openid-client`.
114+
- See [`AuthorizationParameters` type definition](https://github.com/panva/node-openid-client/blob/main/types/index.d.ts) of `openid-client`.
115115
- See [Authentication Request](https://openid.net/specs/openid-connect-core-1_0.html#AuthRequest) section in the `OpenID Connect Core 1.0`.
116116

117+
## Endpoints
118+
119+
- ElysiaJS plugin metadata
120+
- name: `elysia-openid-client-endpoints`
121+
- [seed](https://elysiajs.com/essential/plugin#plugin-deduplication): `settings.pluginSeed` or else `issuerUrl`
122+
- Ref: [openid-client API Documentation - Client](https://github.com/panva/node-openid-client/blob/main/docs/README.md#client)
123+
124+
### Details
125+
126+
- Login (GET: `/auth/login` )
127+
- Calls `client.authorizationUrl` of openid-client.
128+
- Redirect to authorization endpoint of the OP.
129+
- Callback (GET: `/auth/callback` )
130+
- Calls `client.callbackParams` and `client.callback` of openid-client.
131+
- Redirect from the OP and redirect to the login completed page.
132+
- Logout (GET: `/auth/logout` )
133+
- Calls `client.endSessionUrl` of openid-client.
134+
- Redirect to logout (end session) endpoint of the OP.
135+
- UserInfo (ALL: `/auth/userinfo` )
136+
- Calls `client.userinfo` of openid-client.
137+
- Returns response (UserInfo) directly.
138+
- Introspect (ALL: `/auth/introspect` )
139+
- Calls `client.introspect` of openid-client.
140+
- Returns response directly.
141+
- Refresh (ALL: `/auth/refresh` )
142+
- Calls `client.refresh` of openid-client.
143+
- Returns ID Token Claims.
144+
- Resource (GET: `/auth/resource?url=<resource-url>`)
145+
- Calls `client.requestResource` of openid-client.
146+
- Through the response from the resource provider.
147+
- Revoke (ALL: `/auth/revoke` )
148+
- Calls `client.revoke` of openid-client.
149+
- Return `204`
150+
- Status (ALL: `/auth/status` )
151+
- Fetches session status from internal database.
152+
- Does not call any endpoint of the OP.
153+
- Claims (ALL: `/auth/claims` )
154+
- Fetches ID Token Claims from internal database.
155+
- Does not call any endpoint of the OP.
156+
157+
## Hook
158+
159+
Determine the validity of the session in `onBeforeHandle`, and return `sessionStatus` and `sessionClaims` from the [`resolve` hook](https://elysiajs.com/life-cycle/before-handle.html#resolve).
160+
161+
- If the session is valid:
162+
- `sessionStatus`: Session status
163+
- Ref: [OIDCClientSessionStatus](https://macropygia.github.io/elysia-openid-client/interfaces/types.OIDCClientSessionStatus.html)
164+
- `sessionClaims`: ID Token Claims
165+
- Ref: [`IdTokenClaims` type definition](https://github.com/panva/node-openid-client/blob/main/types/index.d.ts) of `openid-client`.
166+
- Ref: [Claims](https://openid.net/specs/openid-connect-core-1_0.html#IDToken) and [IDToken](https://openid.net/specs/openid-connect-core-1_0.html#IDToken) section in the `OpenID Connect Core 1.0`.
167+
- If the session is invalid:
168+
- Redirect to `loginRedirectUrl`.
169+
- If `disableRedirect` is `true`, both `sessionStatus` and `sessionClaims` will be `null`.
170+
- ElysiaJS plugin metadata
171+
- name: `elysia-openid-client-auth-hook`
172+
- [seed](https://elysiajs.com/essential/plugin#plugin-deduplication): `settings.pluginSeed` or else `issuerUrl`
173+
- Ref: [AuthHookOptions](https://macropygia.github.io/elysia-openid-client/interfaces/types.AuthHookOptions.html)
174+
117175
## Data Adapter
118176

119177
Defines how session data is stored.
@@ -293,61 +351,6 @@ const rp = await OidcClient.create({
293351

294352
See [OIDCClientLogger](https://macropygia.github.io/elysia-openid-client/interfaces/types.OIDCClientLogger.html) and `consoleLogger` implementation.
295353

296-
## Endpoints
297-
298-
- ElysiaJS plugin metadata
299-
- name: `elysia-openid-client-endpoints`
300-
- [seed](https://elysiajs.com/essential/plugin#plugin-deduplication): `settings.pluginSeed` or else `issuerUrl`
301-
- Ref: [openid-client API Documentation - Client](https://github.com/panva/node-openid-client/blob/main/docs/README.md#client)
302-
303-
### Details
304-
305-
- Login (GET: `/auth/login` )
306-
- Calls `client.authorizationUrl` of openid-client.
307-
- Redirect to authorization endpoint of the OP.
308-
- Callback (GET: `/auth/callback` )
309-
- Calls `client.callbackParams` and `client.callback` of openid-client.
310-
- Redirect from the OP and redirect to the login completed page.
311-
- Logout (GET: `/auth/logout` )
312-
- Calls `client.endSessionUrl` of openid-client.
313-
- Redirect to logout (end session) endpoint of the OP.
314-
- UserInfo (ALL: `/auth/userinfo` )
315-
- Calls `client.userinfo` of openid-client.
316-
- Returns response (UserInfo) directly.
317-
- Introspect (ALL: `/auth/introspect` )
318-
- Calls `client.introspect` of openid-client.
319-
- Returns response directly.
320-
- Refresh (ALL: `/auth/refresh` )
321-
- Calls `client.refresh` of openid-client.
322-
- Returns ID Token Claims.
323-
- Resouce (GET: `/auth/resource?url=<resource-url>`)
324-
- Calls `client.requestResource` of openid-client.
325-
- Through the response from the resource provider.
326-
- Revoke (ALL: `/auth/revoke` )
327-
- Calls `client.revoke` of openid-client.
328-
- Return `204`
329-
- Status (ALL: `/auth/status` )
330-
- Fetches session status from internal database.
331-
- Does not call any endpoint of the OP.
332-
- Claims (ALL: `/auth/claims` )
333-
- Fetches ID Token Claims from internal database.
334-
- Does not call any endpoint of the OP.
335-
336-
## Hook
337-
338-
Determine the validity of the session in `onBeforeHandle`, and return `sessionStatus` and `sessionClaims` from the [`resolve` hook](https://elysiajs.com/life-cycle/before-handle.html#resolve).
339-
340-
- If the session is valid:
341-
- `sessionStatus`: Session status
342-
- `sessionClaims`: ID Token Claims
343-
- If the session is invalid:
344-
- Redirect to `loginRedirectUrl`.
345-
- If `disableRedirect` is `false`, both `sessionStatus` and `sessionClaims` will be `null`.
346-
- ElysiaJS plugin metadata
347-
- name: `elysia-openid-client-auth-hook`
348-
- [seed](https://elysiajs.com/essential/plugin#plugin-deduplication): `settings.pluginSeed` or else `issuerUrl`
349-
- Ref: [AuthHookOptions](https://macropygia.github.io/elysia-openid-client/interfaces/types.AuthHookOptions.html)
350-
351354
## Contributing
352355

353356
If you are using GitHub Copilot to generate suggested code, you must set the `Suggestions matching public code` option to `Block`. If you are using a similar service with a similar option, you must do the same.

0 commit comments

Comments
 (0)