Test Authentication
In the previous section you deployed an AuthPolicy that locks down the LLM endpoint. Here is how the customer profile analysis capability fits into the architecture, and where the AuthPolicy acts:
flowchart LR
Agent <--> RC
RC <--> Integration
subgraph Integration ["⚙️ Agentic Integration "]
Steps["<div style='text-align:left'>① AI reasoning<br/>② Tool calling</div>"]
end
subgraph ProfileLabel ["🔧 Customer Profile Tool "]
subgraph ProfileInner [" "]
direction LR
DB -->|customer<br/>data| ProfileAgent
end
end
subgraph ModelLabel [" "]
Model
end
Integration <-->|①| Model
Integration <-->|②| ProfileInner
ProfileAgent --> Gateway --> ProfileModel
Agent@{ img: "../../_images/module-03/common/agent-icon.svg", label: "Support Agent", pos: "b", h: 80, w: 80, constraint: "on" }
RC@{ img: "../../_images/module-03/m4/rocketchat-icon.svg", label: "Rocket.Chat", pos: "b", h: 80, w: 80, constraint: "on" }
Model@{ img: "../../_images/module-03/common/ai-model-icon.svg", label: "AI Model", pos: "b", h: 80, w: 80, constraint: "on" }
ProfileModel@{ img: "../../_images/module-03/common/ai-model-icon.svg", label: "LLM", pos: "b", h: 80, w: 80, constraint: "on" }
DB@{ img: "../../_images/module-03/common/database-icon.svg", label: "System Stores", pos: "b", h: 70, w: 70, constraint: "on" }
ProfileAgent@{ img: "../../_images/module-03/common/ai-icon.svg", label: "AI Agent", pos: "b", h: 80, w: 80, constraint: "on" }
Gateway@{ img: "../../_images/module-03/common/guardrail-icon.svg", label: "AuthPolicy", pos: "b", h: 80, w: 80, constraint: "on" }
style Agent fill:none,stroke:none
style RC fill:none,stroke:none
style Model fill:none,stroke:none
style ProfileModel fill:none,stroke:none
style DB fill:none,stroke:none
style ProfileAgent fill:none,stroke:none
style Gateway fill:none,stroke:none
style Integration fill:none,stroke:none,color:#EE0000,font-weight:bold
style Steps fill:#fce4e4,stroke:#EE0000,color:#333
style ModelLabel fill:none,stroke:none
style ProfileLabel fill:none,stroke:none,color:#EE0000,font-weight:bold
style ProfileInner fill:#fce4e4,stroke:#EE0000
|
The integration uses two separate AI models:
In this exercise, the AuthPolicy |
Test Without an API Key
The AuthPolicy you deployed doesn’t just block or allow — it distinguishes between service tiers. Here is how the Customer Profile Tool routes requests through the gateway:
flowchart LR
AGT5 <--> AI5
AI5 <--> |🥇 Gold key<br>🥈 Silver key|GW
GW --- GWp
GWp[" "] --> GP
GWp --> SP
AGT5@{ img: "../../_images/module-03/common/agent-icon.svg", label: "Support Agent", pos: "b", h: 80, w: 80, constraint: "on" }
AI5@{ img: "../../_images/module-03/common/ai-icon.svg", label: "AI Assistant", pos: "b", h: 80, w: 80, constraint: "on" }
GP@{ img: "../../_images/module-03/common/profile-icon.svg", label: "Gold Profile", pos: "b", h: 80, w: 70, constraint: "on" }
SP@{ img: "../../_images/module-03/common/profile-silver-icon.svg", label: "Silver Profile", pos: "b", h: 80, w: 70, constraint: "on" }
style AGT5 fill:none,stroke:none
style AI5 fill:none,stroke:none
GW@{ img: "../../_images/module-03/common/guardrail-icon.svg", label: "Connectivity Link", pos: "b", h: 80, w: 80, constraint: "on" }
style GW fill:none,stroke:none
style GWp fill:none,stroke:none,width:1px,height:1px
style GP fill:none,stroke:none
style SP fill:none,stroke:none
Both Gold and Silver profiles are generated by the same LLM. The AuthPolicy validates the API key presented in each request to determine which tier of service to provide.
This is reflected in the application.properties file — two agent definitions pointing to the same endpoint, each with its own API key:
# Gold agent - model configuration
forage.profile-gold.agent.model.kind=openai
forage.profile-gold.agent.model.name=qwen3-14b
forage.profile-gold.agent.base.url=http://internal-ai-gateway-openshift-default.ai-gateway.svc.cluster.local/username/v1
forage.profile-gold.agent.api.key=EMPTY
# Silver agent - model configuration
forage.profile-silver.agent.model.kind=openai
forage.profile-silver.agent.model.name=qwen3-14b
forage.profile-silver.agent.base.url=http://internal-ai-gateway-openshift-default.ai-gateway.svc.cluster.local/username/v1
forage.profile-silver.agent.api.key=EMPTY
Right now both keys are EMPTY. Any request that triggers the Customer Profile Tool will be rejected at the gateway.
Let’s confirm this by requesting a customer profile analysis.
-
Run the camel agent application
What does this command do?
-
camel run *— runs all Camel route files in the current directory -
--local-kamelet-dir ../support/kamelets— loads custom Kamelets (connectors) from the support folder
(includes Rocket.Chat connector)
-
-
Switch to your Rocket.Chat window.
If you haven’t logged in yet, follow the Rocket.Chat platform onboarding instructions (opens in a new tab). -
In the left sidebar, find and select the
ai-supportchannel that matches your user identifier:A ⌗ ai-support -
Send the following message in the chat. Since the API key is empty, the AuthPolicy should reject the request:
-
The AI assistant should respond with a SERVICE NOTICE showing a
401 Unauthorizedstatus. This confirms the AuthPolicy is blocking the request because no valid API key was presented.rocket.chatUusername 6:49 PMPlease, generate a customer profile for order 61356291Aai-bot 6:49 PM
⚠️ SERVICE NOTICE
📡 System Insight- Status: 401 Unauthorized
- Action: Authentication failed due to invalid or missing API Key.
- Notice: Please verify your API key and try again.
Test with Valid API Keys
Now that you’ve confirmed unauthenticated requests are rejected, let’s configure both API keys so the Customer Profile Tool can reach the LLM.
-
Stop the agent by pressing CTRL+C in the terminal
-
Run the (⏩ Fast-Forward) command to auto-configure both API keys:
This populates the Gold and Silver API keys in
application.propertieswith valid values from the cluster secrets.Lab navigation commands
The workshop provides a set of helper commands to navigate the lab:
-
ff— fast-forward to the next step (auto-configures what’s needed) -
rw— rewind to the previous step -
step N— jump to a specific step -
steps— list all available steps -
startorrestart— reset to the beginning
-
-
Open
application.propertiesand verify that the API keys are now populated. 1 the Gold key and 2 the Silver key should no longer beEMPTY— each should contain a valid API key value.# Gold agent - model configuration forage.profile-gold.agent.model.kind=openai forage.profile-gold.agent.model.name=qwen3-14b forage.profile-gold.agent.base.url=http://internal-ai-gateway-openshift-default.ai-gateway.svc.cluster.local/username/v1 forage.profile-gold.agent.api.key= # Silver agent - model configuration forage.profile-silver.agent.model.kind=openai forage.profile-silver.agent.model.name=qwen3-14b forage.profile-silver.agent.base.url=http://internal-ai-gateway-openshift-default.ai-gateway.svc.cluster.local/username/v1 forage.profile-silver.agent.api.key= -
Restart the agent:
What does this command do?
-
camel run *— runs all Camel route files in the current directory -
--local-kamelet-dir ../support/kamelets— loads custom Kamelets (connectors) from the support folder
(includes Rocket.Chat connector)
-
-
Go back to Rocket.Chat and send the same request again:
The order number in this request is illustrative — the Customer Profile Tool uses simulated input data from JSON files in the data/folder of your project. You can explore these files in the source code to see the mock CRM, history, audit, and ticket data that feeds the analysis. -
This time the request should succeed. With both keys configured, the system defaults to Gold — the richer of the two analysis tiers. You should see a GOLD TIER ANALYSIS with a full customer profile, similar to:
rocket.chatAai-bot 6:49 PM
🏅 GOLD TIER ANALYSIS
📊 Customer Profile- Alex Morgan, Gold, 1.5 years
- $1,234.08 annual premium ($102.84/mo), policy active since June 2025
🔍 Sentiment & Risk- Positive sentiment overall, with one Negative interaction
- Low retention risk, with active engagement and resolution of issues
📋 Open Issues- TKT-1025: Policy amendment — Roadside Assistance removed (Policy 61356291), pending premium adjustment and refund for current billing cycle
💡 Recommended ActionFollow up with Alex Morgan to confirm the Roadside Assistance removal and process the premium refund for the current billing cycle.
| Because LLM responses are non-deterministic, the exact wording may differ from the sample above. What matters is the GOLD TIER ANALYSIS banner and the four sections: Customer Profile, Sentiment & Risk, Open Issues, and Recommended Action. |
At this point, authentication is enforced. Both Gold and Silver keys are configured, and the AuthPolicy validates them before allowing access to the LLM. In the next exercise, you’ll discover how the gateway controls how much each tier can consume, and what happens when a tier reaches its limit.