<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Idcs on IAMDevBox</title><link>https://www.iamdevbox.com/tags/idcs/</link><description>Recent content in Idcs on IAMDevBox</description><image><title>IAMDevBox</title><url>https://www.iamdevbox.com/IAMDevBox.com.jpg</url><link>https://www.iamdevbox.com/IAMDevBox.com.jpg</link></image><generator>Hugo -- 0.146.0</generator><language>en-us</language><lastBuildDate>Fri, 07 Aug 2026 14:56:16 +0000</lastBuildDate><atom:link href="https://www.iamdevbox.com/tags/idcs/index.xml" rel="self" type="application/rss+xml"/><item><title>Protect APIs with API Gateway using IDCS/IAM JWT with Scopes and Claims</title><link>https://www.iamdevbox.com/posts/protect-apis-with-api-gateway-using-idcs-iam-jwt-with-scopes-and-claims/</link><pubDate>Fri, 07 Aug 2026 14:56:10 +0000</pubDate><guid>https://www.iamdevbox.com/posts/protect-apis-with-api-gateway-using-idcs-iam-jwt-with-scopes-and-claims/</guid><description>Learn how to protect APIs with API Gateway using IDCS/IAM JWT with scopes and claims. Complete guide with code examples and security tips.</description><content:encoded><![CDATA[<p>Protecting APIs with API Gateway using IDCS/IAM JWT with scopes and claims is crucial for maintaining security and controlling access to your services. This setup ensures that only authorized clients can access your APIs and that they have the appropriate permissions.</p>
<h2 id="what-is-api-gateway">What is API Gateway?</h2>
<p>API Gateway is a server that sits between clients and back-end services, routing requests and handling cross-cutting concerns like security, rate limiting, and monitoring. It acts as a single entry point for all clients, simplifying the management of API traffic and enhancing security.</p>
<h2 id="what-is-idcsiam">What is IDCS/IAM?</h2>
<p>Identity Cloud Service (IDCS) and Identity and Access Management (IAM) are Oracle&rsquo;s platforms for managing identities and access control. They provide features like authentication, authorization, and policy enforcement, which are essential for securing APIs.</p>
<h2 id="what-are-jwts-scopes-and-claims">What are JWTs, Scopes, and Claims?</h2>
<p>JSON Web Tokens (JWTs) are compact, URL-safe means of representing claims to be transferred between two parties. They are commonly used for authentication and information exchange. Scopes define the level of access granted to a client, while claims are pieces of information asserted about a subject, typically the user.</p>
<h2 id="quick-answer-implementing-jwt-with-scopes-and-claims-in-idcsiam">Quick Answer: Implementing JWT with Scopes and Claims in IDCS/IAM</h2>
<p>To implement JWT with scopes and claims in IDCS/IAM, follow these steps:</p>
<ol>
<li>Configure IDCS to issue JWT tokens with the required scopes and claims.</li>
<li>Set up the API Gateway to validate these JWT tokens.</li>
<li>Ensure that the API Gateway enforces the scopes and claims to control access to your APIs.</li>
</ol>
<h2 id="how-do-you-configure-idcs-to-issue-jwt-tokens-with-scopes-and-claims">How do you configure IDCS to issue JWT tokens with scopes and claims?</h2>
<p>Configuring IDCS to issue JWT tokens involves setting up applications, defining scopes, and configuring claims.</p>
<h3 id="step-by-step-guide">Step-by-step Guide</h3>
<h4 id="configure-the-client">Configure the client</h4>
<p>First, create an application in IDCS and configure it to issue JWT tokens.</p>
<div class="mermaid">

graph LR
    A[Create Application] --> B[Configure JWT Settings]
    B --> C[Define Scopes]
    C --> D[Configure Claims]

</div>

<ol>
<li>Log in to the IDCS console.</li>
<li>Navigate to Applications and create a new application.</li>
<li>In the JWT settings, enable JWT token issuance.</li>
<li>Define the scopes required for your application.</li>
<li>Configure the claims to include necessary user information.</li>
</ol>
<h4 id="request-the-token">Request the token</h4>
<p>Use the OAuth 2.0 client credentials flow to request a JWT token from IDCS.</p>
<div class="mermaid">

