Skip to content

Commit 061f4eb

Browse files
committed
generic oidc examples
1 parent dec57e9 commit 061f4eb

File tree

1 file changed

+78
-27
lines changed

1 file changed

+78
-27
lines changed

src/content/docs/cloudflare-one/identity/idp-integration/generic-oidc.mdx

Lines changed: 78 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ sidebar:
55
order: 1
66
---
77

8-
import { Render } from "~/components";
8+
import { Tabs, TabItem, Render } from '~/components';
99

1010
Cloudflare Access has a generic OpenID Connect (OIDC) connector to help you integrate IdPs not already set in Access.
1111

12-
## Set up a generic OIDC
12+
## 1. Create an application in your identity provider
1313

1414
1. Visit your identity provider and create a client/app.
1515

@@ -31,21 +31,89 @@ Cloudflare Access has a generic OpenID Connect (OIDC) connector to help you inte
3131

3232
You can find these values on your identity provider's **OIDC discovery endpoint**. Some providers call this the "well-known URL".
3333

34-
4. In [Zero Trust](https://one.dash.cloudflare.com), go to **Settings** > **Authentication**.
34+
## 2. Add an OIDC provider to Zero Trust
3535

36-
5. Under **Login methods**, select **Add new**.
3736

38-
6. Choose **OpenID Connect**..
37+
<Tabs syncKey="dashPlusAPI"> <TabItem label="Dashboard">
3938

40-
7. Name your identity provider and fill in the required fields with the information obtained in Step 3.
4139

42-
8. (Optional) Enable [Proof of Key Exchange (PKCE)](https://www.oauth.com/oauth2-servers/pkce/) if the protocol is supported by your IdP. PKCE will be performed on all login attempts.
40+
1. In [Zero Trust](https://one.dash.cloudflare.com), go to **Settings** > **Authentication**.
4341

44-
9. (Optional) To enable SCIM, refer to [Synchronize users and groups](#synchronize-users-and-groups).
42+
2. Under **Login methods**, select **Add new**.
4543

46-
10. (Optional) Under **Optional configurations**, enter [custom OIDC claims](#oidc-claims) that you wish to add to users' identity. This information will be available in the [user identity endpoint](/cloudflare-one/identity/authorization-cookie/application-token/#user-identity).
44+
6. Choose **OpenID Connect**..
4745

48-
11. Select **Save**.
46+
3. Name your identity provider and fill in the required fields with the information obtained in Step 3.
47+
48+
4. (Optional) Enable [Proof of Key Exchange (PKCE)](https://www.oauth.com/oauth2-servers/pkce/) if the protocol is supported by your IdP. PKCE will be performed on all login attempts.
49+
50+
5. (Optional) To enable SCIM, refer to [Synchronize users and groups](#synchronize-users-and-groups).
51+
52+
6. (Optional) Under **Optional configurations**, enter [custom OIDC claims](#oidc-claims) that you wish to add to users' identity. This information will be available in the [user identity endpoint](/cloudflare-one/identity/authorization-cookie/application-token/#user-identity).
53+
54+
7. Select **Save**.
55+
56+
</TabItem> <TabItem label="API">
57+
58+
1. [Create an API token](/fundamentals/api/get-started/create-token/) with the following permissions:
59+
| Type | Item | Permission |
60+
| ------- | ---------------- | ---------- |
61+
| Account | Access: Organizations, Identity Providers, and Groups | Edit |
62+
63+
2. Make a `POST` request to the [Identity Providers](/api/resources/zero_trust/subresources/identity_providers/methods/create/) endpoint:
64+
65+
```sh
66+
curl https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/access/identity_providers \
67+
--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
68+
--data '{
69+
"name": "Generic OIDC example",
70+
"type": "oidc",
71+
"config": {
72+
"client_id": "<your client id>",
73+
"client_secret": "<your client secret>",
74+
"auth_url": "https://accounts.google.com/o/oauth2/auth",
75+
"token_url": "https://accounts.google.com/o/oauth2/token",
76+
"certs_url": "https://www.googleapis.com/oauth2/v3/certs",
77+
"pkce_enabled": false,
78+
"email_claim_name": "email",
79+
"claims": ["employeeID", "groups"],
80+
"scopes": ["openid", "email", "profile"]
81+
}
82+
}'
83+
```
84+
85+
</TabItem> <TabItem label="Terraform (v4)">
86+
87+
:::note[Provider versions]
88+
The following example requires Cloudflare provider version `>=4.40.0`.
89+
:::
90+
91+
1. Add the following permission to your [`cloudflare_api_token`](https://registry.terraform.io/providers/cloudflare/cloudflare/4.40.0/docs/resources/api_token):
92+
- `Access: Organizations, Identity Providers, and Groups Write`
93+
94+
2. Configure the [`cloudflare_zero_trust_access_identity_provider`](https://registry.terraform.io/providers/cloudflare/cloudflare/4.40.0/docs/resources/zero_trust_access_identity_provider) resource:
95+
96+
```tf
97+
resource "cloudflare_zero_trust_access_identity_provider" "generic_oidc_example" {
98+
account_id = var.cloudflare_account_id
99+
name = "Generic OIDC example"
100+
type = "oidc"
101+
config {
102+
client_id = "<your client id>"
103+
client_secret = "<your client secret>"
104+
auth_url = "https://accounts.google.com/o/oauth2/auth"
105+
token_url = "https://accounts.google.com/o/oauth2/token"
106+
certs_url = "https://www.googleapis.com/oauth2/v3/certs"
107+
pkce_enabled = false
108+
email_claim_name = "email"
109+
claims = ["employeeID", "groups"]
110+
scopes = ["openid", "email", "profile"]
111+
}
112+
}
113+
```
114+
</TabItem> </Tabs>
115+
116+
## 3. Test the connection
49117

50118
To test that your connection is working, go to **Authentication** > **Login methods** and select **Test** next to the login method you want to test. On success, a confirmation screen displays.
51119

@@ -92,23 +160,6 @@ Cloudflare Access extends support for multi-record OIDC claims. These claims are
92160

93161
Cloudflare Access does not support partial OIDC claim value references or OIDC scopes.
94162

95-
## Example API Configuration
96-
97-
```json
98-
{
99-
"config": {
100-
"client_id": "<your client id>",
101-
"client_secret": "<your client secret>",
102-
"auth_url": "https://accounts.google.com/o/oauth2/auth",
103-
"token_url": "https://accounts.google.com/o/oauth2/token",
104-
"certs_url": "https://www.googleapis.com/oauth2/v3/certs",
105-
"scopes": ["openid", "email", "profile"]
106-
},
107-
"type": "oidc",
108-
"name": "Generic Google"
109-
}
110-
```
111-
112163
## Supported algorithms for generic OIDC tokens
113164

114165
Cloudflare supports the following algorithms for verifying generic OIDC tokens:

0 commit comments

Comments
 (0)