Keycloakが使用できないときにメールとパスワードでの認証を追加 #360
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
概要
Keycloakが使用できない場合の対応として、メールアドレスとパスワードによる認証機能を追加しました。
(Cloudflare Access 使うならいらないのか?それだとKeycloakくん解雇ってこと???)
(NUTFES-Accountの活用も含めて検討しないとコストになりそう)
実装詳細
認証システムの拡張
[...nextauth].tsでCredentialsプロバイダーを追加AUTH_MODE環境変数でkeycloak/credentialsを選択セキュリティ対策
ADMIN_USERS環境変数で複数のメール:ハッシュペアを設定可能UI/UX改善
disabledとfullWidthプロパティを追加設定ファイル更新
admin.envに追加moduleResolutionをbundlerに更新画面スクリーンショット等
Credentials認証モード時のログイン画面
テスト項目
認証機能テスト
AUTH_MODE=credentials時にCredentialsログインフォームが表示されることAUTH_MODE=keycloakかつKeycloak設定不備時にCredentialsにフォールバックすることUI/UX テスト
セキュリティテスト
備考
パスワードハッシュの生成方法
1. 単一管理者の場合
2. 複数管理者の場合
環境変数の設定方法
開発環境(admin.env)
本番環境設定
admin-prod.envに追加