sequenceDiagram
    participant Client
    participant IDCS
    Client->>IDCS: Auth Request
    IDCS-->>Client: JWT Token

</div>

<p>Example request:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>curl -X POST <span style="color:#ae81ff">\
</span></span></span><span style="display:flex;"><span><span style="color:#ae81ff"></span>  https://idcs-tenant/oauth2/v1/token <span style="color:#ae81ff">\
</span></span></span><span style="display:flex;"><span><span style="color:#ae81ff"></span>  -H <span style="color:#e6db74">&#39;Content-Type: application/x-www-form-urlencoded&#39;</span> <span style="color:#ae81ff">\
</span></span></span><span style="display:flex;"><span><span style="color:#ae81ff"></span>  -d <span style="color:#e6db74">&#39;grant_type=client_credentials&amp;scope=read write&amp;client_id=your-client-id&amp;client_secret=your-client-secret&#39;</span>
</span></span></code></pre></div><h4 id="validate-the-response">Validate the response</h4>
<p>Check the response to ensure you receive a valid JWT token.</p>
<div class="terminal">
<div class="terminal-header">
<span class="terminal-dot red"></span>
<span class="terminal-dot yellow"></span>
<span class="terminal-dot green"></span>
<span class="terminal-title">Terminal</span>
</div>
<div class="terminal-body">
<span class="prompt">$</span> curl -X POST https://idcs-tenant/oauth2/v1/token -H 'Content-Type: application/x-www-form-urlencoded' -d 'grant_type=client_credentials&scope=read write&client_id=your-client-id&client_secret=your-client-secret'
<span class="output">{"access_token": "eyJ...", "token_type": "Bearer", "expires_in": 3600}</span>
</div>
</div>
<div class="key-takeaway">
<h4>🎯 Key Takeaways</h4>
<ul>
<li>Create an application in IDCS with JWT enabled.</li>
<li>Define necessary scopes and claims.</li>
<li>Request a JWT token using the client credentials flow.</li>
<li>Validate the token response.</li>
</ul>
</div>
<h2 id="how-do-you-set-up-the-api-gateway-to-validate-jwt-tokens">How do you set up the API Gateway to validate JWT tokens?</h2>
<p>Setting up the API Gateway to validate JWT tokens involves configuring policies and filters to enforce security.</p>
<h3 id="step-by-step-guide-1">Step-by-step Guide</h3>
<h4 id="configure-the-api-gateway">Configure the API Gateway</h4>
<p>Set up the API Gateway to accept and validate JWT tokens.</p>
<div class="mermaid">

graph LR
    A[Configure API Gateway] --> B[Add JWT Validation Policy]
    B --> C[Define Scope and Claim Validation Rules]
    C --> D[Test Configuration]

</div>

<ol>
<li>Log in to the API Gateway console.</li>
<li>Create a new API or select an existing one.</li>
<li>Add a JWT validation policy to the API.</li>
<li>Define rules to validate scopes and claims.</li>
<li>Test the configuration to ensure it works as expected.</li>
</ol>
<h4 id="example-jwt-validation-policy">Example JWT Validation Policy</h4>
<p>Here is an example of a JWT validation policy in YAML format:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-yaml" data-lang="yaml"><span style="display:flex;"><span><span style="color:#f92672">policies</span>:
</span></span><span style="display:flex;"><span>  - <span style="color:#f92672">name</span>: <span style="color:#ae81ff">jwt-validation</span>
</span></span><span style="display:flex;"><span>    <span style="color:#f92672">type</span>: <span style="color:#ae81ff">jwt-validation</span>
</span></span><span style="display:flex;"><span>    <span style="color:#f92672">properties</span>:
</span></span><span style="display:flex;"><span>      <span style="color:#f92672">issuer</span>: <span style="color:#ae81ff">https://idcs-tenant/oauth2/v1</span>
</span></span><span style="display:flex;"><span>      <span style="color:#f92672">audience</span>: <span style="color:#ae81ff">your-audience</span>
</span></span><span style="display:flex;"><span>      <span style="color:#f92672">scopes</span>:
</span></span><span style="display:flex;"><span>        - <span style="color:#ae81ff">read</span>
</span></span><span style="display:flex;"><span>        - <span style="color:#ae81ff">write</span>
</span></span><span style="display:flex;"><span>      <span style="color:#f92672">claims</span>:
</span></span><span style="display:flex;"><span>        - <span style="color:#f92672">name</span>: <span style="color:#ae81ff">user_role</span>
</span></span><span style="display:flex;"><span>          <span style="color:#f92672">value</span>: <span style="color:#ae81ff">admin</span>
</span></span></code></pre></div><div class="key-takeaway">
<h4>🎯 Key Takeaways</h4>
<ul>
<li>Configure the API Gateway to accept JWT tokens.</li>
<li>Add a JWT validation policy with scope and claim rules.</li>
<li>Test the configuration to ensure it works correctly.</li>
</ul>
</div>
<h2 id="how-do-you-enforce-scopes-and-claims-in-the-api-gateway">How do you enforce scopes and claims in the API Gateway?</h2>
<p>Enforcing scopes and claims ensures that only authorized clients can access your APIs and that they have the appropriate permissions.</p>
<h3 id="step-by-step-guide-2">Step-by-step Guide</h3>
<h4 id="define-access-control-rules">Define Access Control Rules</h4>
<p>Set up access control rules based on scopes and claims.</p>
<div class="mermaid">

graph LR
    A[Define Access Control Rules] --> B[Map Scopes to Permissions]
    B --> C[Map Claims to Roles]
    C --> D[Apply Rules in API Gateway]

</div>

