Skip to content

Conversation

@shreemaan-abhishek
Copy link
Contributor

@shreemaan-abhishek shreemaan-abhishek commented Jan 6, 2026

Description

This PR adds a realm configuration option to several authentication plugins (basic-auth, key-auth, hmac-auth, jwt-auth, ldap-auth). This allows users to customize the realm value returned in the WWW-Authenticate header when an authentication request fails with a 401 Unauthorized status.

This is in line with standard concept in the HTTP authentication protocol (RFC 7235). It indicates to the client which "protection area" the currently requested resource belongs to. This helps the client (such as a browser or API client) determine which set of credentials to use to re-initiate the request.

Checklist

  • I have explained the need for this PR and the problem it solves
  • I have explained the changes or the new features added to this PR
  • I have added tests corresponding to this change
  • I have updated the documentation to reflect this change
  • I have verified that this change is backward compatible (If not, please discuss on the APISIX mailing list first)

Signed-off-by: Abhishek Choudhary <[email protected]>
@shreemaan-abhishek shreemaan-abhishek marked this pull request as ready for review January 6, 2026 10:46
@dosubot dosubot bot added size:XL This PR changes 500-999 lines, ignoring generated files. enhancement New feature or request labels Jan 6, 2026
nic-6443
nic-6443 previously approved these changes Jan 6, 2026
default = false,
},
realm = {
type = "string",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it can not contain any ', "

maybe we should limit it

tls_verify = { type = "boolean", default = false },
uid = { type = "string", default = "cn" }
uid = { type = "string", default = "cn" },
realm = { type = "string", default = "ldap" }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can add a , at the end of this line always

Signed-off-by: Abhishek Choudhary <[email protected]>
Signed-off-by: Abhishek Choudhary <[email protected]>
membphis
membphis previously approved these changes Jan 7, 2026
nic-6443
nic-6443 previously approved these changes Jan 8, 2026
Signed-off-by: Abhishek Choudhary <[email protected]>
@shreemaan-abhishek shreemaan-abhishek dismissed stale reviews from nic-6443 and membphis via ce57ee7 January 8, 2026 03:36
membphis
membphis previously approved these changes Jan 8, 2026
Signed-off-by: Abhishek Choudhary <[email protected]>
@shreemaan-abhishek shreemaan-abhishek merged commit 5083ad6 into apache:master Jan 8, 2026
38 of 42 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request size:XL This PR changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants