Expand description
CAS authentication plugin (cas-auth).
Port of the ticket-validation step of APISIX’s cas-auth plugin, with an
optional interactive CAS SSO login flow layered on top via the shared
encrypted-cookie session primitive.
§Two modes
- Stateless (default) — when no session secret is configured the node
behaves exactly as before: a request carrying a CAS service
ticketquery parameter is validated against the CAS server’s/serviceValidateendpoint and, on success, the authenticated user is attached to the request; anything else is rejected withCAS_AUTH_FAILED(401). - Interactive (opt-in) — set
session.secret(orsession_secret) to turn on the full browser login flow. The authenticated user is sealed into an encrypted client-side cookie (no server-side session store), so the node can redirect unauthenticated browsers to the IdP’s/login, consume the returned ticket at the callback, and thereafter authenticate requests straight from the cookie. See the three-branch logic inCasAuthPlugin::execute_interactive.
§Redirect wiring (interactive mode)
A 302 produced by this node (login redirect, post-callback redirect, or
logout) is returned as an Err carrying the prepared response with code
CAS_REDIRECT, following the same early-exit convention as the
fault-injection/mocking nodes. Wire the node’s error edge to
client.in so the redirect reaches the browser; the success edge
carries authenticated requests on to the upstream.
Structs§
- CasAuth
Plugin - Validates CAS service tickets and, in interactive mode, runs the SSO flow.
- CasSession 🔒
- Session payload sealed into the CAS session cookie (interactive mode).
Functions§
- build_
login_ 🔒url - Builds the CAS
/login?service=<service>URL used to begin interactive login. - build_
validate_ 🔒url - Builds the CAS
/serviceValidateURL. - extract_
ticket 🔒 - Reads the CAS ticket from the request’s query parameters.
- extract_
xml_ 🔒tag - Returns the trimmed text between the first
<tag>and its</tag>. - parse_
service_ 🔒validate - Extracts the authenticated username from a CAS
/serviceValidateresponse. - percent_
encode 🔒 - Percent-encodes a query-argument value (RFC3986 unreserved chars kept).
- session_
cookie_ 🔒str - Reads a string field from nested
session.cookie.<key>, falling back to the flatsession_cookie_<key>form (used by the UI schema). - session_
cookie_ 🔒u64 - Reads a u64 field from nested
session.cookie.<key>, falling back to the flatsession_cookie_<key>form (used by the UI schema). - session_
secret 🔒 - Reads the session secret from
session_secretor nestedsession.secret.