<ol>
<li>Identify the scopes and claims required for each API endpoint.</li>
<li>Map scopes to permissions and claims to roles.</li>
<li>Apply these rules in the API Gateway configuration.</li>
</ol>
<h4 id="example-access-control-rules">Example Access Control Rules</h4>
<p>Here is an example of access control rules in YAML format:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-yaml" data-lang="yaml"><span style="display:flex;"><span><span style="color:#f92672">accessControl</span>:
</span></span><span style="display:flex;"><span>  <span style="color:#f92672">rules</span>:
</span></span><span style="display:flex;"><span>    - <span style="color:#f92672">path</span>: <span style="color:#ae81ff">/api/resource</span>
</span></span><span style="display:flex;"><span>      <span style="color:#f92672">methods</span>: [<span style="color:#ae81ff">GET, POST]</span>
</span></span><span style="display:flex;"><span>      <span style="color:#f92672">scopes</span>:
</span></span><span style="display:flex;"><span>        - <span style="color:#ae81ff">read</span>
</span></span><span style="display:flex;"><span>        - <span style="color:#ae81ff">write</span>
</span></span><span style="display:flex;"><span>      <span style="color:#f92672">claims</span>:
</span></span><span style="display:flex;"><span>        - <span style="color:#f92672">name</span>: <span style="color:#ae81ff">user_role</span>
</span></span><span style="display:flex;"><span>          <span style="color:#f92672">value</span>: <span style="color:#ae81ff">admin</span>
</span></span></code></pre></div><div class="key-takeaway">
<h4>🎯 Key Takeaways</h4>
<ul>
<li>Identify required scopes and claims for each API endpoint.</li>
<li>Map scopes to permissions and claims to roles.</li>
<li>Apply access control rules in the API Gateway.</li>
</ul>
</div>
<h2 id="security-considerations">Security Considerations</h2>
<h3 id="protecting-jwt-tokens">Protecting JWT Tokens</h3>
<p>Ensure that JWT tokens are protected by following these best practices:</p>
<ul>
<li>Use HTTPS to encrypt the communication between clients and the API Gateway.</li>
<li>Store JWT tokens securely and avoid exposing them in logs or client-side storage.</li>
<li>Regularly rotate the signing keys used to sign JWT tokens.</li>
</ul>
<div class="notice warning">⚠️ <strong>Warning:</strong> Never expose JWT tokens in client-side storage or logs. Use secure storage mechanisms.</div>
<h3 id="validating-jwt-tokens">Validating JWT Tokens</h3>
<p>Validate JWT tokens in the API Gateway to ensure their authenticity and integrity:</p>
<ul>
<li>Verify the signature of the JWT token using the public key provided by IDCS.</li>
<li>Check the expiration time (exp claim) to ensure the token is still valid.</li>
<li>Validate the issuer (iss claim) to ensure the token was issued by the correct authority.</li>
<li>Validate the audience (aud claim) to ensure the token is intended for your application.</li>
</ul>
<div class="notice info">💡 <strong>Key Point:</strong> Always verify the signature, expiration, issuer, and audience of JWT tokens.</div>
<h3 id="enforcing-scopes-and-claims">Enforcing Scopes and Claims</h3>
<p>Enforce scopes and claims to control access to your APIs:</p>
<ul>
<li>Ensure that the scopes included in the JWT token match the required permissions for the API endpoint.</li>
<li>Validate that the claims included in the JWT token meet the criteria defined in your access control rules.</li>
</ul>
<div class="notice danger">🚨 <strong>Security Alert:</strong> Failing to enforce scopes and claims can lead to unauthorized access to your APIs.</div>
<h2 id="troubleshooting-common-issues">Troubleshooting Common Issues</h2>
<h3 id="invalid-jwt-token">Invalid JWT Token</h3>
<p>If you encounter an invalid JWT token error, check the following:</p>
<ul>
<li>Ensure that the JWT token is correctly signed and not expired.</li>
<li>Verify that the issuer and audience claims match the expected values.</li>
<li>Check that the JWT token contains the required scopes and claims.</li>
</ul>
<div class="terminal">
<div class="terminal-header">
<span class="terminal-dot red"></span>
<span class="terminal-dot yellow"></span>
<span class="terminal-dot green"></span>
<span class="terminal-title">Terminal</span>
</div>
<div class="terminal-body">
<span class="prompt">$</span> curl -X GET https://api.example.com/resource -H 'Authorization: Bearer eyJ...'
<span class="output">{"error": "invalid_token", "message": "The token is expired"}</span>
</div>
</div>
<h3 id="access-denied">Access Denied</h3>
<p>If you encounter an access denied error, check the following:</p>
<ul>
<li>Ensure that the JWT token contains the required scopes and claims.</li>
<li>Verify that the access control rules in the API Gateway are correctly configured.</li>
<li>Check that the user has the necessary permissions to access the API endpoint.</li>
</ul>
<div class="terminal">
<div class="terminal-header">
<span class="terminal-dot red"></span>
<span class="terminal-dot yellow"></span>
<span class="terminal-dot green"></span>
<span class="terminal-title">Terminal</span>
</div>
<div class="terminal-body">
<span class="prompt">$</span> curl -X GET https://api.example.com/resource -H 'Authorization: Bearer eyJ...'
<span class="output">{"error": "access_denied", "message": "Insufficient scope"}</span>
</div>
</div>
<h2 id="best-practices">Best Practices</h2>
<h3 id="use-https">Use HTTPS</h3>
<p>Always use HTTPS to encrypt the communication between clients and the API Gateway.</p>
<div class="notice success">✅ <strong>Best Practice:</strong> Use HTTPS for all API communications.</div>
<h3 id="rotate-signing-keys">Rotate Signing Keys</h3>
<p>Regularly rotate the signing keys used to sign JWT tokens to prevent unauthorized access.</p>
<div class="notice tip">💜 <strong>Pro Tip:</strong> Automate key rotation to minimize downtime.</div>
<h3 id="monitor-api-usage">Monitor API Usage</h3>
<p>Monitor API usage to detect and respond to suspicious activity.</p>
<div class="notice info">💡 <strong>Key Point:</strong> Regular monitoring helps maintain the security and performance of your APIs.</div>
<h2 id="conclusion">Conclusion</h2>
<p>Protecting APIs with API Gateway using IDCS/IAM JWT with scopes and claims provides a robust and flexible security solution. By following the steps outlined in this guide, you can ensure that only authorized clients can access your APIs and that they have the appropriate permissions.</p>
<p>That&rsquo;s it. Simple, secure, works.</p>
]]></content:encoded></item></channel></rss>