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