-
Notifications
You must be signed in to change notification settings - Fork 464
feat(auth): support standard CAS 2.0/3.0 SSO protocol #456
Copy link
Copy link
Open
Labels
effort/l大改动或高风险改动,需要 maintainer 负责 / Large or risky change requiring maintainer ownership.大改动或高风险改动,需要 maintainer 负责 / Large or risky change requiring maintainer ownership.enhancementNew feature or requestNew feature or requestpriority/p2中优先级 / Medium priority triage bucket.中优先级 / Medium priority triage bucket.risk/high涉及安全、鉴权、迁移或公共契约 / Touches security, auth, migrations, or public contracts.涉及安全、鉴权、迁移或公共契约 / Touches security, auth, migrations, or public contracts.triage/needs-info需要补充更多信息后才能分流 / Issue needs more detail before it can be routed.需要补充更多信息后才能分流 / Issue needs more detail before it can be routed.
Metadata
Metadata
Assignees
Labels
effort/l大改动或高风险改动,需要 maintainer 负责 / Large or risky change requiring maintainer ownership.大改动或高风险改动,需要 maintainer 负责 / Large or risky change requiring maintainer ownership.enhancementNew feature or requestNew feature or requestpriority/p2中优先级 / Medium priority triage bucket.中优先级 / Medium priority triage bucket.risk/high涉及安全、鉴权、迁移或公共契约 / Touches security, auth, migrations, or public contracts.涉及安全、鉴权、迁移或公共契约 / Touches security, auth, migrations, or public contracts.triage/needs-info需要补充更多信息后才能分流 / Issue needs more detail before it can be routed.需要补充更多信息后才能分流 / Issue needs more detail before it can be routed.
Type
Fields
Give feedbackNo fields configured for issues without a type.
背景
在 #444 的 review 中,我们决定不合并基于私有协议的 SSO 实现,转而支持标准 CAS 2.0/3.0 协议,使 OSS 用户可以对接 Apereo CAS Server、Keycloak CAS adapter 等主流实现。
关联 PR:#444(已关闭)
目标
实现标准 CAS 2.0/3.0 协议的 SSO 登录集成,复用现有
IdentityBindingService身份映射抽象。设计要点
协议支持
GET /serviceValidate?ticket=...&service=...→ XML 响应GET /p3/serviceValidate?ticket=...&service=...&format=JSON→ JSON 响应架构原则
IdentityBindingService:将 CAS attributes 适配为通用IdentityClaims(需先将IdentityBindingService.bindOrCreate的入参从OAuthClaims抽象为 provider-neutral 接口)OAuthLoginRedirectSupport.sanitizeReturnTo():防止 open redirect@PostConstruct校验 CAS server URL 必须为 HTTPS(或提供显式 escape hatch 用于开发环境)skillhub.auth.cas.enabled=true启用配置项(初步)
前端
authCasEnabled控制显隐SsoLoginEntry的 UI 模式实现步骤
IdentityBindingService.bindOrCreate(OAuthClaims)抽象为IdentityClaims接口,OAuth 和 CAS 各自实现CasProperties配置类 +@PostConstruct校验CasTicketValidator(GET serviceValidate,解析 XML/JSON)CasLoginController(/login 重定向 + /callback 票据验证)CasIdentityClaims适配器,调用IdentityBindingServiceRouteSecurityPolicyRegistry放行/api/v1/auth/cas/**CasLoginEntry组件 + runtime config30-runtime-config.sh添加SKILLHUB_WEB_AUTH_CAS_ENABLED参考
备注
spring-security-cas模块,但需评估与现有PlatformSessionService的集成成本