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; a missing ticket, or one CAS itself refuses, is rejected with a401on thedeniedport. - 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) exits on the dedicated redirect output port, following the same
convention as the standalone redirect node. Wire the node’s redirect
edge to client.in so the response reaches the browser; deliberate
denials exit on denied (also wired to client.in, or a custom denial
handler); the success edge carries authenticated requests on to the
upstream.
§The error port is live
Ticket validation is an outbound callout, so this node has a genuine
failure mode: the CAS server unreachable, timed out, or answering
/serviceValidate with a non-200. Those exit on error (see
CasError and CasAuthPlugin::infra_error) — the node could not
reach a verdict. Only a verdict of “this ticket is not valid” (or no
ticket at all) is a denied.
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).
Enums§
- CasError 🔒
- Why a CAS ticket validation did not yield an authenticated user.
Functions§
- build_
login_ 🔒url - Builds the CAS
/login?service=<service>URL used to begin interactive login. - build_
validate_ 🔒url - Builds the CAS
/serviceValidateURL. - classify_
validation 🔒 - Classifies a
/serviceValidatereply: a non-200 status is a provider failure (CasError::Infra); a 200 whose body carries noauthenticationSuccess/user is CAS refusing the ticket (CasError::Denied). - 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.