Enable OIDC for Kong Manager

Kong Gateway offers the ability to bind authentication for Kong Manager Admins to an organization’s OpenID Connect Identity Provider using the OpenID Connect Plugin.

Note: by using the configuration below, it is unnecessary to manually enable the Plugin; the configuration alone will enable OIDC for Kong Manager.

Set up RBAC with OIDC

The following is an example using Google as the IdP and serving Kong Manager from its default URL, http://127.0.0.1:8002.

(The admin_gui_auth_config value must be valid JSON.)

  1. enforce_rbac = on
  2. admin_gui_auth=openid-connect
  3. admin_gui_session_conf = { "secret":"set-your-string-here" }
  4. admin_gui_auth_conf={ \
  5. "issuer": "https://accounts.google.com/", \
  6. "client_id": ["<ENTER_YOUR_CLIENT_ID>"], \
  7. "client_secret": ["<ENTER_YOUR_CLIENT_SECRET_HERE>"], \
  8. "consumer_by": ["username","custom_id"], \
  9. "ssl_verify": false, \
  10. "consumer_claim": ["email"], \
  11. "leeway": 60, \
  12. "redirect_uri": ["http://localhost:8002"], \
  13. "login_redirect_uri": ["http://localhost:8002"], \
  14. "logout_methods": ["GET", "DELETE"], \
  15. "logout_query_arg": "logout", \
  16. "logout_redirect_uri": ["http://localhost:8002"], \
  17. "scopes": ["openid","profile","email","offline_access"], \
  18. "auth_methods": ["authorization_code"] \
  19. }

The Sessions Plugin requires a secret and is configured securely by default.

  • Under all circumstances, the secret must be manually set to a string.
  • If using HTTP instead of HTTPS, cookie_secure must be manually set to false.
  • If using different domains for the Admin API and Kong Manager, cookie_samesite must be set to off. Learn more about these properties in Session Security in Kong Manager, and see example configurations.

Replace the entries surrounded by <> with values that are valid for your IdP. For example, Google credentials can be found here: https://console.cloud.google.com/projectselector/apis/credentials

Create an admin

Create an Admin that has a username matching the email returned from the Identity Provider upon successful login.

  1. $ http POST :8001/admins username="<admin_email>" email="<admin_email>" Kong-Admin-Token:<RBAC_TOKEN>

For example, if a user has a Google email address, hal9000@sky.net:

  1. $ http POST :8001/admins username="hal9000@sky.net" email="hal9000@sky.net" Kong-Admin-Token:<RBAC_TOKEN>

Note: The email entered for the Admin in the request is used to ensure the Admin receives an email invitation, whereas username is the attribute that the Plugin uses with the IdP.

Assign a role to the admin

Assign the new Admin at least one Role so they can log in and access Kong entities.

  1. $ http POST :8001/admins/<admin_email>/roles roles="<role-name>" Kong-Admin-Token:<RBAC_TOKEN>

For example, if we wanted to grant hal9000@sky.net the Role of Super Admin:

  1. $ http POST :8001/admins/hal9000@sky.net/roles roles="super-admin" Kong-Admin-Token:<RBAC_TOKEN>