You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: _docs/integrations/oidc-pipelines.md
+56-21Lines changed: 56 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -48,7 +48,7 @@ Codefresh supports a subset of standard claims which are listed below. Generally
48
48
49
49
50
50
***audience (`aud`) claim**
51
-
The `aud` claim is the Client ID, which is the URL of the Codefresh platform instance.
51
+
The `aud` claim is the Client ID, which is by default the URL of the Codefresh platform instance. You can also configure a custom audience as a single-value string, or a list of custom audiences as an array of strings. See examples in [Step 3: Obtain OIDC ID token from OIDC provider](#step-3-obtain-oidc-id-token-from-oidc-provider).
52
52
***subject (`sub`) claim**
53
53
The `sub` claim is a string value concatenated from the different claims representing the precise authentication and authorization required for access.
54
54
***issuer (`iss`) claim**
@@ -145,19 +145,26 @@ The first step is to integrate Codefresh as an OIDC identity provider in the clo
145
145
Make sure you define the following settings:
146
146
147
147
1.**Provider type**: OIDC
148
-
1.**Provider URL**: The URL of the OIDC provider's authorization server, which is the Codefresh OIDC domain, `https//oidc.codefresh.io`. <!--- You can configure one provider URL -->
149
-
1.**Client ID**: The URL of the Codefresh platform. For SaaS, `https://g.codefresh.io`.
150
-
For on-premises, this is the URL of your Codefresh instance, for example, `https://<my.company.com>/codefresh.io`.
148
+
1.**Provider URL**: The URL of the OIDC provider's authorization server, which is the Codefresh OIDC domain:
149
+
* For SaaS customers this would be `https//oidc.codefresh.io`.
150
+
* For on-premises customers, this would be your on-premises instance of Codefresh, for example, `https//oidc.<my.company.com>/codefresh`.
151
+
1.**Client ID**: The URL of the Codefresh platform:
152
+
* For SaaS customers this would be `https://g.codefresh.io`.
153
+
* For on-premises customers, this would be the URL of your Codefresh instance, for example, `https://<my.company.com>/codefresh`.
154
+
>**NOTE**:
155
+
The Client ID must align with the value set for `audience`. The provided URLs are valid for the default audience.
156
+
For custom audiences, ensure that the Client ID corresponds to the specific custom audience you've configured.
151
157
152
158
153
-
### Step 2: Create trust and configure claims for Codefresh OIDC identity provider
159
+
### Step 2: Create trust for Codefresh OIDC identity provider
154
160
155
161
Once you've added Codefresh as an OIDC provider, the next step is to establish trust between your cloud provider and the OIDC provider, Codefresh in our case.
156
162
157
163
To create trust, define the claims, and configure the conditions for each claim.
158
164
159
165
* For Codefresh pipelines, the claims depend on the type of trigger.
160
-
* The syntax to create the `sub` claim is similar for all identity providers, and is a concatenation of different claims, separated by colons. These generally include the account, pipeline, initiator, and for Git triggers, SCM (Source Code Management) data such as the repo URL or branch, and for PRs, the target branch to merge to.
166
+
* The `sub` claim is a concatenation of different properties that encapsulate essential metadata on the authenticated entity.
167
+
These properties include the account, pipeline, workflow, and if the workflow was triggered by a Git webhook or manually. Git triggers include also SCM (Source Code Management) data such as the repo URL or branch, and for PRs, the target branch to merge to.
161
168
162
169
See [Custom Codefresh claims](#custom-codefresh-claims) and [Codefresh trigger types for Subject claims](#codefresh-trigger-types-for-subject-claims) in this article.
163
170
@@ -174,7 +181,6 @@ You can move on to the Codefresh platform to obtain and use the OIDC ID token in
174
181
Obtain the ID token from the Codefresh OIDC provider to authenticate and authorize pipeline actions. Codefresh makes this simple by offering a dedicated Marketplace step, the `obtain-oidc-id-token` step, which you can seamlessly add to your pipeline, without the need for additional configuration or parameters on your part.
175
182
176
183
177
-
178
184
{% include
179
185
image.html
180
186
lightbox="true"
@@ -191,19 +197,18 @@ max-width="60%"
191
197
192
198
The step:
193
199
194
-
1. Makes an API call to the Codefresh OIDC provider passing the `CF_OIDC_REQUEST_TOKEN` and the `CF_OIDC_REQUEST_URL` variables.
195
-
196
-
>**NOTE**:
197
-
Codefresh injects these two variables for every pipeline build, ensuring their availability for use, regardless of the cloud provider's authentication mechanism, whether it's OIDC ID tokens or static credentials.
198
-
199
-
200
+
1. Makes an API call to the Codefresh OIDC provider passing the `CF_OIDC_REQUEST_TOKEN` and the `CF_OIDC_REQUEST_URL` variables.
* `CF_OIDC_REQUEST_TOKEN` is an access token used to request the OIDC ID token for the OIDC provider.
204
-
* `CF_OIDC_REQUEST_URL` is the URL from which to request the ID token.
204
+
*`CF_OIDC_REQUEST_TOKEN` is an access token used to request the OIDC ID token for the OIDC provider.
205
+
*`CF_OIDC_REQUEST_URL` is the URL from which to request the ID token.
205
206
206
-
You can also insert the `curl` command as an API call in a freestyle step to get the same result.
207
+
You can also insert the `curl` command as an API call in a `freestyle` step to get the same result.
208
+
209
+
>**NOTE**:
210
+
Codefresh injects these two variables into every pipeline build, ensuring their availability for use in steps.
211
+
207
212
208
213
{:start="2"}
209
214
1. Sets the ID token in the `ID_TOKEN` environment variable.
@@ -230,6 +235,36 @@ steps:
230
235
type: obtain-oidc-id-token
231
236
```
232
237
238
+
239
+
<br>
240
+
241
+
**Custom audiences with the `obtain-oidc-id-token` step**
242
+
243
+
Instead of using the default audience which is the Codefresh platform URL, you can pass single or multiple custom audiences in the `obtain-oidc-id-token` step.
244
+
245
+
Here are examples of single and multiple audiences in the `obtain-oidc-id-token` step.
246
+
247
+
* Single custom audience
248
+
```yaml
249
+
obtain_id_token:
250
+
title: Obtain ID Token
251
+
type: obtain-oidc-id-token
252
+
arguments:
253
+
AUDIENCE: "cosign"
254
+
```
255
+
256
+
* Multiple custom audiences
257
+
```yaml
258
+
obtain_id_token:
259
+
title: Obtain ID Token
260
+
type: obtain-oidc-id-token
261
+
arguments:
262
+
AUDIENCE: "cosign,acme,custom"
263
+
```
264
+
265
+
If you are using an API call in a `freestyle` step, you can pass the custom audience as a query parameter after `$CF_OIDC_REQUEST_URL`, for example, `"$CF_OIDC_REQUEST_URL?audience=cosign"`.
### Step 4: Add steps to perform actions in the cloud provider
234
269
Add steps to the pipeline YAML to perform the required actions in the cloud provider. The specific steps required depend on the cloud provider you choose.
235
270
@@ -260,9 +295,12 @@ max-width="50%"
260
295
1. In the Add an Identity Provider form, do the following:
261
296
1. Select Provider type as **OpenID Connect**.
262
297
1. Enter a meaningful name for the Provider.
263
-
1. In the **Provider URL** field, enter the client ID for Codefresh:
298
+
1. In the **Provider URL** field, enter the client ID for Codefresh:
264
299
For SaaS customers, this is `https://g.codefresh.io`.
265
-
For on-premises customers, this is the URL of their Codefresh instance.
300
+
For on-premises, this is the URL of their codefresh instance.
301
+
>**NOTE**:
302
+
The Client ID must align with the value set for `audience`. The provided URLs are valid for the default audience.
303
+
For custom audiences, ensure that the Client ID corresponds to the specific custom audience you've configured.
266
304
1. Click **Add provider**.
267
305
268
306
{% include
@@ -446,9 +484,6 @@ assume_role:
446
484
- aws s3 ls "s3://$BUCKET_NAME/"
447
485
```
448
486
>**NOTE:**
449
-
450
-
451
-
452
487
The cloud provider uses the ID token to authenticate the request to assume the role, after which the pipeline’s build performs the permitted action for the role, such as listing the objects in the S3 bucket.
0 commit comments