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

示例代码

posted @ 2017-09-08 16:02  漫步之舞  阅读(8749)  评论(0编辑  收藏  举报
一粒云盘,企业内部免费使用的专属云盘 manbuzhiwu @ 版权所有 转载请保留出处,保留链接