You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if client provides valid key-auth header apikey:<key>, access is granted
if client is a browser, www-authenticate: Basic realm="service" header is returned and browser prompts user with login window
The idea is to use key-auth and basic-auth globally, both configured with anonymous consumer. Based on plugin ordering documentation, key-auth is evaluated first, sets www-authenticate: Key realm="kong" header, then basic-auth plugin is evaluated and overwrites www-authenticate header with Basic realm="service" value. The last step fails as we can see below.
As we can see, route with basic-auth plugin together with anonymous config doesn't return any www-authenticate header.
I'm not sure what correct behaviour should be (returning www-authenticate header in all cases would solve my issue 😉 ), but I would expect consistency between key-auth and basic-auth plugins.
Anything else?
No response
The text was updated successfully, but these errors were encountered:
Thank you for bringing that up :) ! There's an ongoing effort to keep auth plugins behaviour consistent and compliant with RFC7235
A change for basic-auth was introduced with 3.6 and there's an open PR that consolidates this behaviour between key-auth and basic-auth: #11794
Maybe to sum it up - all auth plugins are planned to return www-authenticate header with 401 response. In that header there's also optional realm that can be included if the plugin was configured with it. The only exception will be basic-auth where realm is required and by default it's set to service.
Is there an existing issue for this?
Kong version (
$ kong version
)3.6.0
Current Behavior
key-auth
andbasic-auth
plugins behave differently when settingwww-authenticate
header withanonymous
config option:key-auth
setswww-authenticate: Key realm="kong"
header withanonymous
option setbasic-auth
doesn't setwww-authenticate: Basic realm="service"
header withanonymous
option setExpected Behavior
I'm trying to achieve the following behaviour:
key-auth
orbasic-auth
authentication on all services/routes:OR
scenario from https://docs.konghq.com/gateway/latest/kong-plugins/authentication/reference/#multiple-authenticationapikey:<key>
, access is grantedwww-authenticate: Basic realm="service"
header is returned and browser prompts user with login windowThe idea is to use
key-auth
andbasic-auth
globally, both configured with anonymous consumer. Based on plugin ordering documentation,key-auth
is evaluated first, setswww-authenticate: Key realm="kong"
header, thenbasic-auth
plugin is evaluated and overwriteswww-authenticate
header withBasic realm="service"
value. The last step fails as we can see below.Steps To Reproduce
Following declarative configuration
Produces following behaviour:
As we can see, route with
basic-auth
plugin together withanonymous
config doesn't return anywww-authenticate
header.I'm not sure what correct behaviour should be (returning
www-authenticate
header in all cases would solve my issue 😉 ), but I would expect consistency betweenkey-auth
andbasic-auth
plugins.Anything else?
No response
The text was updated successfully, but these errors were encountered: