Google Workspace(旧 G Suite)アカウントを Cloudflare Access と連携できます。汎用の Google 認証 の手順と異なり、次の手順では Google Workspace アカウントからグループ所属情報を取得できます。
連携後、ユーザーは Google Workspace の認証情報でログインし、Cloudflare Access で保護されたリソースに到達したり、デバイスを Cloudflare Gateway に登録したりできます。
Google Workspace を Cloudflare One の ID プロバイダーとして連携するために、Google Cloud Platform のユーザーである必要はありません。IdP 連携の設定のために Google Cloud Platform を開くだけで十分です。
-
Google Cloud Platform の コンソール ↗ にログインします。Google Workspace のコンソールとは別です。
-
Google Workspace API を有効にするには、Google Cloud プロジェクトが必要です。まだない場合は、IAM & Admin > Create Project を開きます。プロジェクト名を入力し、Create を選択します。
-
APIs & Services を開き、Enable APIs and Services を選択します。API Library が読み込まれます。
-
API Library で
adminを検索し、Admin SDK API を選択します。 -
Admin SDK API を Enable します。
-
APIs & Services ページに戻り、Credentials を開きます。
-
Configure Consent Screen を選択します。
-
Consent Screen を設定するには、次の手順を実行します。
- Get Started を選択します。
- App name と User support email を入力します。
- Audience Type で Internal を選びます。この Audience Type は認可リクエストを Google Workspace 内のユーザーに限定し、通常の Gmail アドレスのユーザーをブロックします。
- Contact Information を入力します。Google Cloud Platform では、アカウント内のメールアドレスが必要です。
- Google のユーザーデータポリシーに同意し、Continue を選択します。
- Create を選択します。
-
OAuth の概要ページが読み込まれます。Create OAuth Client を選択します。
-
Application type で Web application を選び、OAuth Client ID に名前を付けます。
-
Authorized JavaScript origins の URIs 欄に、チームドメインを入力します。
https://<your-team-name>.cloudflareaccess.comチーム名は、Cloudflare ダッシュボード ↗ の Settings > Team name and domain > Team name で確認できます。
-
Authorized redirect URIs の URIs 欄に、次の URL を入力します。
https://<your-team-name>.cloudflareaccess.com/cdn-cgi/access/callback -
OAuth クライアントを作成したら、作成した OAuth クライアントを選択します。Google が OAuth Client ID と Client secret を表示します。Client secret はパスワードと同様に扱い、共有しないでください。OAuth Client ID と Client secret の両方をコピーします。
-
Google Admin console ↗ で Security > Access and data control > API controls を開きます。
-
API Controls で Settings を選択します。
-
Internal apps を選択し、Trust internal apps のチェックボックスをオンにして有効にします。Trust internal apps はデフォルトで無効で、Cloudflare Access を正しく動作させるには有効にする必要があります。
-
Cloudflare ダッシュボード ↗ で Zero Trust > Integrations > Identity providers を開きます。
-
Add new identity provider を選択し、Google Workspace を選択します。
-
先ほど生成した Client ID(Cloudflare ダッシュボードでは App ID)と Client Secret を入力します。あわせて、Google Workspace アカウントのドメインも入力します。
-
(任意)Proof of Key Exchange(PKCE) ↗ を有効にします。すべてのログイン試行で PKCE が実行されます。
-
(任意)Optional configurations で、ユーザーの ID に追加する カスタム OIDC クレーム を入力します。
-
Save を選択します。セットアップを完了するには、生成されたリンクを開く必要があります。Google Workspace の管理者でない場合は、管理者にリンクを共有します。
-
生成されたリンクでは、Google 管理者アカウントへのログインと、Cloudflare Access にグループ情報の閲覧を許可することが求められます。権限を許可すると、Cloudflare Access の成功ページが表示されます。
接続を確認するには、Integrations > Identity providers を開き、Google Workspace の横の Test を選択します。ユーザー ID とグループ所属が返されます。
{
"config": {
"client_id": "<your client id>",
"client_secret": "<your client secret>",
"apps_domain": "mycompany.com"
},
"type": "google-apps",
"name": "my example idp"
}Google で OAuth クライアントを削除した(または OAuth クライアントの有効期限が切れた)場合、Error 401: deleted_client という認可エラーが表示されます。
この問題を解消するには、Google ガイドの手順 6 から 12 と、Google Workspace ガイドの手順 9 から 15 を完了します。