Commit graph

4 commits

Author SHA1 Message Date
dongmucat
ace0cb2dd8 fix(auth): address CAS SSO review — XXE, AccessPolicy, timeouts, release wiring
Blockers:
- Harden XML parsing against XXE (disallow DOCTYPE, external entities/DTDs,
  enable FEATURE_SECURE_PROCESSING) and switch to UTF-8 byte decoding.
- Generalize AccessPolicy.evaluate from OAuthClaims to IdentityClaims; extract
  IdentityAuthenticator so OAuth and CAS share allow/deny/pending evaluation.
  CAS callback now goes through the policy instead of bypassing it with a
  direct bindOrCreate call.
- Configure JDK HttpClient with connect/read timeouts (5s/10s) and disable
  HTTP redirects to prevent ticket exfiltration via a malicious CAS server.

Major:
- Require HTTPS for skillhub.auth.cas.service-url in addition to server-url.
- Stop logging raw service tickets; log claims.subject() instead.
- Remove the dead authCasEnabled web flag — the backend AuthMethodCatalog is
  the single source of truth for CAS visibility, matching how OAuth works.
- Wire SKILLHUB_AUTH_CAS_* env vars into compose.release.yml and add a fully
  documented section in .env.release.example.

Minor:
- CasProtocolVersion enum replaces string comparisons in the validator.
- JSON multi-value array attributes are preserved as List<String> instead of
  silently dropping all but the first element.
- AuthMethod.methodType union adds 'CAS_REDIRECT'.
- application.yml notes that service-url must equal
  ${SKILLHUB_PUBLIC_BASE_URL}/api/v1/auth/cas/callback.

Tests:
- CasTicketValidatorTest tightens URL matching to assert ticket/service/format
  parameters and adds XXE + billion-laughs regression cases.
- IdentityAuthenticatorTest covers ALLOW / PENDING / DENY paths.
- AuthMethodCatalogTest exercises both cas.enabled=true and =false.
- isExternalRedirectMethod predicate extracted and unit-tested.
2026-05-27 15:19:11 +08:00
dongmucat
72ca98552e feat(auth): support standard CAS 2.0/3.0 SSO protocol
Implement native CAS protocol ticket validation for enterprise SSO
integration, supporting both CAS 2.0 (XML) and CAS 3.0 (JSON) modes.

Backend:
- Introduce IdentityClaims interface to abstract identity providers;
  OAuthClaims now implements it, enabling CAS reuse of IdentityBindingService
- CasProperties with @PostConstruct HTTPS validation and feature flag
- CasTicketValidator: validates tickets via /serviceValidate (2.0) or
  /p3/serviceValidate (3.0), parses XML/JSON responses
- CasLoginController: /api/v1/auth/cas/login (redirect) and /callback
  (ticket validation + session establishment)
- RouteSecurityPolicyRegistry: permit /api/v1/auth/cas/**
- AuthMethodCatalog: expose CAS as CAS_REDIRECT method type

Frontend:
- LoginButton renders CAS_REDIRECT methods alongside OAuth providers
- Runtime config adds authCasEnabled flag
- CAS logo SVG added

Closes #456
2026-05-27 12:43:43 +08:00
vsxd
ac352314f7 Add extensible auth compatibility layer for private SSO 2026-03-13 18:00:22 +08:00
vsxd
9ae9b93ca7 Refine production compose runtime config 2026-03-13 17:00:47 +08:00