nodejs 使用CAS 实现 单点登录(SSO) 【开源库实现,简单】


大部分企业使用 java 开发业务系统, 针对java cas的认证 demo 比较多 ,还有PHPCAS ,标准的参考这里:

phpCAS 的使用

整理登录流程如下图,图片来自网络

找了不少资料,nodejs 实现的比较少,npm 上库很多,试用了好几个才成功。

推荐这里库 connect-cas

注意参数解析

Many of these options are borrowed from node's url documentation. You may set global options through the .configure() method or override them with any of the exposed middleware.

  • procotol :The protocol to communicate with the CAS Server. Defaults to 'https'.
  • host : CAS server hostname
  • port :CAS server port number. Defaults to 443.
  • gateway : Send all validation requests through the CAS gateway feature. Defaults to false.
  • paths
    - serviceValidate Path to validate TGT
    - proxyValidate Path to validate PGT (not implemented)
    - proxy Path to obtain a proxy ticket
    - login Path to the CAS login

示例代码


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM