Blog
  • AI Gateway
  • AI Security
  • AIOps
  • API Security
  • API Gateway
|
    • API Management
    • API Development
    • API Design
    • Automation
    • Service Mesh
    • Insomnia
    • View All Blogs
  1. Home
  2. Blog
  3. Engineering
  4. Setting Access Control Policies With Kong and Okta
Engineering
June 24, 2021
3 min read

Setting Access Control Policies With Kong and Okta

Claudio Acquaviva
Principal Architect, Kong

In our last Kong and Okta tutorial, we will implement a basic access control policy based on Okta’s groups and planes. This series will show you how to implement service authentication and authorization for Kong Konnect and Okta using the OpenID Connect (OIDC) plugin. Parts 1, 2 and 3 covered:

  1. Implementing client credentials flow for application authentication
  2. Authorization code for user authentication
  3. Implementing introspection flow for token validation

How Access Control Policy Works

OIDC claims are a piece of information inserted about an entity. Name and picture are claim examples for users.

OIDC scopes are a group of claims.

In this tutorial, we'll define a new claim based on an Okta group. The claim will be included in all scopes defined. The OIDC plugin must check if the coming tokens have this specific claim to allow the Kong route consumption. Only users who are part of the Okta group will have the claim included in the token and will be able to consume the route.

Okta and Kong Konnect Access Control Policies Architecture

Configure Okta

In my example, I already created two users and a group. The group has only one member.

Okta People


The new claim will be based on this group, so only its members will have permission to go through the Kong route.

Okta Kong Group

The new Kong claim definition is based on the Kong group. It'll be included in any scope for each access token issued.

Okta Edit Claim Access Token

Let’s run a token preview to check the tokens and claim out. For the first request, we can try the user who’s not a Kong group member. As expected, the access token does not have a Kong claim inside of it.

Okta Preview Token Claim


If we try the other user that belongs to the Kong group, the access token will be different. Here’s the Kong claim inside our token.

Okta Preview Token with Kong

Enable OpenID Connect Plugin

Let’s check our Kong route with the OIDC plugin enabled. According to the parameters in the screenshot below, the plugin should check if the token has the Kong claim defined by Okta. So in this sense, the route should be consumed only by users who are members of the Kong group.

The new settings should be:

  • Config.Scope Claim kong_claim
  • Config.Scopes Requiredkong_group

Okta and Kong OpenID Connect Claims and Scopes

Consume the Kong Route

Let's have both users consume the route. The process will be similar to what we already did in Okta’s token preview process. For the first request, let's try the user who isn't in the Kong group. As expected, we shouldn’t be able to consume the route.

We are trying to consume the route, but since we don’t have any token injected inside our request, the API gateway redirects us to Okta to present our credentials.

Okta Sign In

And after getting authenticated, Okta is redirecting us back to the API gateway. However, since the token doesn’t have the claim inside it, the gateway says "forbidden" and won’t allow us to consume the route.

Let’s try the other user who is a member of the Kong group. Again, we try to consume the route, getting redirected to Okta, but we’re going to use the second user this time.

Okta Sign In

After getting authenticated, Okta redirects us back to the API gateway. This time, our token has the Kong claim we defined in Okta previously.

Okta and Kong Claim

If we go to jwt.io, we will decode the JWT token and check the token and the claim inside it.

Okta and Kong Konnect JWT OIDC

Protect Your Applications With Kong Konnect and Okta

Start a free trial, or contact us if you have any questions as you're getting set up.

Once you've set up Konnect and Okta access control policies, you may find these other tutorials helpful:

  • Automating Your Developer Pipeline With APIOps (DevOps + GitOps)
  • Service Design Guidelines Part 2: API Versioning
  • "Gateway Mode" in Kuma and Kong Mesh

API SecurityAPI AuthenticationAPI Authorization

More on this topic

Videos

Federated Data Authorization using Semantic Policies

Videos

Okta and Kong: Integrate Identity into your APIs

See Kong in action

Accelerate deployments, reduce vulnerabilities, and gain real-time visibility. 

Get a Demo
Topics
API SecurityAPI AuthenticationAPI Authorization
Share on Social
Claudio Acquaviva
Principal Architect, Kong

Recommended posts

How to Implement Secure Access Control with OPA and Kong Gateway

Kong Logo
EngineeringJanuary 8, 2025

Ensuring secure access to applications and APIs is critical. As organizations increasingly adopt microservices architectures and cloud native solutions, the need for robust, fine-grained access control mechanisms becomes paramount. This is where the

Raja Ravi Varman

Adopt a Zero Trust Approach with OAuth 2.0 Mutual TLS Client Authentication

Kong Logo
EngineeringFebruary 19, 2024

In the modern IT stack, API gateways act as the first line of defense against attacks on backend services by enforcing authentication/authorization policies and validating and transforming requests. When backend services are protected with a token-b

Samuele Illuminati

Understanding Microsegmentation in Zero Trust Security

Kong Logo
EngineeringFebruary 6, 2024

With digital transformation shifting networks into the cloud — from remote workforces to online banking — cyberattacks are growing more prevalent and sophisticated. Legacy security models like VPNs and perimeter-based firewalls are proving inadequat

Kong

Top GraphQL Security Vulnerabilities: Lessons Learned Analyzing 1,500+ Endpoints

Kong Logo
EngineeringJanuary 29, 2024

With its flexible querying capabilities,  GraphQL  makes it easy to combine data from multiple sources into a single endpoint.  GraphQL and API management  go hand in hand to build next-generation API platforms.  However, GraphQL's features can als

Kong

Token-Based Access Control With Kong, OPA and Curity

Kong Logo
EngineeringOctober 6, 2021

As APIs and microservices evolve, the architecture used to secure these resources must also mature. Utilizing a token-based architecture to protect APIs is a robust, secure and scalable approach, and it is also much safer than API keys or basic au

Jonas Iggbom

Solving API Authorization Challenges in Multi-Cloud Environments

Kong Logo
EngineeringSeptember 9, 2021

As more and more companies move to a multi-cloud strategy and increase usage of a cloud native infrastructure , API providers are under a lot of pressure to deliver APIs at scale in multi-cloud environments. At the same time, APIs should follow eac

Nima Moghadam

Protect Your Services With Kong Gateway Key Authentication

Kong Logo
EngineeringMay 25, 2021

This tutorial will walk through a common use case for the Kong Gateway Key Authentication plugin : using API key authentication to protect a route to an API server endpoint. It’s a simple use case, but it will give you the foundation to deploy and

Aapo Talvensaari

Ready to see Kong in action?

Get a personalized walkthrough of Kong's platform tailored to your architecture, use cases, and scale requirements.

Get a Demo
Powering the API world

Increase developer productivity, security, and performance at scale with the unified platform for API management, AI gateways, service mesh, and ingress controller.

Sign up for Kong newsletter

    • Platform
    • Kong Konnect
    • Kong Gateway
    • Kong AI Gateway
    • Kong Insomnia
    • Developer Portal
    • Gateway Manager
    • Cloud Gateway
    • Get a Demo
    • Explore More
    • Open Banking API Solutions
    • API Governance Solutions
    • Istio API Gateway Integration
    • Kubernetes API Management
    • API Gateway: Build vs Buy
    • Kong vs Postman
    • Kong vs MuleSoft
    • Kong vs Apigee
    • Documentation
    • Kong Konnect Docs
    • Kong Gateway Docs
    • Kong Mesh Docs
    • Kong AI Gateway
    • Kong Insomnia Docs
    • Kong Plugin Hub
    • Open Source
    • Kong Gateway
    • Kuma
    • Insomnia
    • Kong Community
    • Company
    • About Kong
    • Customers
    • Careers
    • Press
    • Events
    • Contact
    • Pricing
  • Terms
  • Privacy
  • Trust and Compliance
  • © Kong Inc. 2025