Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(cas-auth): support logged-in user header #11445

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions apisix/plugins/cas-auth.lua
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ local schema = {
idp_uri = {type = "string"},
cas_callback_uri = {type = "string"},
logout_uri = {type = "string"},
user_header = {type = "string"},
},
required = {
"idp_uri", "cas_callback_uri", "logout_uri"
Expand Down Expand Up @@ -87,6 +88,9 @@ local function with_session_id(conf, ctx, session_id)
else
-- refresh the TTL
store:set(session_id, user, SESSION_LIFETIME)
if conf.user_header then
core.request.set_header(conf.user_header, user)
end
end
end

Expand Down
11 changes: 6 additions & 5 deletions docs/en/latest/plugins/cas-auth.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,12 @@ to do authentication, from the SP (service provider) perspective.

## Attributes

| Name | Type | Required | Description |
| ----------- | ----------- | ----------- | ----------- |
| `idp_uri` | string | True | URI of IdP. |
| `cas_callback_uri` | string | True | redirect uri used to callback the SP from IdP after login or logout. |
| `logout_uri` | string | True | logout uri to trigger logout. |
| Name | Type | Required | Default | Description |
| ------------------ | ------- | -------- | -------------- | --------------------------------------------------------------------------------------------------------------------|
| `idp_uri` | string | True | | URI of IdP. |
| `cas_callback_uri` | string | True | | Redirect uri used to callback the SP from IdP after login or logout. |
| `logout_uri` | string | True | | Logout uri to trigger logout. |
| `user_header` | string | False | | Name for the generated request header containing the logged-in user's username. By default, no header is generated. |

## Enable Plugin

Expand Down
Loading