@maronn-openid-connect/cli 0.7.1 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/README.md +83 -7
  2. package/dist/frameworks/hono/index.d.ts.map +1 -1
  3. package/dist/frameworks/hono/index.js +18 -9
  4. package/dist/frameworks/hono/index.js.map +1 -1
  5. package/dist/frameworks/hono/pages.d.ts +7 -6
  6. package/dist/frameworks/hono/pages.d.ts.map +1 -1
  7. package/dist/frameworks/hono/pages.js +62 -44
  8. package/dist/frameworks/hono/pages.js.map +1 -1
  9. package/dist/frameworks/hono/templates.d.ts +19 -6
  10. package/dist/frameworks/hono/templates.d.ts.map +1 -1
  11. package/dist/frameworks/hono/templates.js +284 -304
  12. package/dist/frameworks/hono/templates.js.map +1 -1
  13. package/dist/frameworks/hono/views.d.ts +3 -0
  14. package/dist/frameworks/hono/views.d.ts.map +1 -0
  15. package/dist/frameworks/hono/views.js +458 -0
  16. package/dist/frameworks/hono/views.js.map +1 -0
  17. package/dist/frameworks/nextjs/authorize.d.ts +3 -0
  18. package/dist/frameworks/nextjs/authorize.d.ts.map +1 -0
  19. package/dist/frameworks/nextjs/authorize.js +757 -0
  20. package/dist/frameworks/nextjs/authorize.js.map +1 -0
  21. package/dist/frameworks/nextjs/ciba.d.ts +8 -0
  22. package/dist/frameworks/nextjs/ciba.d.ts.map +1 -0
  23. package/dist/frameworks/nextjs/ciba.js +591 -0
  24. package/dist/frameworks/nextjs/ciba.js.map +1 -0
  25. package/dist/frameworks/nextjs/conformance.d.ts +3 -0
  26. package/dist/frameworks/nextjs/conformance.d.ts.map +1 -0
  27. package/dist/frameworks/nextjs/conformance.js +2447 -0
  28. package/dist/frameworks/nextjs/conformance.js.map +1 -0
  29. package/dist/frameworks/nextjs/device.d.ts +8 -0
  30. package/dist/frameworks/nextjs/device.d.ts.map +1 -0
  31. package/dist/frameworks/nextjs/device.js +662 -0
  32. package/dist/frameworks/nextjs/device.js.map +1 -0
  33. package/dist/frameworks/nextjs/endpoints.d.ts +7 -0
  34. package/dist/frameworks/nextjs/endpoints.d.ts.map +1 -0
  35. package/dist/frameworks/nextjs/endpoints.js +673 -0
  36. package/dist/frameworks/nextjs/endpoints.js.map +1 -0
  37. package/dist/frameworks/nextjs/index.d.ts.map +1 -1
  38. package/dist/frameworks/nextjs/index.js +135 -2
  39. package/dist/frameworks/nextjs/index.js.map +1 -1
  40. package/dist/frameworks/nextjs/interaction.d.ts +13 -0
  41. package/dist/frameworks/nextjs/interaction.d.ts.map +1 -0
  42. package/dist/frameworks/nextjs/interaction.js +864 -0
  43. package/dist/frameworks/nextjs/interaction.js.map +1 -0
  44. package/dist/frameworks/nextjs/logout.d.ts +5 -0
  45. package/dist/frameworks/nextjs/logout.d.ts.map +1 -0
  46. package/dist/frameworks/nextjs/logout.js +271 -0
  47. package/dist/frameworks/nextjs/logout.js.map +1 -0
  48. package/dist/frameworks/nextjs/metadata.d.ts +6 -0
  49. package/dist/frameworks/nextjs/metadata.d.ts.map +1 -0
  50. package/dist/frameworks/nextjs/metadata.js +339 -0
  51. package/dist/frameworks/nextjs/metadata.js.map +1 -0
  52. package/dist/frameworks/nextjs/provider.d.ts +6 -0
  53. package/dist/frameworks/nextjs/provider.d.ts.map +1 -0
  54. package/dist/frameworks/nextjs/provider.js +797 -0
  55. package/dist/frameworks/nextjs/provider.js.map +1 -0
  56. package/dist/frameworks/nextjs/token.d.ts +7 -0
  57. package/dist/frameworks/nextjs/token.d.ts.map +1 -0
  58. package/dist/frameworks/nextjs/token.js +1337 -0
  59. package/dist/frameworks/nextjs/token.js.map +1 -0
  60. package/dist/frameworks/web-standard/templates.d.ts +1 -13
  61. package/dist/frameworks/web-standard/templates.d.ts.map +1 -1
  62. package/dist/frameworks/web-standard/templates.js +12 -1296
  63. package/dist/frameworks/web-standard/templates.js.map +1 -1
  64. package/dist/index.d.ts.map +1 -1
  65. package/dist/index.js +38 -8
  66. package/dist/index.js.map +1 -1
  67. package/package.json +1 -1
package/README.md CHANGED
@@ -69,13 +69,32 @@ oidc-provider/
69
69
  ├── config.ts # ProviderConfig・クライアント登録(既定値はローカル検証専用)
70
70
  ├── store.ts # インメモリストア(認可コード・トークン・セッション等)
71
71
  ├── resolvers.ts # セッション・同意状態の resolver
72
- ├── views.ts # ログイン / 同意 / エラー画面のデフォルト HTML
72
+ ├── views.ts # ログイン / 同意 / エラー画面のデフォルト HTML(Hono は views.tsx の JSX コンポーネント)
73
73
  ├── pages/ # 画面用ルーティング(ブラウザ向けの GET/POST。描画・リダイレクト・Cookie 付与はすべてここ。UI カスタマイズはここ)
74
74
  ├── routes/ # API ルーティング(ロジック本体。ブラウザ向けステップは Response を返さず結果(outcome)を返す関数)
75
75
  ├── conformance.test.ts # 生成 OP の想定挙動を固定する契約テスト
76
76
  └── .maronn-openid-connect.json # 生成元の CLI バージョンと機能構成の記録
77
77
  ```
78
78
 
79
+ Next.js は App Router のファイル規約に沿った別の構成になる([Next.js の生成物](#nextjs-の生成物)を参照)。
80
+
81
+ Hono の出力は TSX 前提で生成される。画面のマークアップ(`views.tsx`)は [hono/jsx](https://hono.dev/docs/guides/jsx) のコンポーネントで、画面を描く `pages/`(`errors` / `login` / `consent`、機能有効時は `device` / `ciba` / `logout`)も `.tsx` になり、`renderView(<views.loginPage {...params} />)` のように JSX でビューを描画する。HTML を返さない `pages/authorize.ts` と `pages/respond.ts` は `.ts` のまま。JSX は `{...}` で埋め込んだ値をすべてエスケープするので、`login_hint` や `error_description` のような信頼できない値も手でエスケープせずに描画できる。
82
+
83
+ ビューは JSX 要素を返すコンポーネントで、`createApp` / `applyOidc` の `views` オプションで差し替えるときも `loginPage: (params) => <MyLoginPage {...params} />` のように書く。別の手段で組み立てた HTML を返すときは `hono/html` の `html` タグか `raw()` で包む(`raw()` は渡した文字列をそのまま信頼するので、エスケープ済みの HTML だけを渡す)。ステータスやヘッダーなど Response そのものを変えたいときは、`pages/*.tsx` の `render*Page()` を書き換える。
84
+
85
+ コンパイルには `tsconfig.json` で JSX を有効にしておく必要がある。
86
+
87
+ ```jsonc
88
+ {
89
+ "compilerOptions": {
90
+ "jsx": "react-jsx",
91
+ "jsxImportSource": "hono/jsx"
92
+ }
93
+ }
94
+ ```
95
+
96
+ 以前の CLI で生成した Hono の出力を `--force` で再生成すると、古い `views.ts` や `pages/login.ts` などの `.ts` ファイルが残る。同名の `.ts` は `.tsx` より優先して解決されるため、カスタマイズを `.tsx` 側へ移してから古い `.ts` を削除すること(CLI も再生成時に残っているファイルを一覧して警告する)。
97
+
79
98
  `.maronn-openid-connect.json` は、どの CLI バージョン・どの機能構成(`framework` / `features` / `scopes`)から生成されたかを記録するマニフェスト。テンプレートへ仕様修正が入ったとき、リリースノートと突き合わせて「自分のコードがどの版から生成されたか」を特定する起点になる。利用者が編集するファイルではないため、上書き保護の対象外として毎回更新される(生成日時は含めず、同じ入力からは同じ出力になる)。
80
99
 
81
100
  生成される OP のエンドポイント:
@@ -85,7 +104,7 @@ oidc-provider/
85
104
  | `/authorize` | 認可エンドポイント(`response_type=code`、PKCE S256、`prompt` / `max_age` / `claims` / Request Object 対応) |
86
105
  | `/token` | トークンエンドポイント(`authorization_code` / `refresh_token` グラント、`client_secret_basic` / `client_secret_post` / public client) |
87
106
  | `/userinfo` | UserInfo エンドポイント(Bearer トークン、scope 別クレーム) |
88
- | `/login`, `/consent` | ログイン・同意画面。ルート(GET / POST)と描画は `pages/`、認証・同意の判断は `routes/` の関数が担当する(差し替え可能なデフォルト UI 付き) |
107
+ | `/login`, `/consent` | ログイン・同意画面。ルート(GET / POST)と描画は `pages/`、認証・同意の判断は `routes/` の関数が担当する(差し替え可能なデフォルト UI 付き。Next.js はページと Server Action) |
89
108
  | `/login/google` | Sign in with Google の `login_uri`(Google が ID トークンを POST する先。`google-login` 有効時) |
90
109
  | `/.well-known/openid-configuration` | Discovery メタデータ |
91
110
  | `/.well-known/jwks.json` | JWKS(公開鍵) |
@@ -94,7 +113,7 @@ oidc-provider/
94
113
 
95
114
  ## 画面用ルーティング(pages/)と API ルーティング(routes/)
96
115
 
97
- 生成されるルーティングは 2 種類に分かれている。ブラウザに返すもの(画面の描画・リダイレクト・Cookie の付与)はすべて `pages/` が担当し、`routes/` は Response を一切作らない。UI をカスタマイズするときに触るのは `pages/`(と `views.ts`)だけで、`routes/` のロジックは読まなくてよい。
116
+ 生成されるルーティングは 2 種類に分かれている。ブラウザに返すもの(画面の描画・リダイレクト・Cookie の付与)はすべて `pages/` が担当し、`routes/` は Response を一切作らない。UI をカスタマイズするときに触るのは `pages/`(と `views.ts`、Hono は `views.tsx`)だけで、`routes/` のロジックは読まなくてよい。以下の `pages/login.ts` などのファイル名は、Hono では `authorize.ts` と `respond.ts` を除いて `.tsx` になる。
98
117
 
99
118
  | 層 | ファイル | 役割 |
100
119
  |---|---|---|
@@ -105,14 +124,69 @@ oidc-provider/
105
124
 
106
125
  UI を変える場所は、変えたい範囲で選ぶ。
107
126
 
108
- - **HTML だけ変える** → `views.ts` の `default*Page` を書き換えるか、`createApp` / `applyOidc` の `views` オプションで差し替える
127
+ - **HTML だけ変える** → `views.ts`(Hono は `views.tsx`)の `default*Page` を書き換えるか、`createApp` / `applyOidc` の `views` オプションで差し替える
109
128
  - **描画の仕方を変える**(テンプレートエンジン、フレームワークネイティブの Response、別に用意した UI へのリダイレクト)→ `pages/*.ts` の `render*Page()` と outcome を変換している箇所を書き換える。画面を返す経路はすべて `pages/` を通るので、`GET /login` もログイン失敗時の再表示も一緒に変わる
110
129
  - **画面遷移を変える**(ログイン後の遷移先、エラー時の見せ方など)→ `pages/*.ts` で `redirectWithCookies()` / `withCookies()`(`pages/respond.ts`)を呼んでいる箇所。付けるべき Cookie は outcome の `cookies` にそのまま入っている
111
- - **非リダイレクトの認可エラー(OIDC Core 1.0 §3.1.2.2)の見せ方を変える** → `pages/errors.ts` の `renderAuthorizationErrorPage()`。`config.authorizationErrorRedirectPath` に OP 内のパスを設定すると、HTML を直接返す代わりにそのパスへ 303 する(Next.js の生成物は `/oidc-error` を使う)
130
+ - **非リダイレクトの認可エラー(OIDC Core 1.0 §3.1.2.2)の見せ方を変える** → `pages/errors.ts` の `renderAuthorizationErrorPage()`。`config.authorizationErrorRedirectPath` に OP 内のパスを設定すると、HTML を直接返す代わりにそのパスへ 303 する
112
131
 
113
132
  フォームの `name`(`transaction_id` / `csrf_token` / `username` / `password`、同意の `action=approve|deny`)は `pages/` が `routes/` の関数へ渡す入力なので、画面を差し替えても維持する。transaction-binding の束縛チェック(`rejectUnboundTransaction()`)や google-login のボタン設定(`buildGoogleSignIn()`)は判断なので `routes/login.ts` / `routes/consent.ts` にあり、`pages/` は返ってきた結果を描くだけでよい。
114
133
 
115
- Next.js はもともと `login/page.tsx`(画面)と `login/actions.ts`(Server Action = ロジック)に分かれており、この構造に対応する。`_oidc-provider/pages/` も生成されるが、Route Handler 経由で動く `/authorize` と device / CIBA の画面、契約テストが使うもので、ログイン・同意画面のカスタマイズは `page.tsx` で行う。
134
+ ## Next.js の生成物
135
+
136
+ Next.js では、App Router の機能をそのまま使ったコードを `--output`(例: `./src/app`)へ生成する。共通のルーターや独自のコンテキストは挟まず、エンドポイントごとの Route Handler にその処理を上から順に書いている。`/token` の挙動を知りたければ `token/route.ts` だけを読めばよい。
137
+
138
+ ```
139
+ src/app/
140
+ ├── _oidc-provider/ # 全エンドポイントが共有する部品(private folder なのでルーティングされない)
141
+ │ ├── provider.ts # 設定・クライアント・署名鍵・ストアの組み立て。プロジェクトへ組み込むときに編集する場所
142
+ │ ├── http.ts # CORS・キャッシュ禁止の JSON 応答・パラメータ重複の検出・エラーページへのリダイレクトなど、Route Handler と Server Action 共通の部品
143
+ │ ├── transaction.ts # ログイン・同意が続ける認可トランザクションの取得(無ければ notFound())
144
+ │ ├── error-view.tsx # エラー画面の共通レイアウト(oidc-error・not-found・error の各画面が使う)
145
+ │ ├── config.ts / store.ts / resolvers.ts # 他のフレームワークと共通の設定型・ストア・resolver
146
+ │ ├── storage-backend.ts # Vercel 向け Upstash Redis REST とローカル SQLite のストア
147
+ │ └── conformance.test.ts # 契約テスト
148
+ ├── authorize/route.ts # GET|POST /authorize(検証パイプラインをこのファイルに直接書いている)
149
+ ├── token/route.ts # POST /token
150
+ ├── userinfo/route.ts # GET|POST /userinfo
151
+ ├── introspect/route.ts # POST /introspect(introspection 有効時)
152
+ ├── revoke/route.ts # POST /revoke(revocation 有効時)
153
+ ├── .well-known/openid-configuration/route.ts
154
+ ├── .well-known/jwks.json/route.ts
155
+ ├── login/page.tsx # ログイン画面(React Server Component)
156
+ ├── login/actions.ts # ログインの Server Action
157
+ ├── login/session.ts # OP セッションの開始(パスワードログインと Google ログインで共有)
158
+ ├── login/not-found.tsx # トランザクションが無いとき(notFound())の画面。HTTP 404
159
+ ├── login/error.tsx # 想定外の例外のときの画面(error boundary)
160
+ ├── consent/page.tsx # 同意画面
161
+ ├── consent/actions.ts # 同意の Server Action(認可コードを発行してクライアントへリダイレクト)
162
+ ├── consent/not-found.tsx / consent/error.tsx # 同意画面の not-found / error(ログイン画面と同じ役割)
163
+ └── oidc-error/page.tsx # クライアントへ返してはいけないエラーの表示先
164
+ ```
165
+
166
+ 各 `route.ts` は `GET` / `POST` / `OPTIONS` などの HTTP メソッドを自分で export する。ログイン・同意画面は React のページと Server Action なので、見た目は `page.tsx`、判断は `actions.ts` を書き換える。device / CIBA / RP-Initiated Logout の画面は、表示と同時に Cookie を発行し、403 や 429 などのステータスを返す必要がある。Server Component はどちらもできないため、これらは HTML を返す Route Handler(描画は各ディレクトリの `screens.ts`)として生成する。実験的機能の設定は、それを使うコードの隣に置く(例: `par/config.ts`、トークンエンドポイントの grant なら `token/token-exchange.ts` の `tokenExchangeConfig`)。認可エンドポイントと同意の両方が読む JARM の設定は `_oidc-provider/jarm.ts` にある。
167
+
168
+ OP がブラウザを止める場面は、Next.js の機能で表す。
169
+
170
+ - `transaction_id` に対応する認可リクエストが無い(不明・完了済み・期限切れ): ページと Server Action が `notFound()` を呼び、隣の `not-found.tsx` を HTTP 404 で表示する。利用者はクライアントからやり直すしかない
171
+ - クライアントへ返してはいけないエラー(OIDC Core 1.0 §3.1.2.2。未登録の `redirect_uri`、CSRF トークンの不一致、ログイン試行回数の上限、transaction-binding の不一致、判断を含まない同意の POST、Google ログインのコールバックの失敗など): `redirect()` で `oidc-error/page.tsx` へ送る。Route Handler からは 303 でリダイレクトする
172
+ - 想定外の例外(ストアの障害など): `error.tsx`(error boundary)が表示する。本番の Next.js はエラーメッセージをブラウザへ渡さないので、画面にはサーバーログと突き合わせられる `digest` だけを出す
173
+
174
+ これらの画面はどれも `_oidc-provider/error-view.tsx` の `ErrorView` で描くので、見た目はそこを書き換えれば揃って変わる。device / CIBA / RP-Initiated Logout の画面のエラーは、ステータスコード(403 / 429 など)を保つため、画面と同じく `_oidc-provider/html.ts` の HTML で返す。
175
+
176
+ Next.js は Route Handler とページ・Server Action を別々のモジュール層にバンドルする。両方から同じインスタンスを参照する必要があるストアと署名鍵は、`globalThis` に保持している(`provider.ts` / `storage-backend.ts`)。
177
+
178
+ 設定は環境変数から読む。
179
+
180
+ | 環境変数 | 用途 |
181
+ |---|---|
182
+ | `OIDC_ISSUER` | issuer。OP 自身の URL はすべてこれを基準に組み立てる |
183
+ | `OIDC_CLIENTS_JSON` | 登録クライアント(`RegisteredClient` の JSON 配列)。未指定なら `OIDC_CLIENT_ID` / `OIDC_CLIENT_SECRET` / `OIDC_CLIENT_REDIRECT_URI` の 1 クライアント |
184
+ | `OIDC_SIGNING_KEY_ID` | 起動時に生成する署名鍵の `kid` |
185
+ | `OIDC_CORS_ORIGINS` | トークンエンドポイントなどをブラウザから呼べるオリジン(既定は issuer) |
186
+ | `UPSTASH_REDIS_REST_URL` / `UPSTASH_REDIS_REST_TOKEN` | Vercel で使うストア。未指定ならローカル SQLite(`OIDC_SQLITE_PATH`、既定 `.data/oidc.sqlite`) |
187
+ | `GOOGLE_CLIENT_ID` / `GOOGLE_HOSTED_DOMAIN` | Sign in with Google(`google-login` 有効時) |
188
+
189
+ 契約テスト `_oidc-provider/conformance.test.ts` は、Route Handler・ページ・Server Action を Next.js と同じ形で直接呼び出す。リクエストの中でしか使えない `cookies()`(`next/headers`)と `redirect()` / `notFound()`(`next/navigation`)だけを差し替えているので、サーバーを起動せずに `vitest run` で実行できる(`vitest` を devDependencies に追加する)。
116
190
 
117
191
  ## 機能トグル(--enable / --disable)
118
192
 
@@ -150,7 +224,7 @@ pnpm add express @maronn-openid-connect/core @maronn-openid-connect/google-login
150
224
  |---|---|---|---|
151
225
  | `google-login` | 無効 | ログイン画面に「Google でログイン」(Google Identity Services の redirect mode)を追加し、Google が ID トークンを POST する `POST /login/google` を生成する。ID トークンの検証は Google 公式の `google-auth-library` に委ね、CSRF(`g_csrf_token` の Double Submit Cookie)、nonce による認証トランザクションへの束縛、`google:<sub>` を subject にした Google ユーザーの JIT 登録を生成コードが行う | `@maronn-openid-connect/google-login`(Node.js 22 以上限定。Cloudflare Workers などのエッジでは動かない) |
152
226
 
153
- 有効化しても `config.googleLogin` を渡すまでボタンは表示されず、`/login/google` は 404 を返す。設定は `ProviderConfig.googleLogin = { clientId, hostedDomain?, requireVerifiedEmail? }` で、Google Cloud コンソールの OAuth クライアントには `<issuer>/login/google` を「承認済みのリダイレクト URI」に、ログイン画面のオリジンを「承認済みの JavaScript 生成元」に登録する。生成される Next.js の `runtime.ts` と本リポジトリの samples は `GOOGLE_CLIENT_ID` / `GOOGLE_HOSTED_DOMAIN` からこれを読む。詳細は [`@maronn-openid-connect/google-login` の README](../google-login/README.md) を参照。
227
+ 有効化しても `config.googleLogin` を渡すまでボタンは表示されず、`/login/google` は 404 を返す。設定は `ProviderConfig.googleLogin = { clientId, hostedDomain?, requireVerifiedEmail? }` で、Google Cloud コンソールの OAuth クライアントには `<issuer>/login/google` を「承認済みのリダイレクト URI」に、ログイン画面のオリジンを「承認済みの JavaScript 生成元」に登録する。生成される Next.js の `_oidc-provider/provider.ts` と本リポジトリの samples は `GOOGLE_CLIENT_ID` / `GOOGLE_HOSTED_DOMAIN` からこれを読む。詳細は [`@maronn-openid-connect/google-login` の README](../google-login/README.md) を参照。
154
228
 
155
229
  ## カスタムスコープ(--scope)
156
230
 
@@ -211,6 +285,8 @@ export async function resolveGrantableScopes(
211
285
  3. `config.ts` と未指定時のインメモリストアはローカル検証・契約テスト専用として扱う
212
286
  4. 依存をインストールしてサーバーを起動する(例: `pnpm add hono @maronn-openid-connect/core`。`--enable google-login` 時は `@maronn-openid-connect/google-login` も)
213
287
 
288
+ Next.js では 1〜3 をすべて `_oidc-provider/provider.ts` で行う(クライアント・署名鍵・ストアの差し替え先がこのファイルに集まっている)。
289
+
214
290
  署名鍵は `SigningKeyProvider` として注入する。`createCachedSigningKeyProvider()`(core 提供)でラップすると、TTL 付きキャッシュで鍵ローテーションに追随できる。
215
291
 
216
292
  ```typescript
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/frameworks/hono/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAuCvF,qBAAa,aAAc,YAAW,kBAAkB;IACtD,QAAQ,CAAC,IAAI,UAAU;IACvB,QAAQ,CAAC,WAAW,UAAU;IAE9B,QAAQ,CAAC,OAAO,EAAE,gBAAgB,GAAG,aAAa,EAAE,CAiFnD;CACF"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/frameworks/hono/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAuCvF,qBAAa,aAAc,YAAW,kBAAkB;IACtD,QAAQ,CAAC,IAAI,UAAU;IACvB,QAAQ,CAAC,WAAW,UAAU;IAE9B,QAAQ,CAAC,OAAO,EAAE,gBAAgB,GAAG,aAAa,EAAE,CAiGnD;CACF"}
@@ -1,6 +1,7 @@
1
1
  import { DEFAULT_FEATURES } from '../../features.js';
2
- import { appTemplate, applyTemplate, configTemplate, customScopesTemplate, storeTemplate, resolversTemplate, viewsTemplate, authorizeRouteTemplate, tokenRouteTemplate, userinfoRouteTemplate, introspectionRouteTemplate, revocationRouteTemplate, jwksRouteTemplate, parRouteTemplate, deviceAuthorizationRouteTemplate, deviceVerificationRouteTemplate, backchannelAuthenticationRouteTemplate, cibaVerificationRouteTemplate, endSessionRouteTemplate, jarmConfigTemplate, discoveryRouteTemplate, loginRouteTemplate, consentRouteTemplate, conformanceTestTemplate, } from './templates.js';
2
+ import { appTemplate, applyTemplate, configTemplate, customScopesTemplate, storeTemplate, resolversTemplate, authorizeRouteTemplate, tokenRouteTemplate, userinfoRouteTemplate, introspectionRouteTemplate, revocationRouteTemplate, jwksRouteTemplate, parRouteTemplate, deviceAuthorizationRouteTemplate, deviceVerificationRouteTemplate, backchannelAuthenticationRouteTemplate, cibaVerificationRouteTemplate, endSessionRouteTemplate, jarmConfigTemplate, discoveryRouteTemplate, loginRouteTemplate, consentRouteTemplate, conformanceTestTemplate, } from './templates.js';
3
3
  import { authorizePageTemplate, cibaPageTemplate, consentPageTemplate, devicePageTemplate, errorPageTemplate, loginPageTemplate, logoutPageTemplate, respondTemplate, } from './pages.js';
4
+ import { honoViewsTemplate } from './views.js';
4
5
  export class HonoGenerator {
5
6
  name = 'hono';
6
7
  displayName = 'Hono';
@@ -8,7 +9,7 @@ export class HonoGenerator {
8
9
  const pkg = options.corePackageName;
9
10
  const features = options.features ?? DEFAULT_FEATURES;
10
11
  const scopes = options.scopes ?? [];
11
- return [
12
+ const files = [
12
13
  { path: 'app.ts', content: appTemplate(pkg, features) },
13
14
  { path: 'apply.ts', content: applyTemplate(pkg, features) },
14
15
  { path: 'config.ts', content: configTemplate(pkg, features) },
@@ -17,18 +18,18 @@ export class HonoGenerator {
17
18
  : []),
18
19
  { path: 'store.ts', content: storeTemplate(pkg, features) },
19
20
  { path: 'resolvers.ts', content: resolversTemplate(pkg, features) },
20
- { path: 'views.ts', content: viewsTemplate(features) },
21
+ { path: 'views.tsx', content: honoViewsTemplate(features) },
21
22
  { path: 'pages/respond.ts', content: respondTemplate() },
22
- { path: 'pages/errors.ts', content: errorPageTemplate() },
23
+ { path: 'pages/errors.tsx', content: errorPageTemplate('jsx') },
23
24
  { path: 'pages/authorize.ts', content: authorizePageTemplate() },
24
- { path: 'pages/login.ts', content: loginPageTemplate(features) },
25
- { path: 'pages/consent.ts', content: consentPageTemplate() },
25
+ { path: 'pages/login.tsx', content: loginPageTemplate(features, 'jsx') },
26
+ { path: 'pages/consent.tsx', content: consentPageTemplate('jsx') },
26
27
  ...(features.deviceAuthorizationGrant
27
- ? [{ path: 'pages/device.ts', content: devicePageTemplate() }]
28
+ ? [{ path: 'pages/device.tsx', content: devicePageTemplate('jsx') }]
28
29
  : []),
29
- ...(features.ciba ? [{ path: 'pages/ciba.ts', content: cibaPageTemplate() }] : []),
30
+ ...(features.ciba ? [{ path: 'pages/ciba.tsx', content: cibaPageTemplate('jsx') }] : []),
30
31
  ...(features.rpInitiatedLogout
31
- ? [{ path: 'pages/logout.ts', content: logoutPageTemplate() }]
32
+ ? [{ path: 'pages/logout.tsx', content: logoutPageTemplate('jsx') }]
32
33
  : []),
33
34
  { path: 'routes/authorize.ts', content: authorizeRouteTemplate(pkg, features, scopes) },
34
35
  { path: 'routes/token.ts', content: tokenRouteTemplate(pkg, features) },
@@ -72,6 +73,14 @@ export class HonoGenerator {
72
73
  { path: 'routes/consent.ts', content: consentRouteTemplate(pkg, features, scopes) },
73
74
  { path: 'conformance.test.ts', content: conformanceTestTemplate(pkg, features, scopes) },
74
75
  ];
76
+ const tsxModules = files
77
+ .filter((file) => file.path.endsWith('.tsx'))
78
+ .map((file) => file.path.slice(0, -'.tsx'.length));
79
+ const tsReference = new RegExp(`\\b(${tsxModules.join('|')})\\.ts\\b`, 'g');
80
+ return files.map((file) => ({
81
+ ...file,
82
+ content: file.content.replace(tsReference, '$1.tsx'),
83
+ }));
75
84
  }
76
85
  }
77
86
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/frameworks/hono/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EACL,WAAW,EACX,aAAa,EACb,cAAc,EACd,oBAAoB,EACpB,aAAa,EACb,iBAAiB,EACjB,aAAa,EACb,sBAAsB,EACtB,kBAAkB,EAClB,qBAAqB,EACrB,0BAA0B,EAC1B,uBAAuB,EACvB,iBAAiB,EACjB,gBAAgB,EAChB,gCAAgC,EAChC,+BAA+B,EAC/B,sCAAsC,EACtC,6BAA6B,EAC7B,uBAAuB,EACvB,kBAAkB,EAClB,sBAAsB,EACtB,kBAAkB,EAClB,oBAAoB,EACpB,uBAAuB,GACxB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,qBAAqB,EACrB,gBAAgB,EAChB,mBAAmB,EACnB,kBAAkB,EAClB,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,EAClB,eAAe,GAChB,MAAM,YAAY,CAAC;AAEpB,MAAM,OAAO,aAAa;IACf,IAAI,GAAG,MAAM,CAAC;IACd,WAAW,GAAG,MAAM,CAAC;IAE9B,QAAQ,CAAC,OAAyB;QAChC,MAAM,GAAG,GAAG,OAAO,CAAC,eAAe,CAAC;QACpC,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,gBAAgB,CAAC;QACtD,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,EAAE,CAAC;QAEpC,OAAO;YACL,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,WAAW,CAAC,GAAG,EAAE,QAAQ,CAAC,EAAE;YACvD,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,aAAa,CAAC,GAAG,EAAE,QAAQ,CAAC,EAAE;YAC3D,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,E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,EAAE,MAAM,CAAC,EAAE;SACzF,CAAC;QAKF,MAAM,UAAU,GAAG,KAAK;aACrB,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;aAC5C,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;QACrD,MAAM,WAAW,GAAG,IAAI,MAAM,CAAC,OAAO,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC;QAC5E,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;YAC1B,GAAG,IAAI;YACP,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,WAAW,EAAE,QAAQ,CAAC;SACrD,CAAC,CAAC,CAAC;IACN,CAAC;CACF"}
@@ -1,10 +1,11 @@
1
1
  import type { OidcFeatureConfig } from '../../features.js';
2
+ import { type ViewMarkup } from './templates.js';
2
3
  export declare function respondTemplate(): string;
3
- export declare function errorPageTemplate(): string;
4
+ export declare function errorPageTemplate(markup?: ViewMarkup): string;
4
5
  export declare function authorizePageTemplate(): string;
5
- export declare function loginPageTemplate(features?: OidcFeatureConfig): string;
6
- export declare function consentPageTemplate(): string;
7
- export declare function devicePageTemplate(): string;
8
- export declare function cibaPageTemplate(): string;
9
- export declare function logoutPageTemplate(): string;
6
+ export declare function loginPageTemplate(features?: OidcFeatureConfig, markup?: ViewMarkup): string;
7
+ export declare function consentPageTemplate(markup?: ViewMarkup): string;
8
+ export declare function devicePageTemplate(markup?: ViewMarkup): string;
9
+ export declare function cibaPageTemplate(markup?: ViewMarkup): string;
10
+ export declare function logoutPageTemplate(markup?: ViewMarkup): string;
10
11
  //# sourceMappingURL=pages.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"pages.d.ts","sourceRoot":"","sources":["../../../src/frameworks/hono/pages.ts"],"names":[],"mappings":"AA0BA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAO3D,wBAAgB,eAAe,IAAI,MAAM,CA6CxC;AAUD,wBAAgB,iBAAiB,IAAI,MAAM,CA+D1C;AAOD,wBAAgB,qBAAqB,IAAI,MAAM,CAiF9C;AAOD,wBAAgB,iBAAiB,CAC/B,QAAQ,GAAE,iBAAoC,GAC7C,MAAM,CAwIR;AAMD,wBAAgB,mBAAmB,IAAI,MAAM,CAqF5C;AAOD,wBAAgB,kBAAkB,IAAI,MAAM,CAoK3C;AAOD,wBAAgB,gBAAgB,IAAI,MAAM,CAuIzC;AAOD,wBAAgB,kBAAkB,IAAI,MAAM,CAyF3C"}
1
+ {"version":3,"file":"pages.d.ts","sourceRoot":"","sources":["../../../src/frameworks/hono/pages.ts"],"names":[],"mappings":"AA+BA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAwB,KAAK,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAgCvE,wBAAgB,eAAe,IAAI,MAAM,CA6CxC;AAUD,wBAAgB,iBAAiB,CAAC,MAAM,GAAE,UAAqB,GAAG,MAAM,CA+DvE;AAOD,wBAAgB,qBAAqB,IAAI,MAAM,CAiF9C;AAOD,wBAAgB,iBAAiB,CAC/B,QAAQ,GAAE,iBAAoC,EAC9C,MAAM,GAAE,UAAqB,GAC5B,MAAM,CAwIR;AAMD,wBAAgB,mBAAmB,CAAC,MAAM,GAAE,UAAqB,GAAG,MAAM,CAqFzE;AAOD,wBAAgB,kBAAkB,CAAC,MAAM,GAAE,UAAqB,GAAG,MAAM,CAsKxE;AAOD,wBAAgB,gBAAgB,CAAC,MAAM,GAAE,UAAqB,GAAG,MAAM,CAuItE;AAOD,wBAAgB,kBAAkB,CAAC,MAAM,GAAE,UAAqB,GAAG,MAAM,CAyFxE"}
@@ -1,5 +1,21 @@
1
1
  import { DEFAULT_FEATURES } from '../../features.js';
2
2
  import { EXPERIMENTAL_PACKAGE } from './templates.js';
3
+ function jsxPragma(markup) {
4
+ return markup === 'jsx' ? '/** @jsxImportSource hono/jsx */\n' : '';
5
+ }
6
+ function viewsLookup(markup) {
7
+ return markup === 'jsx'
8
+ ? "const views: Views = c.get('views') ?? defaultViews;"
9
+ : "const views = c.get('views') ?? defaultViews;";
10
+ }
11
+ function viewsTypeImport(markup, multiline = false) {
12
+ if (markup !== 'jsx')
13
+ return '';
14
+ return multiline ? ' type Views,\n' : ', type Views';
15
+ }
16
+ function viewElement(markup, view, props = 'params') {
17
+ return markup === 'jsx' ? `<views.${view} {...${props}} />` : `views.${view}(${props})`;
18
+ }
3
19
  export function respondTemplate() {
4
20
  return `/**
5
21
  * Response helpers shared by the screen routes (pages/).
@@ -46,8 +62,8 @@ export function redirectWithCookies(
46
62
  }
47
63
  `;
48
64
  }
49
- export function errorPageTemplate() {
50
- return `/**
65
+ export function errorPageTemplate(markup = 'string') {
66
+ return `${jsxPragma(markup)}/**
51
67
  * Error screen (screen routing layer).
52
68
  *
53
69
  * Whenever a page has to stop the browser on the OP's own error page it calls
@@ -56,7 +72,7 @@ export function errorPageTemplate() {
56
72
  * page of your own.
57
73
  */
58
74
  import { defaultProviderConfig } from '../config.js';
59
- import { defaultViews, renderView, type ErrorPageParams } from '../views.js';
75
+ import { defaultViews, renderView, type ErrorPageParams${viewsTypeImport(markup)} } from '../views.js';
60
76
 
61
77
  /**
62
78
  * Render the OP's error page.
@@ -66,8 +82,8 @@ import { defaultViews, renderView, type ErrorPageParams } from '../views.js';
66
82
  * from the message (a 429 lockout page answers 429, a 403 binding failure 403).
67
83
  */
68
84
  export function renderErrorPage(c: any, params: ErrorPageParams): Response {
69
- const views = c.get('views') ?? defaultViews;
70
- return renderView(views.errorPage(params), { status: params.statusCode });
85
+ ${viewsLookup(markup)}
86
+ return renderView(${viewElement(markup, 'errorPage')}, { status: params.statusCode });
71
87
  }
72
88
 
73
89
  /**
@@ -192,7 +208,7 @@ authorizePage.get('/', handleAuthorizationRequest);
192
208
  authorizePage.post('/', handleAuthorizationRequest);
193
209
  `;
194
210
  }
195
- export function loginPageTemplate(features = DEFAULT_FEATURES) {
211
+ export function loginPageTemplate(features = DEFAULT_FEATURES, markup = 'string') {
196
212
  const googleSignInParam = features.googleLogin
197
213
  ? `
198
214
  // EXTENSION (google-login): undefined until config.googleLogin is set.
@@ -223,7 +239,7 @@ loginPage.post('/google', async (c) => {
223
239
  });
224
240
  `
225
241
  : '';
226
- return `/**
242
+ return `${jsxPragma(markup)}/**
227
243
  * Login screen (screen routing layer).
228
244
  *
229
245
  * GET /login renders the form and POST /login submits it. Neither handler
@@ -237,7 +253,7 @@ loginPage.post('/google', async (c) => {
237
253
  import { Hono } from 'hono';
238
254
  import { defaultProviderConfig } from '../config.js';
239
255
  import { prepareLogin, submitLogin${googleLoginImport}, type LoginScreen } from '../routes/login.js';
240
- import { defaultViews, renderView, type LoginPageParams } from '../views.js';
256
+ import { defaultViews, renderView, type LoginPageParams${viewsTypeImport(markup)} } from '../views.js';
241
257
  import { renderErrorPage } from './errors.js';
242
258
  import { redirectWithCookies } from './respond.js';
243
259
 
@@ -248,8 +264,8 @@ export const loginPage = new Hono<{ Variables: Record<string, any> }>();
248
264
  * or redirect to a UI of your own — here only.
249
265
  */
250
266
  export function renderLoginPage(c: any, params: LoginPageParams): Response {
251
- const views = c.get('views') ?? defaultViews;
252
- return renderView(views.loginPage(params));
267
+ ${viewsLookup(markup)}
268
+ return renderView(${viewElement(markup, 'loginPage')});
253
269
  }
254
270
 
255
271
  /**
@@ -326,8 +342,8 @@ loginPage.post('/', async (c) => {
326
342
  });
327
343
  ${googleLoginRoute}`;
328
344
  }
329
- export function consentPageTemplate() {
330
- return `/**
345
+ export function consentPageTemplate(markup = 'string') {
346
+ return `${jsxPragma(markup)}/**
331
347
  * Consent screen (screen routing layer).
332
348
  *
333
349
  * GET /consent renders the approve / deny form and POST /consent submits it.
@@ -342,7 +358,7 @@ export function consentPageTemplate() {
342
358
  */
343
359
  import { Hono } from 'hono';
344
360
  import { prepareConsent, submitConsent } from '../routes/consent.js';
345
- import { defaultViews, renderView, type ConsentPageParams } from '../views.js';
361
+ import { defaultViews, renderView, type ConsentPageParams${viewsTypeImport(markup)} } from '../views.js';
346
362
  import { renderErrorPage } from './errors.js';
347
363
  import { redirectWithCookies } from './respond.js';
348
364
 
@@ -353,8 +369,8 @@ export const consentPage = new Hono<{ Variables: Record<string, any> }>();
353
369
  * or redirect to a UI of your own — here only.
354
370
  */
355
371
  export function renderConsentPage(c: any, params: ConsentPageParams): Response {
356
- const views = c.get('views') ?? defaultViews;
357
- return renderView(views.consentPage(params));
372
+ ${viewsLookup(markup)}
373
+ return renderView(${viewElement(markup, 'consentPage')});
358
374
  }
359
375
 
360
376
  /**
@@ -412,8 +428,8 @@ consentPage.post('/', async (c) => {
412
428
  });
413
429
  `;
414
430
  }
415
- export function devicePageTemplate() {
416
- return `/**
431
+ export function devicePageTemplate(markup = 'string') {
432
+ return `${jsxPragma(markup)}/**
417
433
  * EXPERIMENTAL — Device Authorization Grant verification screens
418
434
  * (RFC 8628 §3.3), screen routing layer.
419
435
  *
@@ -444,7 +460,7 @@ import {
444
460
  type DeviceCompletedPageParams,
445
461
  type DeviceLoginPageParams,
446
462
  type DeviceVerificationPageParams,
447
- } from '../views.js';
463
+ ${viewsTypeImport(markup, true)}} from '../views.js';
448
464
  import { renderErrorPage } from './errors.js';
449
465
  import { withCookies } from './respond.js';
450
466
 
@@ -455,8 +471,8 @@ export function renderDeviceVerificationPage(
455
471
  c: any,
456
472
  params: DeviceVerificationPageParams,
457
473
  ): Response {
458
- const views = c.get('views') ?? defaultViews;
459
- return renderView(views.deviceVerificationPage(params));
474
+ ${viewsLookup(markup)}
475
+ return renderView(${viewElement(markup, 'deviceVerificationPage')});
460
476
  }
461
477
 
462
478
  /**
@@ -466,29 +482,31 @@ export function renderDeviceVerificationPage(
466
482
  * indistinguishable, otherwise the response itself confirms which codes exist.
467
483
  */
468
484
  export function renderInvalidUserCode(c: any, userCode: string): Response {
469
- const views = c.get('views') ?? defaultViews;
485
+ ${viewsLookup(markup)}
470
486
  return renderView(
471
- views.deviceVerificationPage({ userCode, error: INVALID_USER_CODE_MESSAGE }),
487
+ ${markup === 'jsx'
488
+ ? '<views.deviceVerificationPage userCode={userCode} error={INVALID_USER_CODE_MESSAGE} />'
489
+ : 'views.deviceVerificationPage({ userCode, error: INVALID_USER_CODE_MESSAGE })'},
472
490
  { status: 400 },
473
491
  );
474
492
  }
475
493
 
476
494
  /** Render the sign-in form of the device flow. */
477
495
  export function renderDeviceLoginPage(c: any, params: DeviceLoginPageParams): Response {
478
- const views = c.get('views') ?? defaultViews;
479
- return renderView(views.deviceLoginPage(params));
496
+ ${viewsLookup(markup)}
497
+ return renderView(${viewElement(markup, 'deviceLoginPage')});
480
498
  }
481
499
 
482
500
  /** Render the approve / deny screen (RFC 8628 §5.4: the user_code is repeated). */
483
501
  export function renderDeviceApprovalPage(c: any, params: DeviceApprovalPageParams): Response {
484
- const views = c.get('views') ?? defaultViews;
485
- return renderView(views.deviceApprovalPage(params));
502
+ ${viewsLookup(markup)}
503
+ return renderView(${viewElement(markup, 'deviceApprovalPage')});
486
504
  }
487
505
 
488
506
  /** Render the "go back to your device" screen. */
489
507
  export function renderDeviceCompletedPage(c: any, params: DeviceCompletedPageParams): Response {
490
- const views = c.get('views') ?? defaultViews;
491
- return renderView(views.deviceCompletedPage(params));
508
+ ${viewsLookup(markup)}
509
+ return renderView(${viewElement(markup, 'deviceCompletedPage')});
492
510
  }
493
511
 
494
512
  /** Turn the outcome of a verification step into the screen that follows it. */
@@ -577,8 +595,8 @@ devicePage.post('/approve', async (c) => {
577
595
  });
578
596
  `;
579
597
  }
580
- export function cibaPageTemplate() {
581
- return `/**
598
+ export function cibaPageTemplate(markup = 'string') {
599
+ return `${jsxPragma(markup)}/**
582
600
  * EXPERIMENTAL — CIBA authentication device screens (CIBA Core 1.0 §7.1),
583
601
  * screen routing layer.
584
602
  *
@@ -607,7 +625,7 @@ import {
607
625
  type CibaCompletedPageParams,
608
626
  type CibaLoginPageParams,
609
627
  type CibaPendingRequestsPageParams,
610
- } from '../views.js';
628
+ ${viewsTypeImport(markup, true)}} from '../views.js';
611
629
  import { renderErrorPage } from './errors.js';
612
630
  import { withCookies } from './respond.js';
613
631
 
@@ -615,8 +633,8 @@ export const cibaPage = new Hono<{ Variables: Record<string, any> }>();
615
633
 
616
634
  /** Render the sign-in form of the authentication device UI. */
617
635
  export function renderCibaLoginPage(c: any, params: CibaLoginPageParams): Response {
618
- const views = c.get('views') ?? defaultViews;
619
- return renderView(views.cibaLoginPage(params));
636
+ ${viewsLookup(markup)}
637
+ return renderView(${viewElement(markup, 'cibaLoginPage')});
620
638
  }
621
639
 
622
640
  /** Render the pending-requests approval screen (CIBA Core 1.0 §7.1 binding_message). */
@@ -624,14 +642,14 @@ export function renderCibaPendingRequestsPage(
624
642
  c: any,
625
643
  params: CibaPendingRequestsPageParams,
626
644
  ): Response {
627
- const views = c.get('views') ?? defaultViews;
628
- return renderView(views.cibaPendingRequestsPage(params));
645
+ ${viewsLookup(markup)}
646
+ return renderView(${viewElement(markup, 'cibaPendingRequestsPage')});
629
647
  }
630
648
 
631
649
  /** Render the decision-recorded screen. */
632
650
  export function renderCibaCompletedPage(c: any, params: CibaCompletedPageParams): Response {
633
- const views = c.get('views') ?? defaultViews;
634
- return renderView(views.cibaCompletedPage(params));
651
+ ${viewsLookup(markup)}
652
+ return renderView(${viewElement(markup, 'cibaCompletedPage')});
635
653
  }
636
654
 
637
655
  /** Turn the outcome of a step into the screen that follows it. */
@@ -713,8 +731,8 @@ cibaPage.post('/approve', async (c) => {
713
731
  });
714
732
  `;
715
733
  }
716
- export function logoutPageTemplate() {
717
- return `/**
734
+ export function logoutPageTemplate(markup = 'string') {
735
+ return `${jsxPragma(markup)}/**
718
736
  * EXPERIMENTAL — RP-Initiated Logout screens (RP-Initiated Logout 1.0 §2),
719
737
  * screen routing layer.
720
738
  *
@@ -738,7 +756,7 @@ import {
738
756
  renderView,
739
757
  type LogoutCompletedPageParams,
740
758
  type LogoutConfirmationPageParams,
741
- } from '../views.js';
759
+ ${viewsTypeImport(markup, true)}} from '../views.js';
742
760
  import { renderErrorPage } from './errors.js';
743
761
  import { redirectWithCookies, withCookies } from './respond.js';
744
762
 
@@ -749,14 +767,14 @@ export function renderLogoutConfirmationPage(
749
767
  c: any,
750
768
  params: LogoutConfirmationPageParams,
751
769
  ): Response {
752
- const views = c.get('views') ?? defaultViews;
753
- return renderView(views.logoutConfirmationPage(params));
770
+ ${viewsLookup(markup)}
771
+ return renderView(${viewElement(markup, 'logoutConfirmationPage')});
754
772
  }
755
773
 
756
774
  /** Render the logged-out screen. */
757
775
  export function renderLogoutCompletedPage(c: any, params: LogoutCompletedPageParams): Response {
758
- const views = c.get('views') ?? defaultViews;
759
- return renderView(views.logoutCompletedPage(params));
776
+ ${viewsLookup(markup)}
777
+ return renderView(${viewElement(markup, 'logoutCompletedPage')});
760
778
  }
761
779
 
762
780
  /** Turn the outcome of a logout step into the HTTP response. */
@@ -1 +1 @@
1
- {"version":3,"file":"pages.js","sourceRoot":"","sources":["../../../src/frameworks/hono/pages.ts"],"names":[],"mappings":"AAyBA,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAErD,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAMtD,MAAM,UAAU,eAAe;IAC7B,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2CR,CAAC;AACF,CAAC;AAUD,MAAM,UAAU,iBAAiB;IAC/B,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6DR,CAAC;AACF,CAAC;AAOD,MAAM,UAAU,qBAAqB;IACnC,OAAO;;;;;;;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AC,MAAM,CAAC;;;;;;;;;;;;;;eAcd,oBAAoB;;;;;;;;;;;;;;;EAejC,eAAe,CAAC,MAAM,EAAE,IAAI,CAAC;;;;;;;;IAQ3B,WAAW,CAAC,MAAM,CAAC;sBACD,WAAW,CAAC,MAAM,EAAE,eAAe,CAAC;;;;;;;;IAQtD,WAAW,CAAC,MAAM,CAAC;sBACD,WAAW,CAAC,MAAM,EAAE,yBAAyB,CAAC;;;;;IAKhE,WAAW,CAAC,MAAM,CAAC;sBACD,WAAW,CAAC,MAAM,EAAE,mBAAmB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgF7D,CAAC;AACF,CAAC;AAOD,MAAM,UAAU,kBAAkB,CAAC,MAAM,GAAe,QAAQ;IAC9D,OAAO,GAAG,SAAS,CAAC,MAAM,CAAC;;;;;;;;;;;;;;;eAed,oBAAoB;;;;;;;;;EASjC,eAAe,CAAC,MAAM,EAAE,IAAI,CAAC;;;;;;;;;;;IAW3B,WAAW,CAAC,MAAM,CAAC;sBACD,WAAW,CAAC,MAAM,EAAE,wBAAwB,CAAC;;;;;IAK/D,WAAW,CAAC,MAAM,CAAC;sBACD,WAAW,CAAC,MAAM,EAAE,qBAAqB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6C/D,CAAC;AACF,CAAC"}
@@ -2,10 +2,19 @@ import type { OidcFeatureConfig } from '../../features.js';
2
2
  export declare const EXPERIMENTAL_PACKAGE = "@maronn-openid-connect/experimental";
3
3
  export declare const GOOGLE_LOGIN_PACKAGE = "@maronn-openid-connect/google-login";
4
4
  export declare function appTemplate(_corePkg: string, features?: OidcFeatureConfig): string;
5
- export declare function customScopesTemplate(scopes: string[], features?: OidcFeatureConfig): string;
6
- export declare function configTemplate(corePkg: string, features?: OidcFeatureConfig): string;
5
+ export interface ScopePolicyFileRefs {
6
+ userinfo: string;
7
+ consent: string;
8
+ authorize: string;
9
+ approvals: string;
10
+ }
11
+ export declare function customScopesTemplate(scopes: string[], features?: OidcFeatureConfig, fileRefs?: ScopePolicyFileRefs): string;
12
+ export interface ConfigTemplateOptions {
13
+ authorizationErrorRedirectPath?: boolean;
14
+ }
15
+ export declare function configTemplate(corePkg: string, features?: OidcFeatureConfig, options?: ConfigTemplateOptions): string;
7
16
  export declare function storeTemplate(corePkg: string, features?: OidcFeatureConfig): string;
8
- export declare function resolversTemplate(corePkg: string, features?: OidcFeatureConfig): string;
17
+ export declare function resolversTemplate(corePkg: string, features?: OidcFeatureConfig, clientResolverInjectionNote?: string): string;
9
18
  export declare function authorizeRouteTemplate(corePkg: string, features?: OidcFeatureConfig, scopes?: string[]): string;
10
19
  export declare function parRouteTemplate(corePkg: string): string;
11
20
  export declare function deviceAuthorizationRouteTemplate(corePkg: string, features?: OidcFeatureConfig, scopes?: string[]): string;
@@ -23,11 +32,16 @@ export declare function consentRouteTemplate(corePkg: string, features?: OidcFea
23
32
  export declare function applyTemplate(_corePkg: string, features?: OidcFeatureConfig): string;
24
33
  export declare function introspectionRouteTemplate(corePkg: string, features?: OidcFeatureConfig): string;
25
34
  export declare function revocationRouteTemplate(corePkg: string): string;
35
+ export declare function viewParamTypesTemplate(features?: OidcFeatureConfig): string;
36
+ export declare function viewsInterfaceTemplate(features?: OidcFeatureConfig): string;
26
37
  export declare function viewsTemplate(features?: OidcFeatureConfig): string;
27
38
  export declare function requestObjectConformanceModuleSetup(features?: OidcFeatureConfig): string;
28
39
  export declare function requestObjectConformanceBeforeAll(features?: OidcFeatureConfig): string;
29
- export declare function reuseFlowConformanceTestBlock(features?: OidcFeatureConfig, errorPageMode?: 'html' | 'redirect'): string;
40
+ export declare function reuseFlowConformanceTestBlock(features?: OidcFeatureConfig, viewMarkup?: ViewMarkup): string;
41
+ export type ViewMarkup = 'string' | 'jsx';
42
+ export declare function defaultErrorPageBodyExpectation(error: string, description: string, viewMarkup: ViewMarkup): string;
30
43
  export declare function transactionBindingConformanceBlock(features?: OidcFeatureConfig): string;
44
+ export declare function jsxViewConformanceTestBlock(): string;
31
45
  export declare function customViewConformanceTestBlock(): string;
32
46
  export declare function authorizationCodeConformanceHelper(features: OidcFeatureConfig): string;
33
47
  export declare function jwtIntrospectionResponseConformanceClients(features: OidcFeatureConfig): string;
@@ -50,10 +64,9 @@ export declare function persistentStorageConformanceBlock(): string;
50
64
  export declare function tokenExchangeConformanceBlock(features: OidcFeatureConfig): string;
51
65
  export declare function idJagConformanceBlock(features: OidcFeatureConfig): string;
52
66
  export declare function parConformanceBlock(features: OidcFeatureConfig): string;
53
- export type JarmConsentResponseMode = 'jwt' | 'plain';
54
67
  export declare function deviceAuthorizationConformanceBlock(features: OidcFeatureConfig): string;
55
68
  export declare function cibaConformanceBlock(features: OidcFeatureConfig): string;
56
- export declare function jarmConformanceBlock(features: OidcFeatureConfig, consentResponseMode?: JarmConsentResponseMode): string;
69
+ export declare function jarmConformanceBlock(features: OidcFeatureConfig): string;
57
70
  export declare function consentDecisionConformanceBlock(): string;
58
71
  export declare function googleLoginConformanceImportsBlock(features: OidcFeatureConfig): string;
59
72
  export declare function googleLoginConformanceBlock(features: OidcFeatureConfig): string;