{"componentChunkName":"component---src-templates-post-template-js","path":"/posts/azure-easy-auth-memo","result":{"data":{"markdownRemark":{"id":"a873e229-b927-55a5-aef0-1b32e65ae0db","html":"<p>Azure Easy Auth について調べたメモです。</p>\n<h2 id=\"概要\" style=\"position:relative;\"><a href=\"#%E6%A6%82%E8%A6%81\" aria-label=\"概要 permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>概要</h2>\n<p>Azure App Service や Container Apps では、「Easy Auth」を使うと簡単に認証ができる。</p>\n<p>開発者が構築したコンテナの前段でリバースプロキシのようなコンテナが起動し、<code class=\"language-text\">/.auth</code> 以下のエンドポイントが追加されるとのこと。</p>\n<h2 id=\"認証方法\" style=\"position:relative;\"><a href=\"#%E8%AA%8D%E8%A8%BC%E6%96%B9%E6%B3%95\" aria-label=\"認証方法 permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>認証方法</h2>\n<p>認証については、たとえば自社のユーザーしか使えないようにしたい場合、Azure Entra ID に登録済みのユーザーしか使えないようなことは簡単にできそう。</p>\n<p>Azure AD B2C を使えば、Cognito・Auth0・Supabase Auth を導入するのと同じように、社外のユーザーに対しても認証を構築できそう。</p>\n<h2 id=\"ローカル開発\" style=\"position:relative;\"><a href=\"#%E3%83%AD%E3%83%BC%E3%82%AB%E3%83%AB%E9%96%8B%E7%99%BA\" aria-label=\"ローカル開発 permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>ローカル開発</h2>\n<p>ローカルでは <code class=\"language-text\">/.auth</code> というエンドポイントがないので、そこをどうするかが課題。</p>\n<p>ローカルでの開発用に、<code class=\"language-text\">/.auth</code> 以下へのアクセスを Azure にプロキシする例がある模様。</p>\n<ul>\n<li><a href=\"https://hajekj.net/2020/05/01/running-easyauth-locally/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">https://hajekj.net/2020/05/01/running-easyauth-locally/</a></li>\n<li><a href=\"https://github.com/buchanan-edwards/azure-easy-auth-local/blob/master/azure-easy-auth-local.js\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">https://github.com/buchanan-edwards/azure-easy-auth-local/blob/master/azure-easy-auth-local.js</a></li>\n</ul>\n<p>実際に Easy Auth を使う開発をする際は、このようなプロキシを使うか、ローカルでは <code class=\"language-text\">/.auth</code> 以下へのリクエストに固定のトークンを返すような実装があるとよさそう。</p>\n<h2 id=\"参考\" style=\"position:relative;\"><a href=\"#%E5%8F%82%E8%80%83\" aria-label=\"参考 permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>参考</h2>\n<ul>\n<li><a href=\"https://learn.microsoft.com/ja-jp/azure/active-directory-b2c/configure-authentication-sample-react-spa-app\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Azure Active Directory B2C を使用してサンプルの React シングルページ アプリケーションで認証を構成する</a></li>\n<li><a href=\"https://blog.shibayan.jp/entry/20220729/1659064065\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Azure に実装されている 3 つの Easy Auth (Web Apps / Static Web Apps / Container Apps) の実装を再確認した</a></li>\n</ul>","fields":{"slug":"/posts/azure-easy-auth-memo","tagSlugs":["/tag/azure/"],"autoRecommendPosts":["microsoft-azure-books","active-directory-saml-sso-concepts","user-story","udemy-aws-container"]},"frontmatter":{"date":"2025-01-01T06:19:48.712Z","description":"Azure Easy Auth について調べたメモです。","tags":["azure"],"title":"Azure Easy Auth 調査メモ","socialImage":null,"recommendPosts":null}}},"pageContext":{"slug":"/posts/azure-easy-auth-memo"}},"staticQueryHashes":["251939775","3942705351","401334301"]}