Skip to content
Kong Logo | Kong Docs Logo
search
  • We're Hiring!
  • Docs
    • Kong Gateway
    • Kong Konnect
    • Kong Mesh
    • Plugin Hub
    • decK
    • Kubernetes Ingress Controller
    • Insomnia
    • Kuma

    • Docs contribution guidelines
  • Plugin Hub
  • Support
  • Community
  • Kong Academy
Get a Demo Start Free Trial
  • Kong Gateway
  • Kong Konnect
  • Kong Mesh
  • Plugin Hub
  • decK
  • Kubernetes Ingress Controller
  • Insomnia
  • Kuma

  • Docs contribution guidelines
  • 3.3.x (latest)
  • 3.2.x
  • 3.1.x
  • 3.0.x
  • 2.8.x
  • 2.7.x
  • 2.6.x
  • Older Enterprise versions (2.1-2.5)
  • Older OSS versions (2.1-2.5)
  • Archive (pre-2.1)

github-edit-pageEdit this page

report-issueReport an issue

enterprise-switcher-iconSwitch to OSS

On this pageOn this page
  • Configuration the Sessions plugin for Kong Manager
  • Session security
  • Example configurations
Kong Gateway
3.2.x
  • Home
  • Kong Gateway
  • Kong Manager
  • Authentication and Authorization
  • Sessions in Kong Manager
You are browsing documentation for an outdated version. See the latest documentation here.

Sessions in Kong Manager

When a user logs in to Kong Manager with their credentials, the Sessions Plugin will create a session cookie. The cookie is used for all subsequent requests and is valid to authenticate the user. The session has a limited duration and renews at a configurable interval, which helps prevent an attacker from obtaining and using a stale cookie after the session has ended.

The Session configuration is secure by default, which may require alteration if using HTTP or different domains for the Admin API and Kong Manager. Even if an attacker were to obtain a stale cookie, it would not benefit them since the cookie is encrypted. The encrypted session data may be stored either in Kong or the cookie itself.

Configuration the Sessions plugin for Kong Manager

To enable sessions authentication, configure the following:

enforce_rbac = on
admin_gui_auth = <set to desired auth type>
admin_gui_session_conf = {
    "secret":"<SET_SECRET>",
    "cookie_name":"<SET_COOKIE_NAME>",
    "storage":"<SET_STORAGE>",
    "rolling_timeout":<NUMBER_OF_SECONDS_UNTIL_RENEWAL>,
    "cookie_secure":<SET_DEPENDING_ON_PROTOCOL>
    "cookie_same_site":"<SET_DEPENDING_ON_DOMAIN>"
}
Attribute Description
cookie_name A name for the cookie.
For example, "cookie_name":"kong_cookie"
secret The secret used in keyed HMAC generation. Although the Session plugin’s default is a random string, the secret must be manually set for use with Kong Manager since it must be the same across all Kong workers/nodes.
storage The location where session data is stored.
The default value is cookie. It may be more secure if set to kong, since access to the database would be required.
rolling_timeout Specifies, in seconds, how long the session can be used until it needs to be renewed.
The default value is 3600.
cookie_secure Applies the Secure directive so that the cookie may be sent to the server only with an encrypted request over the HTTPS protocol. See Session Security for exceptions.
The default value is true.
cookie_same_site Determines whether and how a cookie may be sent with cross-site requests. See Session Security for exceptions.
The default value is strict.

Important: The following properties must not be altered from default for use with Kong Manager:

  • logout_methods
  • logout_query_arg
  • logout_post_arg

For detailed descriptions of each configuration property, learn more in the Session plugin documentation.

Session security

The Session configuration is secure by default, so the cookie uses the Secure, HttpOnly, and SameSite directives.

The following properties must be altered depending on the protocol and domains in use:

  • If using HTTP instead of HTTPS: "cookie_secure": false
  • If using different domains for the Admin API and Kong Manager: "cookie_same_site": "Lax"

Important: Sessions are not invalidated when a user logs out if "storage": "cookie" (the default) is used. In that case, the cookie is deleted client-side. Only when session data is stored server-side with "storage": "kong" set is the session actively invalidated.

Example configurations

If using HTTPS and hosting Kong Manager and the Admin API from the same domain, the following configuration could be used for Basic Auth:

enforce_rbac = on
admin_gui_auth = basic-auth
admin_gui_session_conf = {
    "cookie_name":"$4m04$",
    "secret":"change-this-secret",
    "storage":"kong"
}

In testing, if using HTTP, the following configuration could be used instead:

enforce_rbac = on
admin_gui_auth = basic-auth
admin_gui_session_conf = {
    "cookie_name":"04tm34l",
    "secret":"change-this-secret",
    "storage":"kong",
    "cookie_secure":false
}
Thank you for your feedback.
Was this page useful?
  • Kong
    THE CLOUD CONNECTIVITY COMPANY

    Kong powers reliable digital connections across APIs, hybrid and multi-cloud environments.

    • Company
    • Customers
    • Events
    • Investors
    • Careers Hiring!
    • Partners
    • Press
    • Contact
  • Products
    • Kong Konnect
    • Kong Gateway
    • Kong Mesh
    • Get Started
    • Pricing
  • Resources
    • eBooks
    • Webinars
    • Briefs
    • Blog
    • API Gateway
    • Microservices
  • Open Source
    • Install Kong Gateway
    • Kong Community
    • Kubernetes Ingress
    • Kuma
    • Insomnia
  • Solutions
    • Decentralize
    • Secure & Govern
    • Create a Dev Platform
    • API Gateway
    • Kubernetes
    • Service Mesh
Star
  • Terms•Privacy
© Kong Inc. 2023