大部分企業使用 java 開發業務系統, 針對java cas的認證 demo 比較多 ,還有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