Resources

OpenShift Credentials

  • username: username
  • password: user-password

Dev Spaces

Developer Console

Matrix

Rocket.Chat

BGCreated with Sketch.

Tasks to complete

Get Started
BGCreated with Sketch.

Congratulations!

Return to the dashboard to continue your journey.

Go to home

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 guardrail icon acts:

flowchart LR
    Agent <--> RC
    RC <--> Integration

    subgraph Integration ["⚙️ Agentic Integration&nbsp;"]
        Steps["<div style='text-align:left'>① AI reasoning<br/>② Tool calling</div>"]
    end

    subgraph ProfileLabel ["🔧 Customer Profile Tool&nbsp;&nbsp;"]
        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

auth-diagram

{x: 54, y: 5} {x: 96.2, y: 55}

The integration uses two separate AI models:

  • 1 AI Model — provides reasoning and invokes tools.

  • 2 LLM — powers the Customer Profile Tool for generating customer analyses.

In this exercise, the AuthPolicy guardrail icon you deployed applies only to the second model, leaving the main reasoning model unaffected.


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

config-snippet

{x: 32.2, y: 42, rot: -80}
{x: 34, y: 88, rot: -80}

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.

  1. Run the camel agent application

    camel run * --local-kamelet-dir ../support/kamelets

    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)


  2. 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).


  3. In the left sidebar, find and select the ai-support channel that matches your user identifier:

    A ⌗ ai-support


  4. Send the following message in the chat. Since the API key is empty, the AuthPolicy should reject the request:

    Please, generate a customer profile for order 61356291


  5. The AI assistant should respond with a SERVICE NOTICE showing a 401 Unauthorized status. This confirms the AuthPolicy is blocking the request because no valid API key was presented.

    rocket.chat
    U
    username 6:49 PM
    Please, generate a customer profile for order 61356291
    A
    ai-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.


  1. Stop the agent by pressing CTRL+C in the terminal


  2. Run the (⏩ Fast-Forward) command to auto-configure both API keys:

    ff

    This populates the Gold and Silver API keys in application.properties with 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

    • start or restart — reset to the beginning


  3. Open application.properties and verify that the API keys are now populated. 1 the Gold key and 2 the Silver key should no longer be EMPTY — 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=

    config-snippet-2

    {x: 30.5, y: 42.8} {x: 32.1, y: 88.2}


  4. Restart the agent:

    camel run * --local-kamelet-dir ../support/kamelets

    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)


  5. Go back to Rocket.Chat and send the same request again:

    Please, generate a customer profile for order 61356291

    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.


  6. 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.chat
    A
    ai-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 Action
    Follow 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.


Did you see a 401 error with empty keys, and a Gold Tier Analysis after configuring valid keys?

The AuthPolicy is working as expected — unauthenticated requests are blocked and valid keys produce a customer profile.

Check that both API keys in application.properties are populated (not EMPTY) and that the camel agent restarted successfully.