NGINX Plus
このチュートリアルでは、nginx-openid-connectモジュールを使用して、NGINXサーバーに認証と認可を追加する方法について説明します。 ログインして、アカウント用に構成された例を参考にこのクイックタートに従うことをお勧めします。
このチュートリアルとシードプロジェクトは次を使用してテストが完了しています:
NGINX Plus R24
まず、NGINX Plusにnginx-plus-module-njsモジュールをインストールする必要があります。
動的モジュールのインストールガイドに従って、ホストOSにパッケージをインストールします。
yumパッケージ管理ツールを使用しているLinuxディストリビューションでは、soのようなモジュールをインストールすることができます:
sudo yum install nginx-plus-module-njs jq
インストールしたら、それをNGINXに有効化する必要があります。次の行を/etc/nginx/nginx.confファイルの最上部近くに追加してください:
load_module modules/ngx_http_js_module.so;
nginx-openid-connectリポジトリをクローンします。このリポジトリにはテンプレート構成があります。
git clone https://github.com/nginxinc/nginx-openid-connect
nginx-openid-connectフォルダーにあるconfigure.shスクリプトを実行して、テンプレートの構成にAuth0アプリケーションの詳細を入力します。
./configure.sh --auth_jwt_key request \
--client_id {yourClientId} \
--pkce_enable \
https://{yourDomain}/.well-known/openid-configurationWas this helpful?
次に、テナントのログアウトURLをopenid_connect_configuration.confファイルに追加します。
openid_connect.server_confファイルにAccept-Encodingヘッダーを追加して、 gzipに値を設定します。
4つの構成ファイルをconf.dフォルダーにコピーします。
sudo cp openid_connect.js \
frontend.conf \
openid_connect_configuration.conf \
openid_connect.server_conf /etc/nginx/conf.dWas this helpful?
Auth0 Dashboardで以下を行います。
[Applications(アプリケーション)] > [Applications(アプリケーション)]に移動し、リストからアプリケーションを選択します。
[Settings(設定)]ビューに切り替えます。
[Application URI(アプリケーションURI)]セクションの[Allowed Callback URLs(許可されているコールバックURL)]にhttps://{yourDomain}/_codexchを追加します。
[Credentials(資格情報)]ビューに切り替えます。
[Application Authentication(アプリケーション認証)]セクションで、認証方法を[None(なし)]に設定します。
IDトークン(JWT)からの追加のヘッダーを/etc/nginx/conf.d/frontend.confファイルでアップストリームの対象に追加します。
Next Steps
Excellent work! If you made it this far, you should now have login, logout, and user profile information running in your application.
This concludes our quickstart tutorial, but there is so much more to explore. To learn more about what you can do with Auth0, check out:
- Auth0 Dashboard - Learn how to configure and manage your Auth0 tenant and applications
- Auth0 Marketplace - Discover integrations you can enable to extend Auth0’s functionality
Sign up for an or to your existing account to integrate directly with your own tenant.