|
| 1 | +## IAM Domain Configuration Steps |
| 2 | + |
| 3 | +### Make sure client access is enabled for JWK's URL |
| 4 | + |
| 5 | +1. Login to OCI console (https://cloud.oracle.com for OCI commercial cloud). |
| 6 | +2. From "Identity & Security" menu, open Domains page. |
| 7 | +3. On the Domains list page, select the domain that you are using for MCP Authentication. |
| 8 | +4. Open Settings tab. |
| 9 | +5. Click on "Edit Domain Settings" button. |
| 10 | + |
| 11 | + |
| 12 | + |
| 13 | +6. Enable "Configure client access" checkbox as show in the screenshot. |
| 14 | + |
| 15 | + |
| 16 | + |
| 17 | +### Create OAuth client for MCP server authentication |
| 18 | + |
| 19 | +1. Login to OCI console (https://cloud.oracle.com for OCI commercial cloud). |
| 20 | +2. From "Identity & Security" menu, open Domains page. |
| 21 | +3. On the Domains list page, select the domain in which you want to create MCP server OAuth client. If you need help finding the list page for the domain, see [Listing Identity Domains.](https://docs.oracle.com/en-us/iaas/Content/Identity/domains/to-view-identity-domains.htm#view-identity-domains). |
| 22 | +4. On the details page, select Integrated applications. A list of applications in the domain is displayed. |
| 23 | +5. Select Add application. |
| 24 | +6. In the Add application window, select Confidential Application. |
| 25 | +7. Select Launch workflow. |
| 26 | +8. In the Add application details page, Enter name and description as shown below. |
| 27 | + |
| 28 | + |
| 29 | + |
| 30 | +9. Once the Integrated Application is created, Click on "OAuth configuration" tab. |
| 31 | +10. Click on "Edit OAuth configuration" button. |
| 32 | +11. Configure the application as OAuth client by selecting "Configure this application as a client now" radio button. |
| 33 | +12. Select "Authorization code" grant type. If you are planning to use the same OAuth client application for token exchange, select "Client credentials" grant type as well. In the sample, we will use the same client. |
| 34 | +13. For Authorization grant type, select redirect URL. This is, in most cases, will be MCP server URL followed by "/oauth/callback". |
| 35 | + |
| 36 | + |
| 37 | + |
| 38 | +14. Click on "Submit" button to update OAuth configuration for the client application. |
| 39 | +**Note: You don't need to do any special configuration to support PKCE for the OAuth client.** |
| 40 | +15. Make sure to Activate the client application. |
| 41 | +16. Note down client ID and client secret for the application. Update .env file and replace IAM_CLIENT_ID and IAM_CLIENT_SECRET values. |
| 42 | +17. IAM_DOMAIN in the env file is the Identity domain URL that you chose for the MCP server. |
| 43 | + |
| 44 | +### Token Exchange Setup (Only if MCP server needs to talk to OCI Control Plane) |
| 45 | + |
| 46 | +Token exchange helps you exchange a logged-in user's OCI IAM token for an OCI control plane session token, also known as UPST (User Principal Session Token). To learn more about token exchange, refer to my [Workload Identity Federation Blog](https://www.ateam-oracle.com/post/workload-identity-federation) |
| 47 | + |
| 48 | +For token exchange, we need to configure Identity propagation trust. The blog above discusses setting up the trust using REST APIs. However, you can also use OCI CLI. Before using the CLI command below, ensure that you have created a token exchange OAuth client. In most cases, you can use the same OAuth client that you created above. |
| 49 | + |
| 50 | +```bash |
| 51 | +oci identity-domains identity-propagation-trust create \ |
| 52 | +--schemas '["urn:ietf:params:scim:schemas:oracle:idcs:IdentityPropagationTrust"]' \ |
| 53 | +--public-key-endpoint "https://${IDCS_DOMAIN}/admin/v1/SigningCert/jwk" \ |
| 54 | +--name "For Token Exchange" --type "JWT" \ |
| 55 | +--issuer "https://identity.oraclecloud.com/" --active true \ |
| 56 | +--endpoint "https://${IDCS_DOMAIN}" \ |
| 57 | +--subject-claim-name "sub" --allow-impersonation false \ |
| 58 | +--subject-mapping-attribute "username" \ |
| 59 | +--subject-type "User" --client-claim-name "iss" \ |
| 60 | +--client-claim-values '["https://identity.oraclecloud.com/"]' \ |
| 61 | +--oauth-clients '["{IDCS_CLIENT_ID}"]' |
| 62 | +``` |
0 commit comments