├── .gitattributes
├── .gitignore
├── README.md
├── SSL证书生成.md
├── assets
├── images
│ ├── 1
│ │ ├── 201804161523862578197774.png
│ │ ├── 201804161523865545481689.png
│ │ ├── 201804161523865760201398.png
│ │ ├── 201804161523865760684654.png
│ │ ├── 201804161523865760693567.png
│ │ ├── 201804161523865855993591.png
│ │ ├── 201804161523866148188763.png
│ │ ├── 201804161523866186289013.png
│ │ └── 201804161523866186733478.png
│ ├── 2
│ │ └── 201804161523869160173801.png
│ ├── 3
│ │ ├── 201804161523865760201398.png
│ │ ├── 201804161523865760693567.png
│ │ ├── 201804161523878122119209.png
│ │ ├── 201804161523878359178231.png
│ │ ├── 201804161523878445160379.png
│ │ └── 201804161523878688166572.png
│ ├── 4
│ │ ├── 201804161523865760201398.png
│ │ ├── 201804161523878445160379.png
│ │ ├── 201804161523883643160471.png
│ │ └── 201804161523883654189851.png
│ ├── 5
│ │ ├── 201804171523935232859701.gif
│ │ ├── 201804171523938430156106.png
│ │ ├── 201804171523938973917504.png
│ │ ├── 201804171523938987716242.png
│ │ ├── 201804171523948748639500.gif
│ │ └── 201804181524022706931201.png
│ ├── 6
│ │ └── 201804181524032576167444.png
│ ├── 7
│ │ ├── 201804181524019874176160.png
│ │ └── 201804181524023427193291.gif
│ ├── 8
│ │ ├── 201804181524038833264962.png
│ │ ├── 201804181524039220104831.png
│ │ ├── 201804181524039231144932.png
│ │ ├── 201804181524039312214564.png
│ │ └── 201804181524039370194248.png
│ ├── 9
│ │ ├── 20180419145341_88760.png
│ │ ├── 201804191524110257665321.png
│ │ └── 201804191524110414224854.png
│ ├── 10
│ │ └── 201802261519638734583401.png
│ ├── 11
│ │ └── 201804191524127669205271.png
│ ├── 12
│ │ ├── 201804181524040873177799.png
│ │ ├── 201804191524129082750256.png
│ │ ├── 201804191524130844657915.png
│ │ └── 201804191524130854245760.png
│ ├── 13
│ │ ├── 201804201524197999115474.png
│ │ ├── 201804201524208015201955.png
│ │ ├── 201804201524208097686882.png
│ │ ├── 201804201524208120130488.png
│ │ └── 201804201524208208550174.gif
│ ├── 14
│ │ ├── 201804201524209923963641.png
│ │ ├── 201804201524211135724303.png
│ │ ├── 201804201524212409105073.png
│ │ ├── 201804201524226077612761.png
│ │ ├── 201804201524226077785383.png
│ │ └── 201804201524226077967835.png
│ ├── 15
│ │ ├── 201804201524226702141302.png
│ │ └── 201804201524226713818216.png
│ ├── 16
│ │ ├── 201804211524293849121385.png
│ │ ├── 201804211524294126170727.png
│ │ ├── 201804211524294228169200.png
│ │ └── 201804211524294246392691.png
│ ├── 17
│ │ ├── 201804231524462347197931.png
│ │ ├── 201804231524462578116640.png
│ │ ├── 201804231524462597513540.png
│ │ ├── 201804231524462617142986.png
│ │ └── 201804231524462648388300.png
│ ├── 18
│ │ ├── 201804231524481316874446.png
│ │ ├── 201804231524484611209328.png
│ │ ├── 201804231524484667103415.png
│ │ ├── 201804231524484734106312.png
│ │ ├── 201804231524484772718274.png
│ │ ├── 201804231524484849446234.png
│ │ └── 201804231524484907178461.png
│ ├── 19
│ │ ├── 201804231524466839607191.png
│ │ ├── 201804231524466866671678.png
│ │ ├── 201804231524468058979107.png
│ │ ├── 201804231524468194211451.png
│ │ ├── 201804231524468224515440.png
│ │ └── 201804231524468297399507.png
│ ├── 20
│ │ ├── 20180424120609_19354.png
│ │ ├── 20180424120610_81158.png
│ │ ├── 201804241524543676124715.png
│ │ ├── 201804241524543707182937.png
│ │ ├── 201804241524543730449380.png
│ │ ├── 201804241524543758109871.png
│ │ ├── 201804241524543800584253.png
│ │ ├── 201804241524543887738459.png
│ │ ├── 201804241524543916119223.png
│ │ ├── 201804241524544081614072.png
│ │ └── 201804241524544090139578.png
│ └── certificate.png
└── pdf
│ └── cas_proxy_protocol.pdf
├── build.sh 文件介绍.md
├── cas-management-run
└── cas-management-overlay-master
│ ├── .gitignore
│ ├── LICENSE.txt
│ ├── README.md
│ ├── build.cmd
│ ├── build.sh
│ ├── etc
│ └── cas
│ │ └── config
│ │ ├── log4j2-management.xml
│ │ ├── management.properties
│ │ └── users.properties
│ ├── pom.xml
│ └── src
│ └── main
│ └── resources
│ ├── application.properties
│ ├── messages_zh_CN.properties
│ └── user-details.properties
├── change-static-password
└── cas-overlay-template-master
│ ├── .gitignore
│ ├── build.cmd
│ ├── build.sh
│ ├── etc
│ └── cas
│ │ ├── casServer.crt
│ │ ├── casServer.keystore
│ │ └── config
│ │ ├── application.yml
│ │ ├── cas.properties
│ │ └── log4j2.xml
│ ├── mvnw
│ ├── mvnw.bat
│ ├── pom.xml
│ └── src
│ └── main
│ └── resources
│ └── application.properties
├── custom-password-verification
└── cas-overlay-template-master
│ ├── .gitignore
│ ├── build.cmd
│ ├── build.sh
│ ├── etc
│ └── cas
│ │ ├── casServer.crt
│ │ ├── casServer.keystore
│ │ └── config
│ │ ├── application.yml
│ │ ├── cas.properties
│ │ └── log4j2.xml
│ ├── mvnw
│ ├── mvnw.bat
│ ├── pom.xml
│ └── src
│ └── main
│ ├── java
│ └── com
│ │ └── tingfeng
│ │ └── CustomPasswordEncoder.java
│ └── resources
│ └── application.properties
├── custom-themes-sso
├── cas-app1
│ ├── .gitignore
│ ├── pom.xml
│ └── src
│ │ └── main
│ │ ├── java
│ │ └── com
│ │ │ └── tingfeng
│ │ │ ├── AppRun.java
│ │ │ ├── cas
│ │ │ ├── auth
│ │ │ │ └── SimpleUrlPatternMatcherStrategy.java
│ │ │ └── config
│ │ │ │ └── CasConfig.java
│ │ │ └── controller
│ │ │ ├── BookController.java
│ │ │ ├── IndexController.java
│ │ │ └── UserController.java
│ │ └── resources
│ │ └── application.yml
├── cas-app2
│ ├── .gitignore
│ ├── pom.xml
│ └── src
│ │ └── main
│ │ ├── java
│ │ └── com
│ │ │ └── tingfeng
│ │ │ ├── AppRun.java
│ │ │ ├── cas
│ │ │ ├── auth
│ │ │ │ └── SimpleUrlPatternMatcherStrategy.java
│ │ │ └── config
│ │ │ │ └── CasConfig.java
│ │ │ └── controller
│ │ │ ├── BookController.java
│ │ │ ├── IndexController.java
│ │ │ └── UserController.java
│ │ └── resources
│ │ └── application.yml
└── cas-overlay-template-master
│ ├── .gitignore
│ ├── build.cmd
│ ├── build.sh
│ ├── etc
│ └── cas
│ │ ├── casServer.crt
│ │ ├── casServer.keystore
│ │ └── config
│ │ ├── application.yml
│ │ ├── cas.properties
│ │ └── log4j2.xml
│ ├── mvnw
│ ├── mvnw.bat
│ ├── pom.xml
│ └── src
│ └── main
│ └── resources
│ ├── app1.properties
│ ├── app2.properties
│ ├── application.properties
│ ├── services
│ ├── HTTPSandIMAPS-10000001.json
│ ├── app1-100001.json
│ └── app2-100002.json
│ ├── static
│ └── themes
│ │ ├── app1
│ │ └── css
│ │ │ └── main.css
│ │ └── app2
│ │ └── css
│ │ └── main.css
│ └── templates
│ ├── app1
│ └── casLoginView.html
│ └── app2
│ └── casLoginView.html
├── email-reset-password
├── about-email.sql
└── cas-overlay-template-master
│ ├── .gitignore
│ ├── build.cmd
│ ├── build.sh
│ ├── etc
│ └── cas
│ │ ├── casServer.crt
│ │ ├── casServer.keystore
│ │ └── config
│ │ ├── application.yml
│ │ ├── cas.properties
│ │ └── log4j2.xml
│ ├── mvnw
│ ├── mvnw.bat
│ ├── pom.xml
│ └── src
│ └── main
│ └── resources
│ └── application.properties
├── embed-tomcat-run
└── cas-overlay-template-master
│ ├── .gitignore
│ ├── LICENSE.txt
│ ├── README.md
│ ├── build.cmd
│ ├── build.sh
│ ├── etc
│ └── cas
│ │ ├── casServer.crt
│ │ ├── casServer.keystore
│ │ └── config
│ │ ├── application.yml
│ │ ├── cas.properties
│ │ └── log4j2.xml
│ ├── maven
│ └── maven-wrapper.properties
│ ├── mvnw
│ ├── mvnw.bat
│ └── pom.xml
├── iframe-sso
├── cas-app1
│ ├── .gitignore
│ ├── pom.xml
│ └── src
│ │ └── main
│ │ ├── java
│ │ └── com
│ │ │ └── tingfeng
│ │ │ ├── AppRun.java
│ │ │ ├── cas
│ │ │ ├── auth
│ │ │ │ └── SimpleUrlPatternMatcherStrategy.java
│ │ │ └── config
│ │ │ │ └── CasConfig.java
│ │ │ ├── controller
│ │ │ └── HelloController.java
│ │ │ ├── domain
│ │ │ └── User.java
│ │ │ └── utils
│ │ │ └── HttpClientProxyUtil.java
│ │ ├── resources
│ │ └── application.yml
│ │ └── webapp
│ │ ├── assets
│ │ └── js
│ │ │ └── common.js
│ │ ├── books.html
│ │ ├── hello.html
│ │ ├── index.html
│ │ ├── login.html
│ │ ├── users.html
│ │ └── world.html
├── cas-app2
│ ├── .gitignore
│ ├── .project
│ ├── pom.xml
│ └── src
│ │ └── main
│ │ ├── java
│ │ └── com
│ │ │ └── tingfeng
│ │ │ ├── AppRun.java
│ │ │ ├── cas
│ │ │ ├── auth
│ │ │ │ └── SimpleUrlPatternMatcherStrategy.java
│ │ │ └── config
│ │ │ │ └── CasConfig.java
│ │ │ ├── controller
│ │ │ └── HelloController.java
│ │ │ ├── domain
│ │ │ └── User.java
│ │ │ └── utils
│ │ │ └── HttpClientProxyUtil.java
│ │ ├── resources
│ │ └── application.yml
│ │ └── webapp
│ │ ├── assets
│ │ └── js
│ │ │ └── common.js
│ │ ├── books.html
│ │ ├── hello.html
│ │ ├── index.html
│ │ ├── login.html
│ │ ├── users.html
│ │ └── world.html
├── cas-client1
│ ├── .gitignore
│ ├── .project
│ ├── pom.xml
│ └── src
│ │ └── main
│ │ ├── java
│ │ └── com
│ │ │ └── tingfeng
│ │ │ ├── ConfigMain.java
│ │ │ ├── controller
│ │ │ └── DemoController.java
│ │ │ └── domain
│ │ │ └── User.java
│ │ └── resources
│ │ └── application.yml
├── cas-client2
│ ├── .gitignore
│ ├── .project
│ ├── pom.xml
│ └── src
│ │ └── main
│ │ ├── java
│ │ └── com
│ │ │ └── tingfeng
│ │ │ ├── ConfigMain.java
│ │ │ ├── controller
│ │ │ └── DemoController.java
│ │ │ └── domain
│ │ │ └── User.java
│ │ └── resources
│ │ └── application.yml
└── cas-overlay-template-master
│ ├── .gitignore
│ ├── build.cmd
│ ├── build.sh
│ ├── etc
│ └── cas
│ │ ├── casServer.crt
│ │ ├── casServer.keystore
│ │ └── config
│ │ ├── application.yml
│ │ ├── cas.properties
│ │ └── log4j2.xml
│ ├── mvnw
│ ├── mvnw.bat
│ ├── pom.xml
│ └── src
│ └── main
│ └── resources
│ ├── app1.properties
│ ├── app2.properties
│ ├── application.properties
│ ├── services
│ ├── HTTPSandIMAPS-10000001.json
│ ├── app1-100001.json
│ └── app2-100002.json
│ ├── static
│ └── themes
│ │ ├── app1
│ │ └── css
│ │ │ └── main.css
│ │ └── app2
│ │ └── css
│ │ └── main.css
│ └── templates
│ ├── app1
│ └── casLoginView.html
│ └── app2
│ └── casLoginView.html
├── jdbc-sso
└── cas-overlay-template-master
│ ├── .gitignore
│ ├── build.cmd
│ ├── build.sh
│ ├── etc
│ └── cas
│ │ ├── casServer.crt
│ │ ├── casServer.keystore
│ │ └── config
│ │ ├── application.yml
│ │ ├── cas.properties
│ │ └── log4j2.xml
│ ├── mvnw
│ ├── mvnw.bat
│ ├── pom.xml
│ └── src
│ └── main
│ └── resources
│ ├── application.properties
│ └── schema
│ └── init.sql
├── outer-tomcat-run
└── server.xml
├── proxy-sso
├── cas-overlay-template-master
│ ├── .gitignore
│ ├── build.cmd
│ ├── build.sh
│ ├── etc
│ │ └── cas
│ │ │ ├── casServer.crt
│ │ │ ├── casServer.keystore
│ │ │ └── config
│ │ │ ├── application.yml
│ │ │ ├── cas.properties
│ │ │ └── log4j2.xml
│ ├── mvnw
│ ├── mvnw.bat
│ ├── pom.xml
│ └── src
│ │ └── main
│ │ └── resources
│ │ ├── app1.properties
│ │ ├── app2.properties
│ │ ├── application.properties
│ │ ├── services
│ │ ├── HTTPSandIMAPS-10000001.json
│ │ ├── app1-100001.json
│ │ └── app2-100002.json
│ │ ├── static
│ │ └── themes
│ │ │ ├── app1
│ │ │ └── css
│ │ │ │ └── main.css
│ │ │ └── app2
│ │ │ └── css
│ │ │ └── main.css
│ │ └── templates
│ │ ├── app1
│ │ └── casLoginView.html
│ │ └── app2
│ │ └── casLoginView.html
├── client1
│ ├── .gitignore
│ ├── pom.xml
│ └── src
│ │ └── main
│ │ ├── java
│ │ └── com
│ │ │ └── tingfeng
│ │ │ ├── AppRun.java
│ │ │ ├── cas
│ │ │ ├── auth
│ │ │ │ └── SimpleUrlPatternMatcherStrategy.java
│ │ │ └── config
│ │ │ │ └── CasConfig.java
│ │ │ ├── controller
│ │ │ ├── BookController.java
│ │ │ ├── CasProxyController.java
│ │ │ ├── IndexController.java
│ │ │ └── UserController.java
│ │ │ ├── domain
│ │ │ └── User.java
│ │ │ └── utils
│ │ │ └── HttpProxy.java
│ │ └── resources
│ │ ├── application.yml
│ │ └── key
│ │ ├── client1.crt
│ │ └── client1.keystore
└── client2
│ ├── .gitignore
│ ├── pom.xml
│ └── src
│ └── main
│ ├── java
│ └── com
│ │ └── tingfeng
│ │ ├── AppRun.java
│ │ ├── cas
│ │ ├── auth
│ │ │ └── SimpleUrlPatternMatcherStrategy.java
│ │ └── config
│ │ │ └── CasConfig.java
│ │ ├── controller
│ │ ├── BookController.java
│ │ ├── IndexController.java
│ │ └── UserController.java
│ │ └── domain
│ │ └── User.java
│ └── resources
│ └── application.yml
├── rest-sso
├── cas-overlay-template-master
│ ├── .gitignore
│ ├── build.cmd
│ ├── build.sh
│ ├── etc
│ │ └── cas
│ │ │ ├── casServer.crt
│ │ │ ├── casServer.keystore
│ │ │ └── config
│ │ │ ├── application.yml
│ │ │ ├── cas.properties
│ │ │ └── log4j2.xml
│ ├── mvnw
│ ├── mvnw.bat
│ ├── pom.xml
│ └── src
│ │ └── main
│ │ └── resources
│ │ └── application.properties
└── cas_db
│ ├── .gitignore
│ ├── build.gradle
│ ├── settings.gradle
│ └── src
│ └── main
│ ├── java
│ └── com
│ │ └── tingfeng
│ │ ├── AppRun.java
│ │ ├── controller
│ │ └── SysUserController.java
│ │ ├── domain
│ │ └── SysUser.java
│ │ └── mapper
│ │ └── SysUserMapper.java
│ └── resources
│ ├── application.properties
│ └── schema
│ └── init.sql
├── restful-api-sso
├── cas-app1
│ ├── .gitignore
│ ├── pom.xml
│ └── src
│ │ └── main
│ │ ├── java
│ │ └── com
│ │ │ └── tingfeng
│ │ │ ├── AppRun.java
│ │ │ ├── cas
│ │ │ ├── auth
│ │ │ │ └── SimpleUrlPatternMatcherStrategy.java
│ │ │ └── config
│ │ │ │ └── CasConfig.java
│ │ │ ├── controller
│ │ │ └── DemoController.java
│ │ │ ├── domain
│ │ │ └── User.java
│ │ │ └── utils
│ │ │ └── HttpProxy.java
│ │ ├── resources
│ │ └── application.yml
│ │ └── webapp
│ │ ├── assets
│ │ └── js
│ │ │ └── common.js
│ │ ├── books.html
│ │ ├── hello.html
│ │ ├── index.html
│ │ ├── login.html
│ │ ├── users.html
│ │ └── world.html
├── cas-app2
│ ├── .gitignore
│ ├── pom.xml
│ └── src
│ │ └── main
│ │ ├── java
│ │ └── com
│ │ │ └── tingfeng
│ │ │ ├── AppRun.java
│ │ │ ├── cas
│ │ │ ├── auth
│ │ │ │ └── SimpleUrlPatternMatcherStrategy.java
│ │ │ └── config
│ │ │ │ └── CasConfig.java
│ │ │ ├── controller
│ │ │ └── DemoController.java
│ │ │ ├── domain
│ │ │ └── User.java
│ │ │ └── utils
│ │ │ └── HttpProxy.java
│ │ ├── resources
│ │ └── application.yml
│ │ └── webapp
│ │ ├── assets
│ │ └── js
│ │ │ └── common.js
│ │ ├── books.html
│ │ ├── hello.html
│ │ ├── index.html
│ │ ├── login.html
│ │ ├── users.html
│ │ └── world.html
├── cas-client1
│ ├── .gitignore
│ ├── pom.xml
│ └── src
│ │ └── main
│ │ ├── java
│ │ └── com
│ │ │ └── tingfeng
│ │ │ ├── AppRun.java
│ │ │ ├── controller
│ │ │ ├── BookController.java
│ │ │ ├── IndexController.java
│ │ │ └── UserController.java
│ │ │ ├── domain
│ │ │ └── User.java
│ │ │ ├── model
│ │ │ └── request
│ │ │ │ └── UserLogin.java
│ │ │ └── utils
│ │ │ └── HttpProxy.java
│ │ └── resources
│ │ └── application.yml
├── cas-client2
│ ├── .gitignore
│ ├── pom.xml
│ └── src
│ │ └── main
│ │ ├── java
│ │ └── com
│ │ │ └── tingfeng
│ │ │ ├── AppRun.java
│ │ │ ├── controller
│ │ │ ├── BookController.java
│ │ │ ├── IndexController.java
│ │ │ └── UserController.java
│ │ │ ├── domain
│ │ │ └── User.java
│ │ │ ├── model
│ │ │ └── request
│ │ │ │ └── UserLogin.java
│ │ │ └── utils
│ │ │ └── HttpProxy.java
│ │ └── resources
│ │ └── application.yml
├── cas-overlay-template-master
│ ├── .gitignore
│ ├── build.cmd
│ ├── build.sh
│ ├── etc
│ │ └── cas
│ │ │ ├── casServer.crt
│ │ │ ├── casServer.keystore
│ │ │ └── config
│ │ │ ├── application.yml
│ │ │ ├── cas.properties
│ │ │ └── log4j2.xml
│ ├── mvnw
│ ├── mvnw.bat
│ ├── pom.xml
│ └── src
│ │ └── main
│ │ ├── java
│ │ └── com
│ │ │ └── tingfeng
│ │ │ └── auth
│ │ │ ├── exception
│ │ │ └── CustomException.java
│ │ │ └── handler
│ │ │ └── CustomerHandler.java
│ │ └── resources
│ │ ├── app1.properties
│ │ ├── app2.properties
│ │ ├── application.properties
│ │ ├── services
│ │ ├── HTTPSandIMAPS-10000001.json
│ │ ├── app1-100001.json
│ │ └── app2-100002.json
│ │ ├── static
│ │ └── themes
│ │ │ ├── app1
│ │ │ └── css
│ │ │ │ └── main.css
│ │ │ └── app2
│ │ │ └── css
│ │ │ └── main.css
│ │ └── templates
│ │ ├── app1
│ │ └── casLoginView.html
│ │ └── app2
│ │ └── casLoginView.html
└── sso-server
│ ├── .gitignore
│ ├── pom.xml
│ └── src
│ └── main
│ ├── java
│ └── com
│ │ └── tingfeng
│ │ ├── AppRun.java
│ │ ├── config
│ │ └── CasConfig.java
│ │ ├── controller
│ │ ├── IndexController.java
│ │ └── UserController.java
│ │ ├── domain
│ │ └── User.java
│ │ ├── server
│ │ └── TgtServer.java
│ │ ├── utils
│ │ ├── CasServerUtil.java
│ │ ├── IdGenerator.java
│ │ └── IpUtil.java
│ │ └── viewmodel
│ │ ├── req
│ │ └── UserLoginRequest.java
│ │ └── res
│ │ └── UserCheckResponse.java
│ └── resources
│ └── application.yml
├── simple-sso
├── cas-app1
│ ├── .gitignore
│ ├── pom.xml
│ └── src
│ │ └── main
│ │ ├── java
│ │ └── com
│ │ │ └── tingfeng
│ │ │ ├── AppRun.java
│ │ │ ├── cas
│ │ │ ├── auth
│ │ │ │ └── SimpleUrlPatternMatcherStrategy.java
│ │ │ └── config
│ │ │ │ └── CasConfig.java
│ │ │ └── controller
│ │ │ ├── BookController.java
│ │ │ ├── IndexController.java
│ │ │ └── UserController.java
│ │ └── resources
│ │ └── application.yml
├── cas-app2
│ ├── .gitignore
│ ├── pom.xml
│ └── src
│ │ └── main
│ │ ├── java
│ │ └── com
│ │ │ └── tingfeng
│ │ │ ├── AppRun.java
│ │ │ ├── cas
│ │ │ ├── auth
│ │ │ │ └── SimpleUrlPatternMatcherStrategy.java
│ │ │ └── config
│ │ │ │ └── CasConfig.java
│ │ │ └── controller
│ │ │ ├── BookController.java
│ │ │ ├── IndexController.java
│ │ │ └── UserController.java
│ │ └── resources
│ │ └── application.yml
└── cas-overlay-template-master
│ ├── .gitignore
│ ├── build.cmd
│ ├── build.sh
│ ├── etc
│ └── cas
│ │ ├── casServer.crt
│ │ ├── casServer.keystore
│ │ └── config
│ │ ├── application.yml
│ │ ├── cas.properties
│ │ └── log4j2.xml
│ ├── mvnw
│ ├── mvnw.bat
│ ├── pom.xml
│ └── src
│ └── main
│ └── resources
│ ├── application.properties
│ └── services
│ └── HTTPSandIMAPS-10000001.json
├── yml-config
└── cas-overlay-template-master
│ ├── .gitignore
│ ├── build.cmd
│ ├── build.sh
│ ├── etc
│ └── cas
│ │ ├── casServer.crt
│ │ ├── casServer.keystore
│ │ └── config
│ │ ├── application.yml
│ │ ├── cas.properties
│ │ └── log4j2.xml
│ ├── mvnw
│ ├── mvnw.bat
│ ├── pom.xml
│ └── src
│ └── main
│ └── resources
│ ├── application.properties
│ └── application.yml
└── 错误记录.md
/.gitattributes:
--------------------------------------------------------------------------------
1 | *.* linguist-language=java
2 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Compiled class file
2 | *.class
3 |
4 | # Log file
5 | *.log
6 |
7 | # BlueJ files
8 | *.ctxt
9 |
10 | # Mobile Tools for Java (J2ME)
11 | .mtj.tmp/
12 |
13 | # Package Files #
14 | *.jar
15 | *.war
16 | *.ear
17 | *.zip
18 | *.tar.gz
19 | *.rar
20 |
21 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
22 | hs_err_pid*
23 |
--------------------------------------------------------------------------------
/assets/images/1/201804161523862578197774.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/assets/images/1/201804161523862578197774.png
--------------------------------------------------------------------------------
/assets/images/1/201804161523865545481689.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/assets/images/1/201804161523865545481689.png
--------------------------------------------------------------------------------
/assets/images/1/201804161523865760201398.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/assets/images/1/201804161523865760201398.png
--------------------------------------------------------------------------------
/assets/images/1/201804161523865760684654.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/assets/images/1/201804161523865760684654.png
--------------------------------------------------------------------------------
/assets/images/1/201804161523865760693567.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/assets/images/1/201804161523865760693567.png
--------------------------------------------------------------------------------
/assets/images/1/201804161523865855993591.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/assets/images/1/201804161523865855993591.png
--------------------------------------------------------------------------------
/assets/images/1/201804161523866148188763.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/assets/images/1/201804161523866148188763.png
--------------------------------------------------------------------------------
/assets/images/1/201804161523866186289013.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/assets/images/1/201804161523866186289013.png
--------------------------------------------------------------------------------
/assets/images/1/201804161523866186733478.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/assets/images/1/201804161523866186733478.png
--------------------------------------------------------------------------------
/assets/images/10/201802261519638734583401.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/assets/images/10/201802261519638734583401.png
--------------------------------------------------------------------------------
/assets/images/11/201804191524127669205271.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/assets/images/11/201804191524127669205271.png
--------------------------------------------------------------------------------
/assets/images/12/201804181524040873177799.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/assets/images/12/201804181524040873177799.png
--------------------------------------------------------------------------------
/assets/images/12/201804191524129082750256.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/assets/images/12/201804191524129082750256.png
--------------------------------------------------------------------------------
/assets/images/12/201804191524130844657915.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/assets/images/12/201804191524130844657915.png
--------------------------------------------------------------------------------
/assets/images/12/201804191524130854245760.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/assets/images/12/201804191524130854245760.png
--------------------------------------------------------------------------------
/assets/images/13/201804201524197999115474.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/assets/images/13/201804201524197999115474.png
--------------------------------------------------------------------------------
/assets/images/13/201804201524208015201955.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/assets/images/13/201804201524208015201955.png
--------------------------------------------------------------------------------
/assets/images/13/201804201524208097686882.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/assets/images/13/201804201524208097686882.png
--------------------------------------------------------------------------------
/assets/images/13/201804201524208120130488.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/assets/images/13/201804201524208120130488.png
--------------------------------------------------------------------------------
/assets/images/13/201804201524208208550174.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/assets/images/13/201804201524208208550174.gif
--------------------------------------------------------------------------------
/assets/images/14/201804201524209923963641.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/assets/images/14/201804201524209923963641.png
--------------------------------------------------------------------------------
/assets/images/14/201804201524211135724303.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/assets/images/14/201804201524211135724303.png
--------------------------------------------------------------------------------
/assets/images/14/201804201524212409105073.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/assets/images/14/201804201524212409105073.png
--------------------------------------------------------------------------------
/assets/images/14/201804201524226077612761.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/assets/images/14/201804201524226077612761.png
--------------------------------------------------------------------------------
/assets/images/14/201804201524226077785383.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/assets/images/14/201804201524226077785383.png
--------------------------------------------------------------------------------
/assets/images/14/201804201524226077967835.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/assets/images/14/201804201524226077967835.png
--------------------------------------------------------------------------------
/assets/images/15/201804201524226702141302.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/assets/images/15/201804201524226702141302.png
--------------------------------------------------------------------------------
/assets/images/15/201804201524226713818216.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/assets/images/15/201804201524226713818216.png
--------------------------------------------------------------------------------
/assets/images/16/201804211524293849121385.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/assets/images/16/201804211524293849121385.png
--------------------------------------------------------------------------------
/assets/images/16/201804211524294126170727.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/assets/images/16/201804211524294126170727.png
--------------------------------------------------------------------------------
/assets/images/16/201804211524294228169200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/assets/images/16/201804211524294228169200.png
--------------------------------------------------------------------------------
/assets/images/16/201804211524294246392691.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/assets/images/16/201804211524294246392691.png
--------------------------------------------------------------------------------
/assets/images/17/201804231524462347197931.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/assets/images/17/201804231524462347197931.png
--------------------------------------------------------------------------------
/assets/images/17/201804231524462578116640.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/assets/images/17/201804231524462578116640.png
--------------------------------------------------------------------------------
/assets/images/17/201804231524462597513540.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/assets/images/17/201804231524462597513540.png
--------------------------------------------------------------------------------
/assets/images/17/201804231524462617142986.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/assets/images/17/201804231524462617142986.png
--------------------------------------------------------------------------------
/assets/images/17/201804231524462648388300.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/assets/images/17/201804231524462648388300.png
--------------------------------------------------------------------------------
/assets/images/18/201804231524481316874446.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/assets/images/18/201804231524481316874446.png
--------------------------------------------------------------------------------
/assets/images/18/201804231524484611209328.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/assets/images/18/201804231524484611209328.png
--------------------------------------------------------------------------------
/assets/images/18/201804231524484667103415.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/assets/images/18/201804231524484667103415.png
--------------------------------------------------------------------------------
/assets/images/18/201804231524484734106312.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/assets/images/18/201804231524484734106312.png
--------------------------------------------------------------------------------
/assets/images/18/201804231524484772718274.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/assets/images/18/201804231524484772718274.png
--------------------------------------------------------------------------------
/assets/images/18/201804231524484849446234.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/assets/images/18/201804231524484849446234.png
--------------------------------------------------------------------------------
/assets/images/18/201804231524484907178461.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/assets/images/18/201804231524484907178461.png
--------------------------------------------------------------------------------
/assets/images/19/201804231524466839607191.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/assets/images/19/201804231524466839607191.png
--------------------------------------------------------------------------------
/assets/images/19/201804231524466866671678.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/assets/images/19/201804231524466866671678.png
--------------------------------------------------------------------------------
/assets/images/19/201804231524468058979107.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/assets/images/19/201804231524468058979107.png
--------------------------------------------------------------------------------
/assets/images/19/201804231524468194211451.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/assets/images/19/201804231524468194211451.png
--------------------------------------------------------------------------------
/assets/images/19/201804231524468224515440.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/assets/images/19/201804231524468224515440.png
--------------------------------------------------------------------------------
/assets/images/19/201804231524468297399507.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/assets/images/19/201804231524468297399507.png
--------------------------------------------------------------------------------
/assets/images/2/201804161523869160173801.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/assets/images/2/201804161523869160173801.png
--------------------------------------------------------------------------------
/assets/images/20/20180424120609_19354.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/assets/images/20/20180424120609_19354.png
--------------------------------------------------------------------------------
/assets/images/20/20180424120610_81158.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/assets/images/20/20180424120610_81158.png
--------------------------------------------------------------------------------
/assets/images/20/201804241524543676124715.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/assets/images/20/201804241524543676124715.png
--------------------------------------------------------------------------------
/assets/images/20/201804241524543707182937.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/assets/images/20/201804241524543707182937.png
--------------------------------------------------------------------------------
/assets/images/20/201804241524543730449380.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/assets/images/20/201804241524543730449380.png
--------------------------------------------------------------------------------
/assets/images/20/201804241524543758109871.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/assets/images/20/201804241524543758109871.png
--------------------------------------------------------------------------------
/assets/images/20/201804241524543800584253.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/assets/images/20/201804241524543800584253.png
--------------------------------------------------------------------------------
/assets/images/20/201804241524543887738459.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/assets/images/20/201804241524543887738459.png
--------------------------------------------------------------------------------
/assets/images/20/201804241524543916119223.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/assets/images/20/201804241524543916119223.png
--------------------------------------------------------------------------------
/assets/images/20/201804241524544081614072.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/assets/images/20/201804241524544081614072.png
--------------------------------------------------------------------------------
/assets/images/20/201804241524544090139578.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/assets/images/20/201804241524544090139578.png
--------------------------------------------------------------------------------
/assets/images/3/201804161523865760201398.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/assets/images/3/201804161523865760201398.png
--------------------------------------------------------------------------------
/assets/images/3/201804161523865760693567.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/assets/images/3/201804161523865760693567.png
--------------------------------------------------------------------------------
/assets/images/3/201804161523878122119209.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/assets/images/3/201804161523878122119209.png
--------------------------------------------------------------------------------
/assets/images/3/201804161523878359178231.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/assets/images/3/201804161523878359178231.png
--------------------------------------------------------------------------------
/assets/images/3/201804161523878445160379.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/assets/images/3/201804161523878445160379.png
--------------------------------------------------------------------------------
/assets/images/3/201804161523878688166572.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/assets/images/3/201804161523878688166572.png
--------------------------------------------------------------------------------
/assets/images/4/201804161523865760201398.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/assets/images/4/201804161523865760201398.png
--------------------------------------------------------------------------------
/assets/images/4/201804161523878445160379.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/assets/images/4/201804161523878445160379.png
--------------------------------------------------------------------------------
/assets/images/4/201804161523883643160471.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/assets/images/4/201804161523883643160471.png
--------------------------------------------------------------------------------
/assets/images/4/201804161523883654189851.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/assets/images/4/201804161523883654189851.png
--------------------------------------------------------------------------------
/assets/images/5/201804171523935232859701.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/assets/images/5/201804171523935232859701.gif
--------------------------------------------------------------------------------
/assets/images/5/201804171523938430156106.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/assets/images/5/201804171523938430156106.png
--------------------------------------------------------------------------------
/assets/images/5/201804171523938973917504.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/assets/images/5/201804171523938973917504.png
--------------------------------------------------------------------------------
/assets/images/5/201804171523938987716242.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/assets/images/5/201804171523938987716242.png
--------------------------------------------------------------------------------
/assets/images/5/201804171523948748639500.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/assets/images/5/201804171523948748639500.gif
--------------------------------------------------------------------------------
/assets/images/5/201804181524022706931201.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/assets/images/5/201804181524022706931201.png
--------------------------------------------------------------------------------
/assets/images/6/201804181524032576167444.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/assets/images/6/201804181524032576167444.png
--------------------------------------------------------------------------------
/assets/images/7/201804181524019874176160.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/assets/images/7/201804181524019874176160.png
--------------------------------------------------------------------------------
/assets/images/7/201804181524023427193291.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/assets/images/7/201804181524023427193291.gif
--------------------------------------------------------------------------------
/assets/images/8/201804181524038833264962.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/assets/images/8/201804181524038833264962.png
--------------------------------------------------------------------------------
/assets/images/8/201804181524039220104831.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/assets/images/8/201804181524039220104831.png
--------------------------------------------------------------------------------
/assets/images/8/201804181524039231144932.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/assets/images/8/201804181524039231144932.png
--------------------------------------------------------------------------------
/assets/images/8/201804181524039312214564.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/assets/images/8/201804181524039312214564.png
--------------------------------------------------------------------------------
/assets/images/8/201804181524039370194248.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/assets/images/8/201804181524039370194248.png
--------------------------------------------------------------------------------
/assets/images/9/20180419145341_88760.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/assets/images/9/20180419145341_88760.png
--------------------------------------------------------------------------------
/assets/images/9/201804191524110257665321.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/assets/images/9/201804191524110257665321.png
--------------------------------------------------------------------------------
/assets/images/9/201804191524110414224854.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/assets/images/9/201804191524110414224854.png
--------------------------------------------------------------------------------
/assets/images/certificate.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/assets/images/certificate.png
--------------------------------------------------------------------------------
/assets/pdf/cas_proxy_protocol.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/assets/pdf/cas_proxy_protocol.pdf
--------------------------------------------------------------------------------
/cas-management-run/cas-management-overlay-master/.gitignore:
--------------------------------------------------------------------------------
1 | .classpath
2 | !/.project
3 | .project
4 | .settings
5 | target/
6 | .idea/
7 | .DS_Store
8 | .idea
9 | overlays/
10 | .gradle/
11 | build/
12 | bin/
13 | *.iml
14 |
15 | *.log.gz
16 | *.log
--------------------------------------------------------------------------------
/cas-management-run/cas-management-overlay-master/README.md:
--------------------------------------------------------------------------------
1 | CAS Services Management Overlay
2 | ============================
3 |
4 | Services management web application Maven overlay for CAS with externalized configuration. The Gradle equivalent of this overlay is [available here](https://github.com/apereo/cas-services-management-gradle-overlay).
5 |
6 | # Versions
7 |
8 | ```xml
9 | 5.2.x
10 | ```
11 |
12 | # Requirements
13 |
14 | * JDK 1.8+
15 |
16 | # Build
17 |
18 | To see what commands are available to the build script, run:
19 |
20 | ```bash
21 | ./build.sh help
22 | ```
23 |
24 | To package the final web application, run:
25 |
26 | ```bash
27 | ./build.sh package
28 | ```
29 |
30 | To update `SNAPSHOT` versions run:
31 |
32 | ```bash
33 | ./build.sh package -U
34 | ```
35 |
36 | ## Windows Build
37 | On Windows you can run build.cmd instead of build.sh. The usage may differ from build.sh, run "build.cmd help" for usage.
38 |
39 | ## Note
40 |
41 | If you are running the management web application on the same machine as the CAS server web application itself,
42 | you will need to evaluate the build script and make sure the configuration files don't override each other.
43 |
44 |
45 | # Deployment
46 |
47 | ## Embedded Tomcat
48 |
49 | CAS will be available at:
50 |
51 | * `http://cas.server.name:8080/cas-management`
52 | * `https://cas.server.name:8443/cas-management`
53 |
54 | ## External
55 |
56 | Deploy resultant `target/cas-management.war` to a servlet container of choice.
57 |
--------------------------------------------------------------------------------
/cas-management-run/cas-management-overlay-master/build.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 |
4 | function copy() {
5 | echo -e "Creating configuration directory under /etc/cas"
6 | mkdir -p /etc/cas/config
7 |
8 | echo -e "Copying configuration files from etc/cas to /etc/cas"
9 | cp -rfv etc/cas/* /etc/cas
10 | }
11 |
12 | function help() {
13 | echo "Usage: build.sh [copy|clean|package|run]"
14 | }
15 |
16 | function clean() {
17 | rm -Rf *.log
18 | rm -Rf *.log.gz
19 | ./mvnw clean "$@"
20 | }
21 |
22 | function package() {
23 | ./mvnw clean package -T 5 "$@"
24 | copy
25 | }
26 |
27 |
28 | function run() {
29 | package && java -Xdebug -Xrunjdwp:transport=dt_socket,address=5000,server=y,suspend=n -jar target/cas-management.war
30 | }
31 |
32 | if [ $# -eq 0 ]; then
33 | echo -e "No commands provided. Defaulting to [run]\n"
34 | run
35 | exit 0
36 | fi
37 |
38 |
39 | case "$1" in
40 | "copy")
41 | copy
42 | ;;
43 | "clean")
44 | shift
45 | clean "$@"
46 | ;;
47 | "package")
48 | shift
49 | package "$@"
50 | ;;
51 | "run")
52 | run "$@"
53 | ;;
54 | *)
55 | help
56 | ;;
57 | esac
58 |
59 |
--------------------------------------------------------------------------------
/cas-management-run/cas-management-overlay-master/etc/cas/config/management.properties:
--------------------------------------------------------------------------------
1 | cas.mgmt.adminRoles[0]=ROLE_ADMIN
2 |
3 | # cas.mgmt.userPropertiesFile=file:/etc/cas/config/users.properties
4 |
5 | # Update this URL to point at server running this management app
6 | #cas.mgmt.serverName=https://cas.server.com:${server.port}
7 |
8 | #server.context-path=/cas-management
9 | #server.port=8444
10 |
11 | logging.config=file:/etc/cas/config/log4j2-management.xml
12 |
13 |
14 |
--------------------------------------------------------------------------------
/cas-management-run/cas-management-overlay-master/etc/cas/config/users.properties:
--------------------------------------------------------------------------------
1 | # Only 'casuser' is authorized to use cas services management app
2 | casuser=notused,ROLE_ADMIN
3 |
--------------------------------------------------------------------------------
/cas-management-run/cas-management-overlay-master/src/main/resources/application.properties:
--------------------------------------------------------------------------------
1 | ##
2 | # CAS Thymeleaf Views
3 | #
4 | spring.thymeleaf.cache=false
5 | spring.thymeleaf.mode=HTML
6 | spring.thymeleaf.order=1
7 |
8 | ##
9 | # Embedded CAS Tomcat Container
10 | #
11 | server.context-path=/cas-management
12 | server.port=8444
13 |
14 | server.ssl.enabled=true
15 | server.ssl.keyStore=file:/etc/cas/casServer.keystore
16 | server.ssl.keyStorePassword=changeit
17 | server.ssl.keyPassword=changeit
18 | server.ssl.key-alias=cas.server.com
19 |
20 | ##
21 | # Log4J Configuration
22 | #
23 | server.context-parameters.isLog4jAutoInitializationDisabled=true
24 | # logging.config=file:/etc/cas/log4j2.xml
25 |
26 | # \u914D\u7F6Ecas\u670D\u52A1\u7684\u5730\u5740
27 | cas.server.name=https://cas.server.com:8443
28 | cas.server.prefix=${cas.server.name}/cas
29 |
30 | # \u9879\u76EE\u7BA1\u7406\u5730\u5740
31 | cas.mgmt.serverName=https://cas.server.com:${server.port}
32 |
33 | ##
34 | # \u9759\u6001\u7BA1\u7406\u8BA4\u8BC1\u5F00\u59CB
35 | # \u901A\u8FC7sso\u767B\u5F55\u540E\u7684\u7528\u6237\uFF0C\u5FC5\u987B\u5B58\u5728\u8BE5\u6587\u4EF6\u4E0B\uFF0C\u5426\u5219\u65E0\u6CD5\u767B\u5F55\uFF0C\u5F53\u7136\u8FD9\u4E9B\u7528\u6237\u53EF\u4EE5\u901A\u8FC7ldap\u8FDB\u884C\u52A8\u6001\u7BA1\u7406
36 | #
37 | cas.mgmt.userPropertiesFile=classpath:/user-details.properties
38 |
39 | ##
40 | # CAS Authentication Attributes
41 | #
42 | cas.authn.attributeRepository.stub.attributes.uid=uid
43 | cas.authn.attributeRepository.stub.attributes.givenName=givenName
44 | cas.authn.attributeRepository.stub.attributes.eppn=eppn
45 |
46 | ##
47 | # CAS Web Application Config
48 | #
49 | server.session.timeout=1800
50 | server.session.cookie.http-only=true
51 | server.session.tracking-modes=COOKIE
52 |
53 | ##
54 | # CAS Cloud Bus Configuration
55 | # Please leave spring.cloud.bus.enabled set to false
56 | #
57 | spring.cloud.bus.enabled=false
58 |
59 | ##
60 | # Actuator Endpoint Security Defaults
61 | #
62 | endpoints.sensitive=true
63 | endpoints.enabled=false
64 | endpoints.actuator.enabled=false
65 |
66 | #\u9ED8\u8BA4\u8BED\u8A00\u5305
67 | cas.mgmt.defaultLocale=zh_CN
--------------------------------------------------------------------------------
/cas-management-run/cas-management-overlay-master/src/main/resources/user-details.properties:
--------------------------------------------------------------------------------
1 | # This file lists the set of users that are allowed access to the management app.
2 | #
3 | # The syntax of each entry should be in the form of:
4 | #
5 | # username=password,grantedAuthority[,grantedAuthority][,enabled|disabled]
6 |
7 | # Example:
8 | #casuser=notused,ROLE_ADMIN
9 | #tsschmi=notused,ROLE_ADMIN
10 |
11 | #\u9759\u6001\u7528\u6237\u5904\u7406
12 | # \u5FC5\u987B\u914D\u7F6E\u4E86\u624D\u80FD\u8FDB\u5165\u540E\u53F0\u9875\uFF0C\u5426\u5219\u4E0D\u7ED9\u4E8E\u8FDB\u5165
13 | tingfeng=tingfeng,ROLE_ADMIN,ROLE_ACTUATOR
14 |
--------------------------------------------------------------------------------
/change-static-password/cas-overlay-template-master/.gitignore:
--------------------------------------------------------------------------------
1 | !/.project
2 |
3 | # 忽略文件
4 | .DS_Store
5 | */.settings/
6 | */.DS_Store
7 | *.class
8 | *.iml
9 | */*.iml
10 | **/*.iml
11 | *.log
12 | .classpath
13 | .factorypath
14 |
15 | # 包文件 #
16 | *.jar
17 | *.war
18 | *.zip
19 | *.tar.gz
20 | *.rar
21 |
22 | # 忽略文件夹
23 | .settings/
24 | maven/
25 | .gradle/
26 | .externalToolBuilders/
27 |
28 | **/target/
29 | **/build/
30 | **/out/
31 | classes/
32 | **/logs/
33 | **/.idea/
34 | .idea/
35 |
36 | overlays/
--------------------------------------------------------------------------------
/change-static-password/cas-overlay-template-master/etc/cas/casServer.crt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/change-static-password/cas-overlay-template-master/etc/cas/casServer.crt
--------------------------------------------------------------------------------
/change-static-password/cas-overlay-template-master/etc/cas/casServer.keystore:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/change-static-password/cas-overlay-template-master/etc/cas/casServer.keystore
--------------------------------------------------------------------------------
/change-static-password/cas-overlay-template-master/etc/cas/config/application.yml:
--------------------------------------------------------------------------------
1 | info:
2 | description: CAS Configuration
--------------------------------------------------------------------------------
/change-static-password/cas-overlay-template-master/etc/cas/config/cas.properties:
--------------------------------------------------------------------------------
1 | cas.server.name: https://cas.example.com:8443
2 | cas.server.prefix: https://cas.example.com:8443/cas
3 |
4 | cas.adminPagesSecurity.ip=127\.0\.0\.1
5 |
6 | logging.config: file:/etc/cas/config/log4j2.xml
7 | # cas.serviceRegistry.config.location: classpath:/services
8 |
9 | server.ssl.keyStore=file:/etc/cas/casServer.keystore
10 | server.ssl.keyStorePassword=changeit
11 | server.ssl.keyPassword=changeit
12 | server.ssl.key-alias=cas.server.com
--------------------------------------------------------------------------------
/custom-password-verification/cas-overlay-template-master/.gitignore:
--------------------------------------------------------------------------------
1 | !/.project
2 |
3 | # 忽略文件
4 | .DS_Store
5 | */.settings/
6 | */.DS_Store
7 | *.class
8 | *.iml
9 | */*.iml
10 | **/*.iml
11 | *.log
12 | .classpath
13 | .factorypath
14 |
15 | # 包文件 #
16 | *.jar
17 | *.war
18 | *.zip
19 | *.tar.gz
20 | *.rar
21 |
22 | # 忽略文件夹
23 | .settings/
24 | maven/
25 | .gradle/
26 | .externalToolBuilders/
27 |
28 | **/target/
29 | **/build/
30 | **/out/
31 | classes/
32 | **/logs/
33 | **/.idea/
34 | .idea/
35 |
36 | overlays/
--------------------------------------------------------------------------------
/custom-password-verification/cas-overlay-template-master/etc/cas/casServer.crt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/custom-password-verification/cas-overlay-template-master/etc/cas/casServer.crt
--------------------------------------------------------------------------------
/custom-password-verification/cas-overlay-template-master/etc/cas/casServer.keystore:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/custom-password-verification/cas-overlay-template-master/etc/cas/casServer.keystore
--------------------------------------------------------------------------------
/custom-password-verification/cas-overlay-template-master/etc/cas/config/application.yml:
--------------------------------------------------------------------------------
1 | info:
2 | description: CAS Configuration
--------------------------------------------------------------------------------
/custom-password-verification/cas-overlay-template-master/etc/cas/config/cas.properties:
--------------------------------------------------------------------------------
1 | cas.server.name: https://cas.example.com:8443
2 | cas.server.prefix: https://cas.example.com:8443/cas
3 |
4 | cas.adminPagesSecurity.ip=127\.0\.0\.1
5 |
6 | logging.config: file:/etc/cas/config/log4j2.xml
7 | # cas.serviceRegistry.config.location: classpath:/services
8 |
9 | server.ssl.keyStore=file:/etc/cas/casServer.keystore
10 | server.ssl.keyStorePassword=changeit
11 | server.ssl.keyPassword=changeit
12 | server.ssl.key-alias=cas.server.com
--------------------------------------------------------------------------------
/custom-password-verification/cas-overlay-template-master/src/main/java/com/tingfeng/CustomPasswordEncoder.java:
--------------------------------------------------------------------------------
1 | package com.tingfeng;
2 |
3 |
4 | import org.springframework.security.crypto.password.PasswordEncoder;
5 |
6 | import java.math.BigInteger;
7 | import java.security.MessageDigest;
8 |
9 | /**
10 | * 自定义加密类
11 | */
12 | public class CustomPasswordEncoder implements PasswordEncoder {
13 |
14 | public String encode(CharSequence password) {
15 | try {
16 | //给数据进行md5加密
17 | MessageDigest md = MessageDigest.getInstance("MD5");
18 | md.update(password.toString().getBytes());
19 | String pwd = new BigInteger(1, md.digest()).toString(16);
20 | System.out.println("encode方法:加密前(" + password + "),加密后(" + pwd + ")");
21 | return pwd;
22 | } catch (Exception e) {
23 | return null;
24 | }
25 | }
26 |
27 | /**
28 | * 调用这个方法来判断密码是否匹配
29 | */
30 | @Override
31 | public boolean matches(CharSequence rawPassword, String encodePassword) {
32 | // 判断密码是否存在
33 | if (rawPassword == null) {
34 | return false;
35 | }
36 |
37 | //通过md5加密后的密码
38 | String pass = this.encode(rawPassword.toString());
39 |
40 | System.out.println("matches方法:rawPassword:" + rawPassword + ",encodePassword:" + encodePassword + ",pass:" + pass);
41 | //比较密码是否相等的问题
42 | return pass.equals(encodePassword);
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/custom-themes-sso/cas-app1/.gitignore:
--------------------------------------------------------------------------------
1 | # 忽略文件
2 | .DS_Store
3 | */.settings/
4 | */.DS_Store
5 | *.class
6 | *.iml
7 | */*.iml
8 | **/*.iml
9 | *.log
10 | .classpath
11 |
12 | # 包文件 #
13 | *.jar
14 | *.war
15 | *.zip
16 | *.tar.gz
17 | *.rar
18 |
19 | # 忽略文件夹
20 | .settings/
21 | .gradle/
22 | .externalToolBuilders/
23 |
24 | **/target/
25 | **/build/
26 | **/out/
27 | classes/
28 | **/logs/
29 | **/.idea/
30 | .idea/
31 |
32 |
--------------------------------------------------------------------------------
/custom-themes-sso/cas-app1/src/main/java/com/tingfeng/cas/auth/SimpleUrlPatternMatcherStrategy.java:
--------------------------------------------------------------------------------
1 | package com.tingfeng.cas.auth;
2 |
3 | import org.jasig.cas.client.authentication.UrlPatternMatcherStrategy;
4 |
5 | import java.util.Arrays;
6 | import java.util.List;
7 |
8 | /**
9 | * 机能概要:过滤掉一些不需要授权登录的URL
10 | */
11 | public class SimpleUrlPatternMatcherStrategy implements UrlPatternMatcherStrategy {
12 |
13 | /**
14 | * 机能概要: 判断是否匹配这个字符串
15 | *
16 | * @param url 用户请求的连接
17 | * @return true : 不拦截
18 | * false :必须得登录了
19 | */
20 | @Override
21 | public boolean matches(String url) {
22 |
23 | if(url.contains("/logout")){
24 | return true;
25 | }
26 |
27 | List list = Arrays.asList(
28 | "/",
29 | "/index",
30 | "/favicon.ico"
31 | );
32 |
33 | String name = url.substring(url.lastIndexOf("/"));
34 | if (name.indexOf("?") != -1) {
35 | name = name.substring(0, name.indexOf("?"));
36 | }
37 |
38 | System.out.println("name:" + name);
39 | boolean result = list.contains(name);
40 | if (!result) {
41 | System.out.println("拦截URL:" + url);
42 | }
43 | return result;
44 | }
45 |
46 | /**
47 | * 正则表达式的规则,这个地方可以是web传递过来的
48 | */
49 | @Override
50 | public void setPattern(String pattern) {
51 |
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/custom-themes-sso/cas-app1/src/main/java/com/tingfeng/cas/config/CasConfig.java:
--------------------------------------------------------------------------------
1 | package com.tingfeng.cas.config;
2 |
3 | /**
4 | * Cas 的一些配置项
5 | */
6 | public class CasConfig {
7 |
8 | /**
9 | * 当前应用程序的baseUrl(注意最后面的斜线)
10 | */
11 | public static String SERVER_NAME = "http://app1.com:8181/";
12 |
13 |
14 | /**
15 | * App1 登出成功url
16 | */
17 | public static String APP_LOGOUT_PATH = SERVER_NAME + "user/logout/success";
18 |
19 |
20 | /**
21 | * CAS服务器地址
22 | */
23 | public static String CAS_SERVER_PATH = "https://cas.server.com:8443/cas";
24 |
25 | /**
26 | * CAS登陆服务器地址
27 | */
28 | public static String CAS_SERVER_LOGIN_PATH = "https://cas.server.com:8443/cas/login";
29 |
30 | /**
31 | * CAS登出服务器地址
32 | */
33 | public static String CAS_SERVER_LOGOUT_PATH = "https://cas.server.com:8443/cas/logout";
34 |
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/custom-themes-sso/cas-app1/src/main/java/com/tingfeng/controller/BookController.java:
--------------------------------------------------------------------------------
1 | package com.tingfeng.controller;
2 |
3 | import org.springframework.web.bind.annotation.GetMapping;
4 | import org.springframework.web.bind.annotation.RequestMapping;
5 | import org.springframework.web.bind.annotation.RestController;
6 |
7 | import java.util.Arrays;
8 | import java.util.List;
9 |
10 | @RestController
11 | @RequestMapping("/book")
12 | public class BookController {
13 |
14 | @GetMapping("/books")
15 | public List books() {
16 | return Arrays.asList("《项塔兰》", "《肖申克的救赎?》", "《人类的群星闪耀时》", "《当我跑步时,我谈些什么》");
17 | }
18 |
19 | }
20 |
--------------------------------------------------------------------------------
/custom-themes-sso/cas-app1/src/main/java/com/tingfeng/controller/IndexController.java:
--------------------------------------------------------------------------------
1 | package com.tingfeng.controller;
2 |
3 | import org.springframework.web.bind.annotation.RequestMapping;
4 | import org.springframework.web.bind.annotation.RestController;
5 |
6 | @RestController
7 | public class IndexController {
8 |
9 | @RequestMapping("/index")
10 | public String index(){
11 | return " index 接口";
12 | }
13 |
14 | @RequestMapping("/world")
15 | public String world(){
16 | return " world 接口";
17 | }
18 |
19 |
20 | }
21 |
--------------------------------------------------------------------------------
/custom-themes-sso/cas-app1/src/main/java/com/tingfeng/controller/UserController.java:
--------------------------------------------------------------------------------
1 | package com.tingfeng.controller;
2 |
3 | import com.tingfeng.cas.config.CasConfig;
4 | import org.springframework.stereotype.Controller;
5 | import org.springframework.web.bind.annotation.RequestMapping;
6 | import org.springframework.web.bind.annotation.ResponseBody;
7 | import org.springframework.web.bind.annotation.RestController;
8 |
9 | import javax.servlet.http.HttpServletRequest;
10 | import javax.servlet.http.HttpServletResponse;
11 |
12 | @Controller
13 | @RequestMapping("/user")
14 | public class UserController {
15 |
16 | /**
17 | * 用户登出
18 | *
19 | * @param request
20 | * @return
21 | */
22 | @RequestMapping("/logout")
23 | public String logout(HttpServletRequest request) {
24 |
25 | // session失效
26 | request.getSession().invalidate();
27 |
28 | return "redirect:" + CasConfig.CAS_SERVER_LOGOUT_PATH;
29 | }
30 |
31 | /**
32 | * 用户登出,并重定向回来
33 | *
34 | * @param request
35 | * @return
36 | */
37 | @RequestMapping("/logout2")
38 | public String logout2(HttpServletRequest request) {
39 |
40 | // session失效
41 | request.getSession().invalidate();
42 |
43 | return "redirect:" + CasConfig.CAS_SERVER_LOGOUT_PATH + "?service="+CasConfig.APP_LOGOUT_PATH;
44 | }
45 |
46 | /**
47 | * 登出成功回调
48 | * @return
49 | */
50 | @ResponseBody
51 | @RequestMapping("/logout/success")
52 | public String logoutPage(){
53 | return "登出成功,跳转登出页面";
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/custom-themes-sso/cas-app1/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 |
2 | logging:
3 | file: "logs/app1.log"
4 | info:
5 | name : "App1项目"
6 |
7 | server:
8 | port: 8181
9 | context-path: /
10 | address: app1.com
--------------------------------------------------------------------------------
/custom-themes-sso/cas-app2/.gitignore:
--------------------------------------------------------------------------------
1 | # 忽略文件
2 | .DS_Store
3 | */.settings/
4 | */.DS_Store
5 | *.class
6 | *.iml
7 | */*.iml
8 | **/*.iml
9 | *.log
10 | .classpath
11 |
12 | # 包文件 #
13 | *.jar
14 | *.war
15 | *.zip
16 | *.tar.gz
17 | *.rar
18 |
19 | # 忽略文件夹
20 | .settings/
21 | .gradle/
22 | .externalToolBuilders/
23 |
24 | **/target/
25 | **/build/
26 | **/out/
27 | classes/
28 | **/logs/
29 | **/.idea/
30 | .idea/
31 |
32 |
--------------------------------------------------------------------------------
/custom-themes-sso/cas-app2/src/main/java/com/tingfeng/cas/auth/SimpleUrlPatternMatcherStrategy.java:
--------------------------------------------------------------------------------
1 | package com.tingfeng.cas.auth;
2 |
3 | import org.jasig.cas.client.authentication.UrlPatternMatcherStrategy;
4 |
5 | import java.util.Arrays;
6 | import java.util.List;
7 |
8 | /**
9 | * 机能概要:过滤掉一些不需要授权登录的URL
10 | */
11 | public class SimpleUrlPatternMatcherStrategy implements UrlPatternMatcherStrategy {
12 |
13 | /**
14 | * 机能概要: 判断是否匹配这个字符串
15 | *
16 | * @param url 用户请求的连接
17 | * @return true : 不拦截
18 | * false :必须得登录了
19 | */
20 | @Override
21 | public boolean matches(String url) {
22 |
23 | if(url.contains("/logout")){
24 | return true;
25 | }
26 |
27 | List list = Arrays.asList(
28 | "/",
29 | "/index",
30 | "/favicon.ico"
31 | );
32 |
33 | String name = url.substring(url.lastIndexOf("/"));
34 | if (name.indexOf("?") != -1) {
35 | name = name.substring(0, name.indexOf("?"));
36 | }
37 |
38 | System.out.println("name:" + name);
39 | boolean result = list.contains(name);
40 | if (!result) {
41 | System.out.println("拦截URL:" + url);
42 | }
43 | return result;
44 | }
45 |
46 | /**
47 | * 正则表达式的规则,这个地方可以是web传递过来的
48 | */
49 | @Override
50 | public void setPattern(String pattern) {
51 |
52 | }
53 | }
--------------------------------------------------------------------------------
/custom-themes-sso/cas-app2/src/main/java/com/tingfeng/cas/config/CasConfig.java:
--------------------------------------------------------------------------------
1 | package com.tingfeng.cas.config;
2 |
3 | /**
4 | * Cas 的一些配置项
5 | */
6 | public class CasConfig {
7 |
8 | /**
9 | * 当前应用程序的baseUrl(注意最后面的斜线)
10 | */
11 | public static String SERVER_NAME = "http://app2.com:8282/";
12 |
13 | /**
14 | * App2 登出成功url
15 | */
16 | public static String APP_LOGOUT_PATH = SERVER_NAME + "user/logout/success";
17 |
18 | /**
19 | * CAS服务器地址
20 | */
21 | public static String CAS_SERVER_PATH = "https://cas.server.com:8443/cas";
22 |
23 | /**
24 | * CAS登陆服务器地址
25 | */
26 | public static String CAS_SERVER_LOGIN_PATH = "https://cas.server.com:8443/cas/login";
27 |
28 | /**
29 | * CAS登出服务器地址
30 | */
31 | public static String CAS_SERVER_LOGOUT_PATH = "https://cas.server.com:8443/cas/logout";
32 |
33 |
34 | }
35 |
--------------------------------------------------------------------------------
/custom-themes-sso/cas-app2/src/main/java/com/tingfeng/controller/BookController.java:
--------------------------------------------------------------------------------
1 | package com.tingfeng.controller;
2 |
3 | import org.springframework.web.bind.annotation.GetMapping;
4 | import org.springframework.web.bind.annotation.RequestMapping;
5 | import org.springframework.web.bind.annotation.RestController;
6 |
7 | import java.util.Arrays;
8 | import java.util.List;
9 |
10 | @RestController
11 | @RequestMapping("/book")
12 | public class BookController {
13 |
14 | @GetMapping("/books")
15 | public List books() {
16 | return Arrays.asList("《Java》", "《C#?》", "《NodeJs》", "《Docker》");
17 | }
18 |
19 | }
20 |
--------------------------------------------------------------------------------
/custom-themes-sso/cas-app2/src/main/java/com/tingfeng/controller/IndexController.java:
--------------------------------------------------------------------------------
1 | package com.tingfeng.controller;
2 |
3 | import org.springframework.web.bind.annotation.RequestMapping;
4 | import org.springframework.web.bind.annotation.RestController;
5 |
6 | @RestController
7 | public class IndexController {
8 |
9 | @RequestMapping("/index")
10 | public String index(){
11 | return " index 接口";
12 | }
13 |
14 | @RequestMapping("/world")
15 | public String world(){
16 | return " world 接口";
17 | }
18 |
19 | }
20 |
--------------------------------------------------------------------------------
/custom-themes-sso/cas-app2/src/main/java/com/tingfeng/controller/UserController.java:
--------------------------------------------------------------------------------
1 | package com.tingfeng.controller;
2 |
3 | import com.tingfeng.cas.config.CasConfig;
4 | import org.springframework.stereotype.Controller;
5 | import org.springframework.web.bind.annotation.RequestMapping;
6 | import org.springframework.web.bind.annotation.ResponseBody;
7 | import org.springframework.web.bind.annotation.RestController;
8 |
9 | import javax.servlet.http.HttpServletRequest;
10 | import javax.servlet.http.HttpServletResponse;
11 |
12 | @Controller
13 | @RequestMapping("/user")
14 | public class UserController {
15 |
16 | /**
17 | * 用户登出
18 | *
19 | * @param request
20 | * @return
21 | */
22 | @RequestMapping("/logout")
23 | public String logout(HttpServletRequest request) {
24 |
25 | // session失效
26 | request.getSession().invalidate();
27 |
28 | return "redirect:" + CasConfig.CAS_SERVER_LOGOUT_PATH;
29 | }
30 |
31 | /**
32 | * 用户登出,并重定向回来
33 | *
34 | * @param request
35 | * @return
36 | */
37 | @RequestMapping("/logout2")
38 | public String logout2(HttpServletRequest request) {
39 |
40 | // session失效
41 | request.getSession().invalidate();
42 |
43 | return "redirect:" + CasConfig.CAS_SERVER_LOGOUT_PATH + "?service="+CasConfig.APP_LOGOUT_PATH;
44 | }
45 |
46 | /**
47 | * 登出成功回调
48 | * @return
49 | */
50 | @ResponseBody
51 | @RequestMapping("/logout/success")
52 | public String logoutPage(){
53 | return "登出成功,跳转登出页面";
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/custom-themes-sso/cas-app2/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 |
2 | logging:
3 | file: "logs/app2.log"
4 | info:
5 | name : "App2项目"
6 |
7 | server:
8 | #端口号
9 | port: 8282
10 | context-path: /
11 | address: app2.com
--------------------------------------------------------------------------------
/custom-themes-sso/cas-overlay-template-master/.gitignore:
--------------------------------------------------------------------------------
1 | !/.project
2 |
3 | # 忽略文件
4 | .DS_Store
5 | */.settings/
6 | */.DS_Store
7 | *.class
8 | *.iml
9 | */*.iml
10 | **/*.iml
11 | *.log
12 | .classpath
13 | .factorypath
14 |
15 | # 包文件 #
16 | *.jar
17 | *.war
18 | *.zip
19 | *.tar.gz
20 | *.rar
21 |
22 | # 忽略文件夹
23 | .settings/
24 | maven/
25 | .gradle/
26 | .externalToolBuilders/
27 |
28 | **/target/
29 | **/build/
30 | **/out/
31 | classes/
32 | **/logs/
33 | **/.idea/
34 | .idea/
35 |
36 | overlays/
--------------------------------------------------------------------------------
/custom-themes-sso/cas-overlay-template-master/etc/cas/casServer.crt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/custom-themes-sso/cas-overlay-template-master/etc/cas/casServer.crt
--------------------------------------------------------------------------------
/custom-themes-sso/cas-overlay-template-master/etc/cas/casServer.keystore:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/custom-themes-sso/cas-overlay-template-master/etc/cas/casServer.keystore
--------------------------------------------------------------------------------
/custom-themes-sso/cas-overlay-template-master/etc/cas/config/application.yml:
--------------------------------------------------------------------------------
1 | info:
2 | description: CAS Configuration
--------------------------------------------------------------------------------
/custom-themes-sso/cas-overlay-template-master/etc/cas/config/cas.properties:
--------------------------------------------------------------------------------
1 | cas.server.name: https://cas.example.com:8443
2 | cas.server.prefix: https://cas.example.com:8443/cas
3 |
4 | cas.adminPagesSecurity.ip=127\.0\.0\.1
5 |
6 | logging.config: file:/etc/cas/config/log4j2.xml
7 | # cas.serviceRegistry.config.location: classpath:/services
8 |
9 | server.ssl.keyStore=file:/etc/cas/casServer.keystore
10 | server.ssl.keyStorePassword=changeit
11 | server.ssl.keyPassword=changeit
12 | server.ssl.key-alias=cas.server.com
--------------------------------------------------------------------------------
/custom-themes-sso/cas-overlay-template-master/src/main/resources/app1.properties:
--------------------------------------------------------------------------------
1 |
2 | css.file=/themes/app1/css/main.css
3 | pageTitle= \u8FD9\u662FAPP 1 \u7F51\u7AD9
4 |
5 | #standard.custom.css.file=/themes/[theme_name]/css/cas.css
6 | #cas.javascript.file=/themes/[theme_name]/js/cas.js
7 |
8 | standard.custom.css.file=/css/cas.css
9 | admin.custom.css.file=/css/admin.css
10 | cas.javascript.file=/js/cas.js
--------------------------------------------------------------------------------
/custom-themes-sso/cas-overlay-template-master/src/main/resources/app2.properties:
--------------------------------------------------------------------------------
1 |
2 | css.file=/themes/app2/css/main.css
3 | pageTitle= \u8FD9\u662FAPP 2 \u7F51\u7AD9
4 |
5 | #standard.custom.css.file=/themes/[theme_name]/css/cas.css
6 | #cas.javascript.file=/themes/[theme_name]/js/cas.js
7 |
8 | standard.custom.css.file=/css/cas.css
9 | admin.custom.css.file=/css/admin.css
10 | cas.javascript.file=/js/cas.js
--------------------------------------------------------------------------------
/custom-themes-sso/cas-overlay-template-master/src/main/resources/services/HTTPSandIMAPS-10000001.json:
--------------------------------------------------------------------------------
1 | {
2 | "@class" : "org.apereo.cas.services.RegexRegisteredService",
3 | "serviceId" : "^(https|http|imaps)://.*",
4 | "name" : "HTTPS and HTTP and IMAPS",
5 | "id" : 10000001,
6 | "description" : "This service definition authorizes all application urls that support HTTPS and HTTP and IMAPS protocols.",
7 | "evaluationOrder" : 10000,
8 | "attributeReleasePolicy": {
9 | "@class": "org.apereo.cas.services.ReturnAllAttributeReleasePolicy"
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/custom-themes-sso/cas-overlay-template-master/src/main/resources/services/app1-100001.json:
--------------------------------------------------------------------------------
1 | {
2 | "@class": "org.apereo.cas.services.RegexRegisteredService",
3 | "serviceId": "^(https|http)://app1.*",
4 | "name": "app1",
5 | "id": 100001,
6 | "description": "这是一个app1域名下的服务,通过app1访问都允许通过",
7 | "evaluationOrder": 10,
8 | "theme": "app1"
9 | }
--------------------------------------------------------------------------------
/custom-themes-sso/cas-overlay-template-master/src/main/resources/services/app2-100002.json:
--------------------------------------------------------------------------------
1 | {
2 | "@class": "org.apereo.cas.services.RegexRegisteredService",
3 | "serviceId": "^(https|http)://app2.*",
4 | "name": "app2",
5 | "id": 100002,
6 | "description": "这是一个app2域名下的服务,通过app2访问都允许通过",
7 | "evaluationOrder": 11,
8 | "theme": "app2"
9 | }
--------------------------------------------------------------------------------
/custom-themes-sso/cas-overlay-template-master/src/main/resources/static/themes/app1/css/main.css:
--------------------------------------------------------------------------------
1 | h3 {
2 | color: pink;
3 | }
--------------------------------------------------------------------------------
/custom-themes-sso/cas-overlay-template-master/src/main/resources/static/themes/app2/css/main.css:
--------------------------------------------------------------------------------
1 | h3 {
2 | color: red; /**红色**/
3 | }
--------------------------------------------------------------------------------
/custom-themes-sso/cas-overlay-template-master/src/main/resources/templates/app1/casLoginView.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/custom-themes-sso/cas-overlay-template-master/src/main/resources/templates/app2/casLoginView.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/email-reset-password/cas-overlay-template-master/.gitignore:
--------------------------------------------------------------------------------
1 | !/.project
2 |
3 | # 忽略文件
4 | .DS_Store
5 | */.settings/
6 | */.DS_Store
7 | *.class
8 | *.iml
9 | */*.iml
10 | **/*.iml
11 | *.log
12 | .classpath
13 | .factorypath
14 |
15 | # 包文件 #
16 | *.jar
17 | *.war
18 | *.zip
19 | *.tar.gz
20 | *.rar
21 |
22 | # 忽略文件夹
23 | .settings/
24 | maven/
25 | .gradle/
26 | .externalToolBuilders/
27 |
28 | **/target/
29 | **/build/
30 | **/out/
31 | classes/
32 | **/logs/
33 | **/.idea/
34 | .idea/
35 |
36 | overlays/
--------------------------------------------------------------------------------
/email-reset-password/cas-overlay-template-master/etc/cas/casServer.crt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/email-reset-password/cas-overlay-template-master/etc/cas/casServer.crt
--------------------------------------------------------------------------------
/email-reset-password/cas-overlay-template-master/etc/cas/casServer.keystore:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/email-reset-password/cas-overlay-template-master/etc/cas/casServer.keystore
--------------------------------------------------------------------------------
/email-reset-password/cas-overlay-template-master/etc/cas/config/application.yml:
--------------------------------------------------------------------------------
1 | info:
2 | description: CAS Configuration
--------------------------------------------------------------------------------
/email-reset-password/cas-overlay-template-master/etc/cas/config/cas.properties:
--------------------------------------------------------------------------------
1 | cas.server.name: https://cas.server.com:8443
2 | cas.server.prefix: https://cas.server.com:8443/cas
3 |
4 | cas.adminPagesSecurity.ip=127\.0\.0\.1
5 |
6 | logging.config: file:/etc/cas/config/log4j2.xml
7 | # cas.serviceRegistry.config.location: classpath:/services
8 |
9 | server.ssl.keyStore=file:/etc/cas/casServer.keystore
10 | server.ssl.keyStorePassword=changeit
11 | server.ssl.keyPassword=changeit
12 | server.ssl.key-alias=cas.server.com
--------------------------------------------------------------------------------
/embed-tomcat-run/cas-overlay-template-master/.gitignore:
--------------------------------------------------------------------------------
1 | !/.project
2 |
3 | # 忽略文件
4 | .DS_Store
5 | */.settings/
6 | */.DS_Store
7 | *.class
8 | *.iml
9 | */*.iml
10 | **/*.iml
11 | *.log
12 | .classpath
13 | .factorypath
14 |
15 | # 包文件 #
16 | *.jar
17 | *.war
18 | *.zip
19 | *.tar.gz
20 | *.rar
21 |
22 | # 忽略文件夹
23 | .settings/
24 | .gradle/
25 | .externalToolBuilders/
26 |
27 | **/target/
28 | **/build/
29 | **/out/
30 | classes/
31 | **/logs/
32 | **/.idea/
33 | .idea/
34 |
35 | overlays/
--------------------------------------------------------------------------------
/embed-tomcat-run/cas-overlay-template-master/etc/cas/casServer.crt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/embed-tomcat-run/cas-overlay-template-master/etc/cas/casServer.crt
--------------------------------------------------------------------------------
/embed-tomcat-run/cas-overlay-template-master/etc/cas/casServer.keystore:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/embed-tomcat-run/cas-overlay-template-master/etc/cas/casServer.keystore
--------------------------------------------------------------------------------
/embed-tomcat-run/cas-overlay-template-master/etc/cas/config/application.yml:
--------------------------------------------------------------------------------
1 | info:
2 | description: CAS Configuration
--------------------------------------------------------------------------------
/embed-tomcat-run/cas-overlay-template-master/etc/cas/config/cas.properties:
--------------------------------------------------------------------------------
1 | cas.server.name: https://cas.example.com:8443
2 | cas.server.prefix: https://cas.example.com:8443/cas
3 |
4 | cas.adminPagesSecurity.ip=127\.0\.0\.1
5 |
6 | logging.config: file:/etc/cas/config/log4j2.xml
7 | # cas.serviceRegistry.config.location: classpath:/services
8 |
9 | server.ssl.keyStore=file:/etc/cas/casServer.keystore
10 | server.ssl.keyStorePassword=changeit
11 | server.ssl.keyPassword=changeit
12 | server.ssl.key-alias=cas.server.com
--------------------------------------------------------------------------------
/embed-tomcat-run/cas-overlay-template-master/maven/maven-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Maven download properties
2 | #Fri Dec 01 21:35:11 MST 2017
3 | distributionUrl=https\://repository.apache.org/content/repositories/releases/org/apache/maven/apache-maven/3.5.2/apache-maven-3.5.2-bin.zip
4 |
--------------------------------------------------------------------------------
/iframe-sso/cas-app1/.gitignore:
--------------------------------------------------------------------------------
1 |
2 | # 以斜杠“/”开头表示目录;
3 | # 以星号“*”通配多个字符;
4 | # 以问号“?”通配单个字符
5 | # 以方括号“[]”包含单个字符的匹配列表;
6 | # 以叹号“!”表示不忽略(跟踪)匹配到的文件或目录;
7 |
8 | # 忽略文件
9 | .DS_Store
10 | */.settings/
11 | */.DS_Store
12 | *.class
13 | *.iml
14 | */*.iml
15 | **/*.iml
16 | *.log
17 | .classpath
18 |
19 | # 包文件 #
20 | *.jar
21 | *.war
22 | *.zip
23 | *.tar.gz
24 | *.rar
25 |
26 | # 忽略文件夹
27 | .settings/
28 | .gradle/
29 | .externalToolBuilders/
30 |
31 | **/target/
32 | **/build/
33 | **/out/
34 | classes/
35 | **/logs/
36 | **/.idea/
37 | .idea/
38 |
39 |
--------------------------------------------------------------------------------
/iframe-sso/cas-app1/src/main/java/com/tingfeng/cas/auth/SimpleUrlPatternMatcherStrategy.java:
--------------------------------------------------------------------------------
1 | package com.tingfeng.cas.auth;
2 |
3 | import org.jasig.cas.client.authentication.UrlPatternMatcherStrategy;
4 |
5 | import java.util.Arrays;
6 | import java.util.List;
7 |
8 | /**
9 | * 机能概要:过滤掉一些不需要授权登录的URL
10 | */
11 | public class SimpleUrlPatternMatcherStrategy implements UrlPatternMatcherStrategy {
12 |
13 | /**
14 | * 机能概要: 判断是否匹配这个字符串
15 | *
16 | * @param url 用户请求的连接
17 | * @return true : 不拦截
18 | * false :必须得登录了
19 | */
20 | @Override
21 | public boolean matches(String url) {
22 |
23 | List list = Arrays.asList(
24 | "/index.html",
25 | "/login.html",
26 | "/hello.html",
27 | "/world.html",
28 | "/favicon.ico");
29 |
30 | String name = url.substring(url.lastIndexOf("/"));
31 |
32 | // String url = "http://app1.com:8181/login.html?service=http%3A%2F%2Fapp1.com%3A8181%2Fusers.html";
33 | // 为了防止出现匹配中,忽略了后续参数的URL,出现比如:/login.html?service=http%3A%2F%2Fapp1.com%3A8181%2Fusers.html 现象
34 | // 这种现象,会导致重定向过多异常,所以,不管什么url,只取出请求的最终 file.html 即可
35 |
36 | if (name.indexOf("?") != -1) {
37 | name = name.substring(0, name.indexOf("?"));
38 | }
39 | boolean result = list.contains(name);
40 | if (!result) {
41 | System.out.println("拦截URL:" + url);
42 | }
43 | return result;
44 | }
45 |
46 | /**
47 | * 正则表达式的规则,这个地方可以是web传递过来的
48 | */
49 | @Override
50 | public void setPattern(String pattern) {
51 |
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/iframe-sso/cas-app1/src/main/java/com/tingfeng/cas/config/CasConfig.java:
--------------------------------------------------------------------------------
1 | package com.tingfeng.cas.config;
2 |
3 | /**
4 | * Cas 的一些配置项
5 | */
6 | public class CasConfig {
7 |
8 | /**
9 | * 当前应用程序的baseUrl(注意最后面的斜线)
10 | */
11 | public static String SERVER_NAME = "http://app1.com:8181/fire/";
12 |
13 | /**
14 | * 当前应用程序的登陆界面
15 | */
16 | public static String APP_LOGIN_PAGE = "http://app1.com:8181/fire/login.html";
17 |
18 |
19 | /**
20 | * CAS服务器地址
21 | */
22 | public static String CAS_SERVER_PATH = "https://cas.server.com:8443/cas";
23 |
24 | /**
25 | * CAS登陆服务器地址
26 | */
27 | public static String CAS_SERVER_LOGIN_PATH = "https://cas.server.com:8443/cas/login";
28 |
29 | /**
30 | * CAS登出服务器地址
31 | */
32 | public static String CAS_SERVER_LOGOUT_PATH = "https://cas.server.com:8443/cas/logout";
33 |
34 |
35 | }
36 |
--------------------------------------------------------------------------------
/iframe-sso/cas-app1/src/main/java/com/tingfeng/controller/HelloController.java:
--------------------------------------------------------------------------------
1 | package com.tingfeng.controller;
2 |
3 | import com.google.gson.Gson;
4 | import com.tingfeng.domain.User;
5 | import com.tingfeng.utils.HttpClientProxyUtil;
6 | import org.springframework.web.bind.annotation.GetMapping;
7 | import org.springframework.web.bind.annotation.RequestMapping;
8 | import org.springframework.web.bind.annotation.RestController;
9 |
10 | import java.util.List;
11 |
12 | @RestController
13 | @RequestMapping("/api")
14 | public class HelloController {
15 |
16 | private static String API_BASE_URL = "http://client1.com:8888/api";
17 |
18 | @GetMapping("/hello")
19 | public String hello() {
20 | return "前端 Hello 接口响应";
21 | }
22 |
23 | @GetMapping("/world")
24 | public String world() {
25 |
26 | String result = HttpClientProxyUtil.sendGet(API_BASE_URL + "/world", "");
27 | System.out.println("Client1 接口响应结果:" + result);
28 |
29 | return result;
30 | }
31 |
32 | @GetMapping("/users")
33 | public List users() {
34 | String result = HttpClientProxyUtil.sendGet(API_BASE_URL + "/users", "");
35 | System.out.println("Client1 接口响应结果:" + result);
36 |
37 | if (null != result && !result.equals("")) {
38 | Gson gson = new Gson();
39 | List userList = gson.fromJson(result, List.class);
40 | return userList;
41 | }
42 |
43 | return null;
44 | }
45 |
46 | @GetMapping("/books")
47 | public List books() {
48 |
49 | String result = HttpClientProxyUtil.sendGet(API_BASE_URL + "/books", "");
50 | System.out.println("Client1 接口响应结果:" + result);
51 |
52 | if (null != result && !result.equals("")) {
53 | Gson gson = new Gson();
54 | List nameList = gson.fromJson(result, List.class);
55 | return nameList;
56 | }
57 |
58 | return null;
59 | }
60 |
61 | }
62 |
--------------------------------------------------------------------------------
/iframe-sso/cas-app1/src/main/java/com/tingfeng/domain/User.java:
--------------------------------------------------------------------------------
1 | package com.tingfeng.domain;
2 |
3 | public class User {
4 |
5 | private String username;
6 | private String password;
7 | private String sex;
8 | private int age;
9 |
10 | public User() {
11 | }
12 |
13 | public User(String username, String password, String sex, int age) {
14 | this.username = username;
15 | this.password = password;
16 | this.sex = sex;
17 | this.age = age;
18 | }
19 |
20 | public String getUsername() {
21 | return username;
22 | }
23 |
24 | public void setUsername(String username) {
25 | this.username = username;
26 | }
27 |
28 | public String getPassword() {
29 | return password;
30 | }
31 |
32 | public void setPassword(String password) {
33 | this.password = password;
34 | }
35 |
36 | public String getSex() {
37 | return sex;
38 | }
39 |
40 | public void setSex(String sex) {
41 | this.sex = sex;
42 | }
43 |
44 | public int getAge() {
45 | return age;
46 | }
47 |
48 | public void setAge(int age) {
49 | this.age = age;
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/iframe-sso/cas-app1/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | logging:
2 | file: "logs/config/demo-xx.log"
3 | info:
4 | name : "前端 App1 项目"
5 |
6 | server:
7 | port: 8181
8 | context-path: /fire
9 |
10 |
11 |
--------------------------------------------------------------------------------
/iframe-sso/cas-app1/src/main/webapp/assets/js/common.js:
--------------------------------------------------------------------------------
1 | /**
2 | * 获取项目根路径
3 | * 例如:http://app1.com:8181/fire
4 | * @returns {string}
5 | */
6 | function getRootPath() {
7 | var url = window.document.location.href;
8 | var pathName = window.document.location.pathname;
9 | var pos = url.indexOf(pathName);
10 | var path = url.substring(0, pos);
11 | var projectName = pathName.substring(0, pathName.substr(1).indexOf('/') + 1);
12 | return (path + projectName);
13 | }
14 |
15 | /**
16 | * 获取请求参数
17 | * 例如:http://app1.com:8181/fire?username=aaa&password=bbb,
18 | * 操作:GetQueryString('username') 返回 aaa
19 | *
20 | * @param name param 参数的 key
21 | * @returns {*} 根据 param 的 key,返回value
22 | */
23 | function GetQueryString(name) {
24 | var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
25 | var r = window.location.search.substr(1).match(reg);
26 | if (r != null) return unescape(r[2]);
27 | return null;
28 | }
29 |
--------------------------------------------------------------------------------
/iframe-sso/cas-app1/src/main/webapp/books.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 图书列表数据
6 |
7 |
8 |
9 |
31 |
32 |
33 | 访问 books.html
34 |
35 | 图书列表
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/iframe-sso/cas-app1/src/main/webapp/hello.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Hello
6 |
7 |
8 |
9 |
10 |
27 |
28 |
29 | 访问 Hello.html
30 |
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/iframe-sso/cas-app1/src/main/webapp/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Index首页
6 |
7 |
8 | 访问App1前端首页!
9 |
10 |
11 |
--------------------------------------------------------------------------------
/iframe-sso/cas-app1/src/main/webapp/login.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 登录界面
6 |
7 |
8 |
9 |
10 |
26 |
27 |
28 | Iframe方式嵌入Cas Server自定义登录页
29 |
32 |
41 |
42 |
43 |
--------------------------------------------------------------------------------
/iframe-sso/cas-app1/src/main/webapp/users.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 用户列表数据
6 |
7 |
8 |
9 |
10 |
11 |
33 |
34 |
35 | 访问 users.html
36 |
37 | 用户列表
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/iframe-sso/cas-app1/src/main/webapp/world.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | World
6 |
7 |
8 |
9 |
26 |
27 |
28 | 访问 World.html
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/iframe-sso/cas-app2/.gitignore:
--------------------------------------------------------------------------------
1 |
2 | # 以斜杠“/”开头表示目录;
3 | # 以星号“*”通配多个字符;
4 | # 以问号“?”通配单个字符
5 | # 以方括号“[]”包含单个字符的匹配列表;
6 | # 以叹号“!”表示不忽略(跟踪)匹配到的文件或目录;
7 |
8 | # 忽略文件
9 | .DS_Store
10 | */.settings/
11 | */.DS_Store
12 | *.class
13 | *.iml
14 | */*.iml
15 | **/*.iml
16 | *.log
17 | .classpath
18 |
19 | # 包文件 #
20 | *.jar
21 | *.war
22 | *.zip
23 | *.tar.gz
24 | *.rar
25 |
26 | # 忽略文件夹
27 | .settings/
28 | .gradle/
29 | .externalToolBuilders/
30 |
31 | **/target/
32 | **/build/
33 | **/out/
34 | classes/
35 | **/logs/
36 | **/.idea/
37 | .idea/
38 |
39 |
--------------------------------------------------------------------------------
/iframe-sso/cas-app2/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | cas-client-springboot
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.wst.common.project.facet.core.builder
10 |
11 |
12 |
13 |
14 | org.eclipse.jdt.core.javabuilder
15 |
16 |
17 |
18 |
19 | org.springframework.ide.eclipse.core.springbuilder
20 |
21 |
22 |
23 |
24 | org.springframework.ide.eclipse.boot.validation.springbootbuilder
25 |
26 |
27 |
28 |
29 | org.eclipse.m2e.core.maven2Builder
30 |
31 |
32 |
33 |
34 |
35 | org.springframework.ide.eclipse.core.springnature
36 | org.eclipse.jdt.core.javanature
37 | org.eclipse.m2e.core.maven2Nature
38 | org.eclipse.wst.common.project.facet.core.nature
39 |
40 |
41 |
--------------------------------------------------------------------------------
/iframe-sso/cas-app2/src/main/java/com/tingfeng/cas/auth/SimpleUrlPatternMatcherStrategy.java:
--------------------------------------------------------------------------------
1 | package com.tingfeng.cas.auth;
2 |
3 | import org.jasig.cas.client.authentication.UrlPatternMatcherStrategy;
4 |
5 | import java.util.Arrays;
6 | import java.util.List;
7 |
8 | /**
9 | * 机能概要:过滤掉一些不需要授权登录的URL
10 | */
11 | public class SimpleUrlPatternMatcherStrategy implements UrlPatternMatcherStrategy {
12 |
13 | /**
14 | * 机能概要: 判断是否匹配这个字符串
15 | *
16 | * @param url 用户请求的连接
17 | * @return true : 不拦截
18 | * false :必须得登录了
19 | */
20 | @Override
21 | public boolean matches(String url) {
22 |
23 | List list = Arrays.asList(
24 | "/index.html",
25 | "/login.html",
26 | "/hello.html",
27 | "/world.html",
28 | "/favicon.ico");
29 |
30 | String name = url.substring(url.lastIndexOf("/"));
31 |
32 | // String url = "http://app2.com:8282/login.html?service=http%3A%2F%2Fapp2.com%3A8282%2Fusers.html";
33 | // 为了防止出现匹配中,忽略了后续参数的URL,出现比如:/login.html?service=http%3A%2F%2Fapp2.com%3A8282%2Fusers.html 现象
34 | // 这种现象,会导致重定向过多异常,所以,不管什么url,只取出请求的最终 file.html 即可
35 |
36 | if (name.indexOf("?") != -1) {
37 | name = name.substring(0, name.indexOf("?"));
38 | }
39 |
40 | boolean result = list.contains(name);
41 | if (!result) {
42 | System.out.println("拦截URL:" + url);
43 | }
44 | return result;
45 | }
46 |
47 | /**
48 | * 正则表达式的规则,这个地方可以是web传递过来的
49 | */
50 | @Override
51 | public void setPattern(String pattern) {
52 |
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/iframe-sso/cas-app2/src/main/java/com/tingfeng/cas/config/CasConfig.java:
--------------------------------------------------------------------------------
1 | package com.tingfeng.cas.config;
2 |
3 | /**
4 | * Cas 的一些配置项
5 | */
6 | public class CasConfig {
7 |
8 | /**
9 | * 当前应用程序的baseUrl(注意最后面的斜线)
10 | */
11 | public static String SERVER_NAME = "http://app2.com:8282/water";
12 |
13 | /**
14 | * 当前应用程序的登陆界面
15 | */
16 | public static String APP_LOGIN_PAGE = "http://app2.com:8282/water/login.html";
17 |
18 |
19 | /**
20 | * CAS服务器地址
21 | */
22 | public static String CAS_SERVER_PATH = "https://cas.server.com:8443/cas";
23 |
24 | /**
25 | * CAS登陆服务器地址
26 | */
27 | public static String CAS_SERVER_LOGIN_PATH = "https://cas.server.com:8443/cas/login";
28 |
29 | /**
30 | * CAS登出服务器地址
31 | */
32 | public static String CAS_SERVER_LOGOUT_PATH = "https://cas.server.com:8443/cas/logout";
33 |
34 | }
35 |
--------------------------------------------------------------------------------
/iframe-sso/cas-app2/src/main/java/com/tingfeng/controller/HelloController.java:
--------------------------------------------------------------------------------
1 | package com.tingfeng.controller;
2 |
3 | import com.google.gson.Gson;
4 | import com.tingfeng.domain.User;
5 | import com.tingfeng.utils.HttpClientProxyUtil;
6 | import org.springframework.web.bind.annotation.GetMapping;
7 | import org.springframework.web.bind.annotation.RequestMapping;
8 | import org.springframework.web.bind.annotation.RestController;
9 |
10 | import java.util.List;
11 |
12 | @RestController
13 | @RequestMapping("/api")
14 | public class HelloController {
15 |
16 | private static String API_BASE_URL = "http://client2.com:8889/api";
17 |
18 | @GetMapping("/hello")
19 | public String hello() {
20 | return "前端 Hello 接口响应";
21 | }
22 |
23 | @GetMapping("/world")
24 | public String world() {
25 |
26 | String result = HttpClientProxyUtil.sendGet(API_BASE_URL + "/world", "");
27 | System.out.println("client2 接口响应结果:" + result);
28 |
29 | return result;
30 | }
31 |
32 | @GetMapping("/users")
33 | public List users() {
34 | String result = HttpClientProxyUtil.sendGet(API_BASE_URL + "/users", "");
35 | System.out.println("client2 接口响应结果:" + result);
36 |
37 | if (null != result && !result.equals("")) {
38 | Gson gson = new Gson();
39 | List userList = gson.fromJson(result, List.class);
40 | return userList;
41 | }
42 |
43 | return null;
44 | }
45 |
46 | @GetMapping("/books")
47 | public List books() {
48 |
49 | String result = HttpClientProxyUtil.sendGet(API_BASE_URL + "/books", "");
50 | System.out.println("client2 接口响应结果:" + result);
51 |
52 | if (null != result && !result.equals("")) {
53 | Gson gson = new Gson();
54 | List nameList = gson.fromJson(result, List.class);
55 | return nameList;
56 | }
57 |
58 | return null;
59 | }
60 |
61 | }
62 |
--------------------------------------------------------------------------------
/iframe-sso/cas-app2/src/main/java/com/tingfeng/domain/User.java:
--------------------------------------------------------------------------------
1 | package com.tingfeng.domain;
2 |
3 | public class User {
4 |
5 | private String username;
6 | private String password;
7 | private String sex;
8 | private int age;
9 |
10 | public User() {
11 | }
12 |
13 | public User(String username, String password, String sex, int age) {
14 | this.username = username;
15 | this.password = password;
16 | this.sex = sex;
17 | this.age = age;
18 | }
19 |
20 | public String getUsername() {
21 | return username;
22 | }
23 |
24 | public void setUsername(String username) {
25 | this.username = username;
26 | }
27 |
28 | public String getPassword() {
29 | return password;
30 | }
31 |
32 | public void setPassword(String password) {
33 | this.password = password;
34 | }
35 |
36 | public String getSex() {
37 | return sex;
38 | }
39 |
40 | public void setSex(String sex) {
41 | this.sex = sex;
42 | }
43 |
44 | public int getAge() {
45 | return age;
46 | }
47 |
48 | public void setAge(int age) {
49 | this.age = age;
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/iframe-sso/cas-app2/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | logging:
2 | file: "logs/config/demo-xx.log"
3 | info:
4 | name : "前端 App2 项目"
5 |
6 | server:
7 | #端口号
8 | port: 8282
9 | context-path: /water
10 |
11 |
12 |
--------------------------------------------------------------------------------
/iframe-sso/cas-app2/src/main/webapp/assets/js/common.js:
--------------------------------------------------------------------------------
1 | /**
2 | * 获取项目根路径
3 | * 例如:http://app2.com:8282/fire
4 | * @returns {string}
5 | */
6 | function getRootPath() {
7 | var url = window.document.location.href;
8 | var pathName = window.document.location.pathname;
9 | var pos = url.indexOf(pathName);
10 | var path = url.substring(0, pos);
11 | var projectName = pathName.substring(0, pathName.substr(1).indexOf('/') + 1);
12 | return (path + projectName);
13 | }
14 |
15 | /**
16 | * 获取请求参数
17 | * 例如:http://app2.com:8282/fire?username=aaa&password=bbb,
18 | * 操作:GetQueryString('username') 返回 aaa
19 | *
20 | * @param name param 参数的 key
21 | * @returns {*} 根据 param 的 key,返回value
22 | */
23 | function GetQueryString(name) {
24 | var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
25 | var r = window.location.search.substr(1).match(reg);
26 | if (r != null) return unescape(r[2]);
27 | return null;
28 | }
29 |
--------------------------------------------------------------------------------
/iframe-sso/cas-app2/src/main/webapp/books.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 图书列表数据
6 |
7 |
8 |
9 |
31 |
32 |
33 | 访问 books.html
34 |
35 | 图书列表
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/iframe-sso/cas-app2/src/main/webapp/hello.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Hello
6 |
7 |
8 |
9 |
10 |
27 |
28 |
29 | 访问 Hello.html
30 |
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/iframe-sso/cas-app2/src/main/webapp/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Index首页
6 |
7 |
8 | 访问App2前端首页!
9 |
10 |
11 |
--------------------------------------------------------------------------------
/iframe-sso/cas-app2/src/main/webapp/login.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 登录界面
6 |
7 |
8 |
9 |
10 |
26 |
27 |
28 | Iframe方式嵌入Cas Server自定义登录页
29 |
32 |
41 |
42 |
43 |
--------------------------------------------------------------------------------
/iframe-sso/cas-app2/src/main/webapp/users.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 用户列表数据
6 |
7 |
8 |
9 |
10 |
11 |
33 |
34 |
35 | 访问 users.html
36 |
37 | 用户列表
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/iframe-sso/cas-app2/src/main/webapp/world.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | World
6 |
7 |
8 |
9 |
26 |
27 |
28 | 访问 World.html
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/iframe-sso/cas-client1/.gitignore:
--------------------------------------------------------------------------------
1 | # 忽略文件
2 | .DS_Store
3 | */.settings/
4 | */.DS_Store
5 | *.class
6 | *.iml
7 | */*.iml
8 | **/*.iml
9 | *.log
10 | .classpath
11 |
12 | # 包文件 #
13 | *.jar
14 | *.war
15 | *.zip
16 | *.tar.gz
17 | *.rar
18 |
19 | # 忽略文件夹
20 | .settings/
21 | .gradle/
22 | .externalToolBuilders/
23 |
24 | **/target/
25 | **/build/
26 | **/out/
27 | classes/
28 | **/logs/
29 | **/.idea/
30 | .idea/
31 |
32 |
--------------------------------------------------------------------------------
/iframe-sso/cas-client1/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | cas-client-springboot
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.wst.common.project.facet.core.builder
10 |
11 |
12 |
13 |
14 | org.eclipse.jdt.core.javabuilder
15 |
16 |
17 |
18 |
19 | org.springframework.ide.eclipse.core.springbuilder
20 |
21 |
22 |
23 |
24 | org.springframework.ide.eclipse.boot.validation.springbootbuilder
25 |
26 |
27 |
28 |
29 | org.eclipse.m2e.core.maven2Builder
30 |
31 |
32 |
33 |
34 |
35 | org.springframework.ide.eclipse.core.springnature
36 | org.eclipse.jdt.core.javanature
37 | org.eclipse.m2e.core.maven2Nature
38 | org.eclipse.wst.common.project.facet.core.nature
39 |
40 |
41 |
--------------------------------------------------------------------------------
/iframe-sso/cas-client1/pom.xml:
--------------------------------------------------------------------------------
1 |
3 | 4.0.0
4 |
5 | client1.com
6 | cas-client1
7 | 0.0.1-SNAPSHOT
8 | jar
9 |
10 | cas-client1
11 | http://maven.apache.org
12 |
13 |
14 |
15 | org.springframework.boot
16 | spring-boot-starter-parent
17 | 1.5.10.RELEASE
18 |
19 |
20 |
21 | UTF-8
22 | 3.5.0
23 |
24 |
25 |
26 |
27 |
28 | org.springframework.boot
29 | spring-boot-starter-web
30 |
31 |
32 |
33 | org.springframework.boot
34 | spring-boot-starter-tomcat
35 | provided
36 |
37 |
38 | org.apache.tomcat.embed
39 | tomcat-embed-jasper
40 |
41 |
42 | org.springframework.boot
43 | spring-boot-starter-test
44 | test
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 | org.springframework.boot
54 | spring-boot-maven-plugin
55 |
56 |
57 | org.springframework
58 | springloaded
59 | 1.2.4.RELEASE
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
--------------------------------------------------------------------------------
/iframe-sso/cas-client1/src/main/java/com/tingfeng/ConfigMain.java:
--------------------------------------------------------------------------------
1 | package com.tingfeng;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 |
6 | @SpringBootApplication
7 | public class ConfigMain {
8 |
9 | public static void main(String[] args) {
10 | SpringApplication.run(ConfigMain.class, args);
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/iframe-sso/cas-client1/src/main/java/com/tingfeng/controller/DemoController.java:
--------------------------------------------------------------------------------
1 | package com.tingfeng.controller;
2 |
3 | import com.tingfeng.domain.User;
4 | import org.springframework.web.bind.annotation.GetMapping;
5 | import org.springframework.web.bind.annotation.RequestMapping;
6 | import org.springframework.web.bind.annotation.RestController;
7 |
8 | import java.util.Arrays;
9 | import java.util.List;
10 |
11 | @RestController
12 | @RequestMapping("/api")
13 | public class DemoController {
14 |
15 | @RequestMapping("/world")
16 | public String world(){
17 | return "Client 1 后端 api/world 接口";
18 | }
19 |
20 | @GetMapping("/users")
21 | public List users() {
22 |
23 | List userList = Arrays.asList(
24 | new User("听风", "123456", "男", 23),
25 | new User("阿敏", "123456", "女", 22)
26 | );
27 |
28 | return userList;
29 | }
30 |
31 | @GetMapping("/books")
32 | public List books() {
33 | return Arrays.asList("《你今天真好看》","《我能咬你一口吗?》","《人性的弱点》","《原则》");
34 | }
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/iframe-sso/cas-client1/src/main/java/com/tingfeng/domain/User.java:
--------------------------------------------------------------------------------
1 | package com.tingfeng.domain;
2 |
3 | public class User {
4 |
5 | private String username;
6 | private String password;
7 | private String sex;
8 | private int age;
9 |
10 | public User() {
11 | }
12 |
13 | public User(String username, String password, String sex, int age) {
14 | this.username = username;
15 | this.password = password;
16 | this.sex = sex;
17 | this.age = age;
18 | }
19 |
20 | public String getUsername() {
21 | return username;
22 | }
23 |
24 | public void setUsername(String username) {
25 | this.username = username;
26 | }
27 |
28 | public String getPassword() {
29 | return password;
30 | }
31 |
32 | public void setPassword(String password) {
33 | this.password = password;
34 | }
35 |
36 | public String getSex() {
37 | return sex;
38 | }
39 |
40 | public void setSex(String sex) {
41 | this.sex = sex;
42 | }
43 |
44 | public int getAge() {
45 | return age;
46 | }
47 |
48 | public void setAge(int age) {
49 | this.age = age;
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/iframe-sso/cas-client1/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | logging:
2 | #日志存储地址
3 | file: "logs/config/demo-xx.log"
4 | info:
5 | name : "app1 后端接口"
6 |
7 | server:
8 | #端口号
9 | #http://client1.com:8888/
10 | port: 8888
11 | #项目名,如果不设定,默认是 /
12 | context-path: /
13 |
14 | spring:
15 | mvc:
16 | view:
17 | # 页面默认前缀目录
18 | prefix: /WEB-INF/jsp/
19 | # 响应页面默认后缀
20 | suffix: .jsp
21 |
22 |
23 |
--------------------------------------------------------------------------------
/iframe-sso/cas-client2/.gitignore:
--------------------------------------------------------------------------------
1 | # 忽略文件
2 | .DS_Store
3 | */.settings/
4 | */.DS_Store
5 | *.class
6 | *.iml
7 | */*.iml
8 | **/*.iml
9 | *.log
10 | .classpath
11 |
12 | # 包文件 #
13 | *.jar
14 | *.war
15 | *.zip
16 | *.tar.gz
17 | *.rar
18 |
19 | # 忽略文件夹
20 | .settings/
21 | .gradle/
22 | .externalToolBuilders/
23 |
24 | **/target/
25 | **/build/
26 | **/out/
27 | classes/
28 | **/logs/
29 | **/.idea/
30 | .idea/
31 |
32 |
--------------------------------------------------------------------------------
/iframe-sso/cas-client2/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | cas-client-springboot
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.wst.common.project.facet.core.builder
10 |
11 |
12 |
13 |
14 | org.eclipse.jdt.core.javabuilder
15 |
16 |
17 |
18 |
19 | org.springframework.ide.eclipse.core.springbuilder
20 |
21 |
22 |
23 |
24 | org.springframework.ide.eclipse.boot.validation.springbootbuilder
25 |
26 |
27 |
28 |
29 | org.eclipse.m2e.core.maven2Builder
30 |
31 |
32 |
33 |
34 |
35 | org.springframework.ide.eclipse.core.springnature
36 | org.eclipse.jdt.core.javanature
37 | org.eclipse.m2e.core.maven2Nature
38 | org.eclipse.wst.common.project.facet.core.nature
39 |
40 |
41 |
--------------------------------------------------------------------------------
/iframe-sso/cas-client2/src/main/java/com/tingfeng/ConfigMain.java:
--------------------------------------------------------------------------------
1 | package com.tingfeng;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 |
6 | @SpringBootApplication
7 | public class ConfigMain {
8 |
9 | public static void main(String[] args) {
10 | SpringApplication.run(ConfigMain.class, args);
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/iframe-sso/cas-client2/src/main/java/com/tingfeng/controller/DemoController.java:
--------------------------------------------------------------------------------
1 | package com.tingfeng.controller;
2 |
3 | import com.tingfeng.domain.User;
4 | import org.springframework.web.bind.annotation.GetMapping;
5 | import org.springframework.web.bind.annotation.RequestMapping;
6 | import org.springframework.web.bind.annotation.RestController;
7 |
8 | import java.util.Arrays;
9 | import java.util.List;
10 |
11 | @RestController
12 | @RequestMapping("/api")
13 | public class DemoController {
14 |
15 | @RequestMapping("/world")
16 | public String world() {
17 | return "Client 2 后端 api/world 接口";
18 | }
19 |
20 | @GetMapping("/users")
21 | public List users() {
22 |
23 | List userList = Arrays.asList(
24 | new User("X-rapido", "123456", "男", 23),
25 | new User("听风", "123456", "女", 22),
26 | new User("程序喵", "123456", "女", 22)
27 | );
28 |
29 | return userList;
30 | }
31 |
32 | @GetMapping("/books")
33 | public List books() {
34 | return Arrays.asList("《Java 编程高手之旅》", "《Python 3编程高手之旅》", "《MongoDB 编程高手之旅》", "《MySQL 编程高手之旅》");
35 | }
36 |
37 | }
38 |
--------------------------------------------------------------------------------
/iframe-sso/cas-client2/src/main/java/com/tingfeng/domain/User.java:
--------------------------------------------------------------------------------
1 | package com.tingfeng.domain;
2 |
3 | public class User {
4 |
5 | private String username;
6 | private String password;
7 | private String sex;
8 | private int age;
9 |
10 | public User() {
11 | }
12 |
13 | public User(String username, String password, String sex, int age) {
14 | this.username = username;
15 | this.password = password;
16 | this.sex = sex;
17 | this.age = age;
18 | }
19 |
20 | public String getUsername() {
21 | return username;
22 | }
23 |
24 | public void setUsername(String username) {
25 | this.username = username;
26 | }
27 |
28 | public String getPassword() {
29 | return password;
30 | }
31 |
32 | public void setPassword(String password) {
33 | this.password = password;
34 | }
35 |
36 | public String getSex() {
37 | return sex;
38 | }
39 |
40 | public void setSex(String sex) {
41 | this.sex = sex;
42 | }
43 |
44 | public int getAge() {
45 | return age;
46 | }
47 |
48 | public void setAge(int age) {
49 | this.age = age;
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/iframe-sso/cas-client2/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | logging:
2 | #日志存储地址
3 | file: "logs/config/demo-xx.log"
4 | info:
5 | name : "app2 后端接口"
6 |
7 | server:
8 | port: 8889
9 | context-path: /
10 |
11 | spring:
12 | mvc:
13 | view:
14 | # 页面默认前缀目录
15 | prefix: /WEB-INF/jsp/
16 | # 响应页面默认后缀
17 | suffix: .jsp
18 |
19 |
20 |
--------------------------------------------------------------------------------
/iframe-sso/cas-overlay-template-master/.gitignore:
--------------------------------------------------------------------------------
1 | !/.project
2 |
3 | # 忽略文件
4 | .DS_Store
5 | */.settings/
6 | */.DS_Store
7 | *.class
8 | *.iml
9 | */*.iml
10 | **/*.iml
11 | *.log
12 | .classpath
13 | .factorypath
14 |
15 | # 包文件 #
16 | *.jar
17 | *.war
18 | *.zip
19 | *.tar.gz
20 | *.rar
21 |
22 | # 忽略文件夹
23 | .settings/
24 | maven/
25 | .gradle/
26 | .externalToolBuilders/
27 |
28 | **/target/
29 | **/build/
30 | **/out/
31 | classes/
32 | **/logs/
33 | **/.idea/
34 | .idea/
35 |
36 | overlays/
--------------------------------------------------------------------------------
/iframe-sso/cas-overlay-template-master/etc/cas/casServer.crt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/iframe-sso/cas-overlay-template-master/etc/cas/casServer.crt
--------------------------------------------------------------------------------
/iframe-sso/cas-overlay-template-master/etc/cas/casServer.keystore:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/iframe-sso/cas-overlay-template-master/etc/cas/casServer.keystore
--------------------------------------------------------------------------------
/iframe-sso/cas-overlay-template-master/etc/cas/config/application.yml:
--------------------------------------------------------------------------------
1 | info:
2 | description: CAS Configuration
--------------------------------------------------------------------------------
/iframe-sso/cas-overlay-template-master/etc/cas/config/cas.properties:
--------------------------------------------------------------------------------
1 | cas.server.name: https://cas.example.com:8443
2 | cas.server.prefix: https://cas.example.com:8443/cas
3 |
4 | cas.adminPagesSecurity.ip=127\.0\.0\.1
5 |
6 | logging.config: file:/etc/cas/config/log4j2.xml
7 | # cas.serviceRegistry.config.location: classpath:/services
8 |
9 | server.ssl.keyStore=file:/etc/cas/casServer.keystore
10 | server.ssl.keyStorePassword=changeit
11 | server.ssl.keyPassword=changeit
12 | server.ssl.key-alias=cas.server.com
--------------------------------------------------------------------------------
/iframe-sso/cas-overlay-template-master/src/main/resources/app1.properties:
--------------------------------------------------------------------------------
1 |
2 | css.file=/themes/app1/css/main.css
3 | pageTitle= \u8FD9\u662FAPP 1 \u7F51\u7AD9
4 |
5 | #standard.custom.css.file=/themes/[theme_name]/css/cas.css
6 | #cas.javascript.file=/themes/[theme_name]/js/cas.js
7 |
8 | standard.custom.css.file=/css/cas.css
9 | admin.custom.css.file=/css/admin.css
10 | cas.javascript.file=/js/cas.js
--------------------------------------------------------------------------------
/iframe-sso/cas-overlay-template-master/src/main/resources/app2.properties:
--------------------------------------------------------------------------------
1 |
2 | css.file=/themes/app2/css/main.css
3 | pageTitle= \u8FD9\u662FAPP 2 \u7F51\u7AD9
4 |
5 | #standard.custom.css.file=/themes/[theme_name]/css/cas.css
6 | #cas.javascript.file=/themes/[theme_name]/js/cas.js
7 |
8 | standard.custom.css.file=/css/cas.css
9 | admin.custom.css.file=/css/admin.css
10 | cas.javascript.file=/js/cas.js
--------------------------------------------------------------------------------
/iframe-sso/cas-overlay-template-master/src/main/resources/services/HTTPSandIMAPS-10000001.json:
--------------------------------------------------------------------------------
1 | {
2 | "@class" : "org.apereo.cas.services.RegexRegisteredService",
3 | "serviceId" : "^(https|http|imaps)://.*",
4 | "name" : "HTTPS and HTTP and IMAPS",
5 | "id" : 10000001,
6 | "description" : "This service definition authorizes all application urls that support HTTPS and HTTP and IMAPS protocols.",
7 | "evaluationOrder" : 10000,
8 | "attributeReleasePolicy": {
9 | "@class": "org.apereo.cas.services.ReturnAllAttributeReleasePolicy"
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/iframe-sso/cas-overlay-template-master/src/main/resources/services/app1-100001.json:
--------------------------------------------------------------------------------
1 | {
2 | "@class": "org.apereo.cas.services.RegexRegisteredService",
3 | "serviceId": "^(https|http)://app1.*",
4 | "name": "app1",
5 | "id": 100001,
6 | "description": "这是一个app1域名下的服务,通过app1访问都允许通过",
7 | "evaluationOrder": 10,
8 | "theme": "app1",
9 | "attributeReleasePolicy": {
10 | "@class": "org.apereo.cas.services.ReturnAllAttributeReleasePolicy"
11 | }
12 | }
--------------------------------------------------------------------------------
/iframe-sso/cas-overlay-template-master/src/main/resources/services/app2-100002.json:
--------------------------------------------------------------------------------
1 | {
2 | "@class": "org.apereo.cas.services.RegexRegisteredService",
3 | "serviceId": "^(https|http)://app2.*",
4 | "name": "app2",
5 | "id": 100002,
6 | "description": "这是一个app2域名下的服务,通过app2访问都允许通过",
7 | "evaluationOrder": 11,
8 | "theme": "app2"
9 | }
--------------------------------------------------------------------------------
/iframe-sso/cas-overlay-template-master/src/main/resources/static/themes/app1/css/main.css:
--------------------------------------------------------------------------------
1 | h3 {
2 | color: pink;
3 | }
--------------------------------------------------------------------------------
/iframe-sso/cas-overlay-template-master/src/main/resources/static/themes/app2/css/main.css:
--------------------------------------------------------------------------------
1 | h3 {
2 | color: red; /**红色**/
3 | }
--------------------------------------------------------------------------------
/jdbc-sso/cas-overlay-template-master/.gitignore:
--------------------------------------------------------------------------------
1 | !/.project
2 |
3 | # 忽略文件
4 | .DS_Store
5 | */.settings/
6 | */.DS_Store
7 | *.class
8 | *.iml
9 | */*.iml
10 | **/*.iml
11 | *.log
12 | .classpath
13 | .factorypath
14 |
15 | # 包文件 #
16 | *.jar
17 | *.war
18 | *.zip
19 | *.tar.gz
20 | *.rar
21 |
22 | # 忽略文件夹
23 | .settings/
24 | maven/
25 | .gradle/
26 | .externalToolBuilders/
27 |
28 | **/target/
29 | **/build/
30 | **/out/
31 | classes/
32 | **/logs/
33 | **/.idea/
34 | .idea/
35 |
36 | overlays/
--------------------------------------------------------------------------------
/jdbc-sso/cas-overlay-template-master/etc/cas/casServer.crt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/jdbc-sso/cas-overlay-template-master/etc/cas/casServer.crt
--------------------------------------------------------------------------------
/jdbc-sso/cas-overlay-template-master/etc/cas/casServer.keystore:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/jdbc-sso/cas-overlay-template-master/etc/cas/casServer.keystore
--------------------------------------------------------------------------------
/jdbc-sso/cas-overlay-template-master/etc/cas/config/application.yml:
--------------------------------------------------------------------------------
1 | info:
2 | description: CAS Configuration
--------------------------------------------------------------------------------
/jdbc-sso/cas-overlay-template-master/etc/cas/config/cas.properties:
--------------------------------------------------------------------------------
1 | cas.server.name: https://cas.example.com:8443
2 | cas.server.prefix: https://cas.example.com:8443/cas
3 |
4 | cas.adminPagesSecurity.ip=127\.0\.0\.1
5 |
6 | logging.config: file:/etc/cas/config/log4j2.xml
7 | # cas.serviceRegistry.config.location: classpath:/services
8 |
9 | server.ssl.keyStore=file:/etc/cas/casServer.keystore
10 | server.ssl.keyStorePassword=changeit
11 | server.ssl.keyPassword=changeit
12 | server.ssl.key-alias=cas.server.com
--------------------------------------------------------------------------------
/proxy-sso/cas-overlay-template-master/.gitignore:
--------------------------------------------------------------------------------
1 | !/.project
2 |
3 | # 忽略文件
4 | .DS_Store
5 | */.settings/
6 | */.DS_Store
7 | *.class
8 | *.iml
9 | */*.iml
10 | **/*.iml
11 | *.log
12 | .classpath
13 | .factorypath
14 |
15 | # 包文件 #
16 | *.jar
17 | *.war
18 | *.zip
19 | *.tar.gz
20 | *.rar
21 |
22 | # 忽略文件夹
23 | .settings/
24 | maven/
25 | .gradle/
26 | .externalToolBuilders/
27 |
28 | **/target/
29 | **/build/
30 | **/out/
31 | classes/
32 | **/logs/
33 | **/.idea/
34 | .idea/
35 |
36 | overlays/
--------------------------------------------------------------------------------
/proxy-sso/cas-overlay-template-master/etc/cas/casServer.crt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/proxy-sso/cas-overlay-template-master/etc/cas/casServer.crt
--------------------------------------------------------------------------------
/proxy-sso/cas-overlay-template-master/etc/cas/casServer.keystore:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/proxy-sso/cas-overlay-template-master/etc/cas/casServer.keystore
--------------------------------------------------------------------------------
/proxy-sso/cas-overlay-template-master/etc/cas/config/application.yml:
--------------------------------------------------------------------------------
1 | info:
2 | description: CAS Configuration
--------------------------------------------------------------------------------
/proxy-sso/cas-overlay-template-master/etc/cas/config/cas.properties:
--------------------------------------------------------------------------------
1 | cas.server.name: https://cas.example.com:8443
2 | cas.server.prefix: https://cas.example.com:8443/cas
3 |
4 | cas.adminPagesSecurity.ip=127\.0\.0\.1
5 |
6 | logging.config: file:/etc/cas/config/log4j2.xml
7 | # cas.serviceRegistry.config.location: classpath:/services
8 |
9 | server.ssl.keyStore=file:/etc/cas/casServer.keystore
10 | server.ssl.keyStorePassword=changeit
11 | server.ssl.keyPassword=changeit
12 | server.ssl.key-alias=cas.server.com
--------------------------------------------------------------------------------
/proxy-sso/cas-overlay-template-master/src/main/resources/app1.properties:
--------------------------------------------------------------------------------
1 |
2 | css.file=/themes/app1/css/main.css
3 | pageTitle= \u8FD9\u662FAPP 1 \u7F51\u7AD9
4 |
5 | #standard.custom.css.file=/themes/[theme_name]/css/cas.css
6 | #cas.javascript.file=/themes/[theme_name]/js/cas.js
7 |
8 | standard.custom.css.file=/css/cas.css
9 | admin.custom.css.file=/css/admin.css
10 | cas.javascript.file=/js/cas.js
--------------------------------------------------------------------------------
/proxy-sso/cas-overlay-template-master/src/main/resources/app2.properties:
--------------------------------------------------------------------------------
1 |
2 | css.file=/themes/app2/css/main.css
3 | pageTitle= \u8FD9\u662FAPP 2 \u7F51\u7AD9
4 |
5 | #standard.custom.css.file=/themes/[theme_name]/css/cas.css
6 | #cas.javascript.file=/themes/[theme_name]/js/cas.js
7 |
8 | standard.custom.css.file=/css/cas.css
9 | admin.custom.css.file=/css/admin.css
10 | cas.javascript.file=/js/cas.js
--------------------------------------------------------------------------------
/proxy-sso/cas-overlay-template-master/src/main/resources/services/HTTPSandIMAPS-10000001.json:
--------------------------------------------------------------------------------
1 | {
2 | "@class" : "org.apereo.cas.services.RegexRegisteredService",
3 | "serviceId" : "^(https|http|imaps)://.*",
4 | "name" : "HTTPS and HTTP and IMAPS",
5 | "id" : 10000001,
6 | "description" : "This service definition authorizes all application urls that support HTTPS and HTTP and IMAPS protocols.",
7 | "evaluationOrder" : 10000,
8 | "attributeReleasePolicy": {
9 | "@class": "org.apereo.cas.services.ReturnAllAttributeReleasePolicy"
10 | },
11 | "proxyPolicy": {
12 | "@class": "org.apereo.cas.services.RegexMatchingRegisteredServiceProxyPolicy",
13 | "pattern": "^(https|http)?://.*"
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/proxy-sso/cas-overlay-template-master/src/main/resources/services/app1-100001.json:
--------------------------------------------------------------------------------
1 | {
2 | "@class": "org.apereo.cas.services.RegexRegisteredService",
3 | "serviceId": "^(https|http)://app1.*",
4 | "name": "app1",
5 | "id": 100001,
6 | "description": "这是一个app1域名下的服务,通过app1访问都允许通过",
7 | "evaluationOrder": 10,
8 | "theme": "app1",
9 | "attributeReleasePolicy": {
10 | "@class": "org.apereo.cas.services.ReturnAllAttributeReleasePolicy"
11 | }
12 | }
--------------------------------------------------------------------------------
/proxy-sso/cas-overlay-template-master/src/main/resources/services/app2-100002.json:
--------------------------------------------------------------------------------
1 | {
2 | "@class": "org.apereo.cas.services.RegexRegisteredService",
3 | "serviceId": "^(https|http)://app2.*",
4 | "name": "app2",
5 | "id": 100002,
6 | "description": "这是一个app2域名下的服务,通过app2访问都允许通过",
7 | "evaluationOrder": 11,
8 | "theme": "app2"
9 | }
--------------------------------------------------------------------------------
/proxy-sso/cas-overlay-template-master/src/main/resources/static/themes/app1/css/main.css:
--------------------------------------------------------------------------------
1 | h3 {
2 | color: pink;
3 | }
--------------------------------------------------------------------------------
/proxy-sso/cas-overlay-template-master/src/main/resources/static/themes/app2/css/main.css:
--------------------------------------------------------------------------------
1 | h3 {
2 | color: red; /**红色**/
3 | }
--------------------------------------------------------------------------------
/proxy-sso/client1/.gitignore:
--------------------------------------------------------------------------------
1 | # 忽略文件
2 | .DS_Store
3 | */.settings/
4 | */.DS_Store
5 | *.class
6 | *.iml
7 | */*.iml
8 | **/*.iml
9 | *.log
10 | .classpath
11 |
12 | # 包文件 #
13 | *.jar
14 | *.war
15 | *.zip
16 | *.tar.gz
17 | *.rar
18 |
19 | # 忽略文件夹
20 | .settings/
21 | .gradle/
22 | .externalToolBuilders/
23 |
24 | **/target/
25 | **/build/
26 | **/out/
27 | classes/
28 | **/logs/
29 | **/.idea/
30 | .idea/
31 |
32 |
--------------------------------------------------------------------------------
/proxy-sso/client1/src/main/java/com/tingfeng/cas/auth/SimpleUrlPatternMatcherStrategy.java:
--------------------------------------------------------------------------------
1 | package com.tingfeng.cas.auth;
2 |
3 | import org.jasig.cas.client.authentication.UrlPatternMatcherStrategy;
4 |
5 | import java.util.Arrays;
6 | import java.util.List;
7 |
8 | /**
9 | * 机能概要:过滤掉一些不需要授权登录的URL
10 | */
11 | public class SimpleUrlPatternMatcherStrategy implements UrlPatternMatcherStrategy {
12 |
13 | /**
14 | * 机能概要: 判断是否匹配这个字符串
15 | *
16 | * @param url 用户请求的连接
17 | * @return true : 不拦截
18 | * false :必须得登录了
19 | */
20 | @Override
21 | public boolean matches(String url) {
22 |
23 | List list = Arrays.asList(
24 | "/",
25 | "/index",
26 | "/world",
27 | "/favicon.ico"
28 | );
29 |
30 | String name = url.substring(url.lastIndexOf("/"));
31 | if (name.indexOf("?") != -1) {
32 | name = name.substring(0, name.indexOf("?"));
33 | }
34 | System.out.println("name:" + name);
35 | boolean result = list.contains(name);
36 | if (!result) {
37 | System.out.println("拦截URL:" + url);
38 | }
39 | return result;
40 | }
41 |
42 | /**
43 | * 正则表达式的规则,这个地方可以是web传递过来的
44 | */
45 | @Override
46 | public void setPattern(String pattern) {
47 |
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/proxy-sso/client1/src/main/java/com/tingfeng/cas/config/CasConfig.java:
--------------------------------------------------------------------------------
1 | package com.tingfeng.cas.config;
2 |
3 | /**
4 | * Cas 的一些配置项
5 | */
6 | public class CasConfig {
7 |
8 | /**
9 | * 当前应用程序的baseUrl(注意最后面的斜线)
10 | */
11 | public static String SERVER_NAME = "https://client1.com:8888/";
12 |
13 | /**
14 | * 代理回调地址
15 | */
16 | public static String PROXY_CALLBACK_URL = "https://client1.com:8888/proxy/callback";
17 |
18 | /**
19 | * CAS服务器地址
20 | */
21 | public static String CAS_SERVER_PATH = "https://cas.server.com:8443/cas";
22 |
23 | /**
24 | * CAS登陆服务器地址
25 | */
26 | public static String CAS_SERVER_LOGIN_PATH = "https://cas.server.com:8443/cas/login";
27 |
28 | /**
29 | * CAS登出服务器地址
30 | */
31 | public static String CAS_SERVER_LOGOUT_PATH = "https://cas.server.com:8443/cas/logout";
32 |
33 |
34 | }
35 |
--------------------------------------------------------------------------------
/proxy-sso/client1/src/main/java/com/tingfeng/controller/BookController.java:
--------------------------------------------------------------------------------
1 | package com.tingfeng.controller;
2 |
3 | import org.springframework.web.bind.annotation.GetMapping;
4 | import org.springframework.web.bind.annotation.RequestMapping;
5 | import org.springframework.web.bind.annotation.RestController;
6 |
7 | import java.util.Arrays;
8 | import java.util.List;
9 |
10 | @RestController
11 | @RequestMapping("/book")
12 | public class BookController {
13 |
14 | @GetMapping("/books")
15 | public List books() {
16 | return Arrays.asList("《项塔兰》", "《肖申克的救赎?》", "《人类的群星闪耀时》", "《当我跑步时,我谈些什么》");
17 | }
18 |
19 | }
20 |
--------------------------------------------------------------------------------
/proxy-sso/client1/src/main/java/com/tingfeng/controller/IndexController.java:
--------------------------------------------------------------------------------
1 | package com.tingfeng.controller;
2 |
3 | import org.springframework.web.bind.annotation.RequestMapping;
4 | import org.springframework.web.bind.annotation.RestController;
5 |
6 | @RestController
7 | public class IndexController {
8 |
9 | @RequestMapping("/index")
10 | public String index(){
11 | return "Client 1 后端 index 接口";
12 | }
13 |
14 | @RequestMapping("/world")
15 | public String world(){
16 | return "Client 1 后端 api/world 接口";
17 | }
18 |
19 | }
20 |
--------------------------------------------------------------------------------
/proxy-sso/client1/src/main/java/com/tingfeng/controller/UserController.java:
--------------------------------------------------------------------------------
1 | package com.tingfeng.controller;
2 |
3 | import com.tingfeng.domain.User;
4 | import org.springframework.stereotype.Controller;
5 | import org.springframework.web.bind.annotation.GetMapping;
6 | import org.springframework.web.bind.annotation.RequestMapping;
7 | import org.springframework.web.bind.annotation.ResponseBody;
8 |
9 | import java.util.Arrays;
10 | import java.util.List;
11 |
12 | @Controller
13 | @RequestMapping("/user")
14 | public class UserController {
15 |
16 | @GetMapping("/users")
17 | @ResponseBody
18 | public List users() {
19 |
20 | List userList = Arrays.asList(
21 | new User("Jack", "123456", "男", 23),
22 | new User("Rose", "123456", "女", 22)
23 | );
24 |
25 | return userList;
26 | }
27 |
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/proxy-sso/client1/src/main/java/com/tingfeng/domain/User.java:
--------------------------------------------------------------------------------
1 | package com.tingfeng.domain;
2 |
3 | public class User {
4 |
5 | private String username;
6 | private String password;
7 | private String sex;
8 | private int age;
9 |
10 | public User() {
11 | }
12 |
13 | public User(String username, String password, String sex, int age) {
14 | this.username = username;
15 | this.password = password;
16 | this.sex = sex;
17 | this.age = age;
18 | }
19 |
20 | public String getUsername() {
21 | return username;
22 | }
23 |
24 | public void setUsername(String username) {
25 | this.username = username;
26 | }
27 |
28 | public String getPassword() {
29 | return password;
30 | }
31 |
32 | public void setPassword(String password) {
33 | this.password = password;
34 | }
35 |
36 | public String getSex() {
37 | return sex;
38 | }
39 |
40 | public void setSex(String sex) {
41 | this.sex = sex;
42 | }
43 |
44 | public int getAge() {
45 | return age;
46 | }
47 |
48 | public void setAge(int age) {
49 | this.age = age;
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/proxy-sso/client1/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 |
2 | logging:
3 | #日志存储地址
4 | file: "logs/app-client.log"
5 | info:
6 | name : "App 后端接口"
7 |
8 | server:
9 | #端口号
10 | port: 8888
11 | context-path: /
12 | address: client1.com
13 | ssl:
14 | key-store: classpath:key/client1.keystore
15 | key-alias: client1.com
16 | key-store-password: changeit
17 |
18 |
19 | spring:
20 | mvc:
21 | view:
22 | # 页面默认前缀目录
23 | prefix: /WEB-INF/jsp/
24 | # 响应页面默认后缀
25 | suffix: .jsp
--------------------------------------------------------------------------------
/proxy-sso/client1/src/main/resources/key/client1.crt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/proxy-sso/client1/src/main/resources/key/client1.crt
--------------------------------------------------------------------------------
/proxy-sso/client1/src/main/resources/key/client1.keystore:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/proxy-sso/client1/src/main/resources/key/client1.keystore
--------------------------------------------------------------------------------
/proxy-sso/client2/.gitignore:
--------------------------------------------------------------------------------
1 | # 忽略文件
2 | .DS_Store
3 | */.settings/
4 | */.DS_Store
5 | *.class
6 | *.iml
7 | */*.iml
8 | **/*.iml
9 | *.log
10 | .classpath
11 |
12 | # 包文件 #
13 | *.jar
14 | *.war
15 | *.zip
16 | *.tar.gz
17 | *.rar
18 |
19 | # 忽略文件夹
20 | .settings/
21 | .gradle/
22 | .externalToolBuilders/
23 |
24 | **/target/
25 | **/build/
26 | **/out/
27 | classes/
28 | **/logs/
29 | **/.idea/
30 | .idea/
31 |
32 |
--------------------------------------------------------------------------------
/proxy-sso/client2/src/main/java/com/tingfeng/cas/auth/SimpleUrlPatternMatcherStrategy.java:
--------------------------------------------------------------------------------
1 | package com.tingfeng.cas.auth;
2 |
3 | import org.jasig.cas.client.authentication.UrlPatternMatcherStrategy;
4 |
5 | import java.util.Arrays;
6 | import java.util.List;
7 |
8 | /**
9 | * 机能概要:过滤掉一些不需要授权登录的URL
10 | */
11 | public class SimpleUrlPatternMatcherStrategy implements UrlPatternMatcherStrategy {
12 |
13 | /**
14 | * 机能概要: 判断是否匹配这个字符串
15 | *
16 | * @param url 用户请求的连接
17 | * @return true : 不拦截
18 | * false :必须得登录了
19 | */
20 | @Override
21 | public boolean matches(String url) {
22 |
23 | List list = Arrays.asList(
24 | "/",
25 | "/index",
26 | "/login",
27 | "/world",
28 | // "/proxyCallback", // cas代理回调地址
29 | "/favicon.ico"
30 | );
31 |
32 | String name = url.substring(url.lastIndexOf("/"));
33 | if (name.indexOf("?") != -1) {
34 | name = name.substring(0, name.indexOf("?"));
35 | }
36 | System.out.println("name:" + name);
37 | boolean result = list.contains(name);
38 | if (!result) {
39 | System.out.println("拦截URL:" + url);
40 | }
41 | return result;
42 | }
43 |
44 | /**
45 | * 正则表达式的规则,这个地方可以是web传递过来的
46 | */
47 | @Override
48 | public void setPattern(String pattern) {
49 |
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/proxy-sso/client2/src/main/java/com/tingfeng/cas/config/CasConfig.java:
--------------------------------------------------------------------------------
1 | package com.tingfeng.cas.config;
2 |
3 | /**
4 | * Cas 的一些配置项
5 | */
6 | public class CasConfig {
7 |
8 | /**
9 | * 当前应用程序的baseUrl(注意最后面的斜线)
10 | */
11 | public static String SERVER_NAME = "http://client2.com:8889/";
12 |
13 | /**
14 | * CAS服务器地址
15 | */
16 | public static String CAS_SERVER_PATH = "https://cas.server.com:8443/cas";
17 |
18 | /**
19 | * CAS登陆服务器地址
20 | */
21 | public static String CAS_SERVER_LOGIN_PATH = "https://cas.server.com:8443/cas/login";
22 |
23 | /**
24 | * CAS登出服务器地址
25 | */
26 | public static String CAS_SERVER_LOGOUT_PATH = "https://cas.server.com:8443/cas/logout";
27 |
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/proxy-sso/client2/src/main/java/com/tingfeng/controller/BookController.java:
--------------------------------------------------------------------------------
1 | package com.tingfeng.controller;
2 |
3 | import org.springframework.web.bind.annotation.GetMapping;
4 | import org.springframework.web.bind.annotation.RequestMapping;
5 | import org.springframework.web.bind.annotation.RestController;
6 |
7 | import java.util.Arrays;
8 | import java.util.List;
9 |
10 | @RestController
11 | @RequestMapping("/book")
12 | public class BookController {
13 |
14 | @GetMapping("/books")
15 | public List books() {
16 | return Arrays.asList("《你今天真好看》", "《我能咬你一口吗?》", "《人性的弱点》", "《原则》");
17 | }
18 |
19 | }
20 |
--------------------------------------------------------------------------------
/proxy-sso/client2/src/main/java/com/tingfeng/controller/IndexController.java:
--------------------------------------------------------------------------------
1 | package com.tingfeng.controller;
2 |
3 | import org.springframework.web.bind.annotation.RequestMapping;
4 | import org.springframework.web.bind.annotation.RestController;
5 |
6 | @RestController
7 | public class IndexController {
8 |
9 | @RequestMapping("/index")
10 | public String index(){
11 | return "Client 2 后端 index 接口";
12 | }
13 |
14 | @RequestMapping("/world")
15 | public String world(){
16 | return "Client 2 后端 api/world 接口";
17 | }
18 |
19 | }
20 |
--------------------------------------------------------------------------------
/proxy-sso/client2/src/main/java/com/tingfeng/controller/UserController.java:
--------------------------------------------------------------------------------
1 | package com.tingfeng.controller;
2 |
3 | import com.tingfeng.domain.User;
4 | import org.springframework.stereotype.Controller;
5 | import org.springframework.web.bind.annotation.GetMapping;
6 | import org.springframework.web.bind.annotation.RequestMapping;
7 | import org.springframework.web.bind.annotation.ResponseBody;
8 |
9 | import java.util.Arrays;
10 | import java.util.List;
11 |
12 | @Controller
13 | @RequestMapping("/user")
14 | public class UserController {
15 |
16 | @GetMapping("/users")
17 | @ResponseBody
18 | public List users() {
19 |
20 | List userList = Arrays.asList(
21 | new User("听风", "123456", "男", 23),
22 | new User("安琪儿", "123456", "女", 22)
23 | );
24 |
25 | return userList;
26 | }
27 |
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/proxy-sso/client2/src/main/java/com/tingfeng/domain/User.java:
--------------------------------------------------------------------------------
1 | package com.tingfeng.domain;
2 |
3 | public class User {
4 |
5 | private String username;
6 | private String password;
7 | private String sex;
8 | private int age;
9 |
10 | public User() {
11 | }
12 |
13 | public User(String username, String password, String sex, int age) {
14 | this.username = username;
15 | this.password = password;
16 | this.sex = sex;
17 | this.age = age;
18 | }
19 |
20 | public String getUsername() {
21 | return username;
22 | }
23 |
24 | public void setUsername(String username) {
25 | this.username = username;
26 | }
27 |
28 | public String getPassword() {
29 | return password;
30 | }
31 |
32 | public void setPassword(String password) {
33 | this.password = password;
34 | }
35 |
36 | public String getSex() {
37 | return sex;
38 | }
39 |
40 | public void setSex(String sex) {
41 | this.sex = sex;
42 | }
43 |
44 | public int getAge() {
45 | return age;
46 | }
47 |
48 | public void setAge(int age) {
49 | this.age = age;
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/proxy-sso/client2/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 |
2 | logging:
3 | #日志存储地址
4 | file: "logs/app-client2.log"
5 | info:
6 | name : "App2 后端接口"
7 |
8 | server:
9 | #端口号
10 | port: 8889
11 | context-path: /
12 | address: client2.com
13 |
14 | spring:
15 | mvc:
16 | view:
17 | # 页面默认前缀目录
18 | prefix: /WEB-INF/jsp/
19 | # 响应页面默认后缀
20 | suffix: .jsp
21 |
--------------------------------------------------------------------------------
/rest-sso/cas-overlay-template-master/.gitignore:
--------------------------------------------------------------------------------
1 | !/.project
2 |
3 | # 忽略文件
4 | .DS_Store
5 | */.settings/
6 | */.DS_Store
7 | *.class
8 | *.iml
9 | */*.iml
10 | **/*.iml
11 | *.log
12 | .classpath
13 | .factorypath
14 |
15 | # 包文件 #
16 | *.jar
17 | *.war
18 | *.zip
19 | *.tar.gz
20 | *.rar
21 |
22 | # 忽略文件夹
23 | .settings/
24 | maven/
25 | .gradle/
26 | .externalToolBuilders/
27 |
28 | **/target/
29 | **/build/
30 | **/out/
31 | classes/
32 | **/logs/
33 | **/.idea/
34 | .idea/
35 |
36 | overlays/
--------------------------------------------------------------------------------
/rest-sso/cas-overlay-template-master/etc/cas/casServer.crt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/rest-sso/cas-overlay-template-master/etc/cas/casServer.crt
--------------------------------------------------------------------------------
/rest-sso/cas-overlay-template-master/etc/cas/casServer.keystore:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/rest-sso/cas-overlay-template-master/etc/cas/casServer.keystore
--------------------------------------------------------------------------------
/rest-sso/cas-overlay-template-master/etc/cas/config/application.yml:
--------------------------------------------------------------------------------
1 | info:
2 | description: CAS Configuration
--------------------------------------------------------------------------------
/rest-sso/cas-overlay-template-master/etc/cas/config/cas.properties:
--------------------------------------------------------------------------------
1 | cas.server.name: https://cas.example.com:8443
2 | cas.server.prefix: https://cas.example.com:8443/cas
3 |
4 | cas.adminPagesSecurity.ip=127\.0\.0\.1
5 |
6 | logging.config: file:/etc/cas/config/log4j2.xml
7 | # cas.serviceRegistry.config.location: classpath:/services
8 |
9 | server.ssl.keyStore=file:/etc/cas/casServer.keystore
10 | server.ssl.keyStorePassword=changeit
11 | server.ssl.keyPassword=changeit
12 | server.ssl.key-alias=cas.server.com
--------------------------------------------------------------------------------
/rest-sso/cas_db/.gitignore:
--------------------------------------------------------------------------------
1 | .gradle
2 | /build/
3 | !gradle/wrapper/gradle-wrapper.jar
4 |
5 | ### STS ###
6 | .apt_generated
7 | .classpath
8 | .factorypath
9 | .project
10 | .settings
11 | .springBeans
12 | .sts4-cache
13 |
14 | ### IntelliJ IDEA ###
15 | .idea
16 | *.iws
17 | *.iml
18 | *.ipr
19 |
20 | ### NetBeans ###
21 | /nbproject/private/
22 | /build/
23 | /nbbuild/
24 | /dist/
25 | /nbdist/
26 | /.nb-gradle/
--------------------------------------------------------------------------------
/rest-sso/cas_db/build.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 | ext {
3 | springBootVersion = '1.5.12.RELEASE'
4 | }
5 | repositories {
6 | mavenCentral()
7 | }
8 | dependencies {
9 | classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
10 | }
11 | }
12 |
13 | apply plugin: 'java'
14 | apply plugin: 'eclipse'
15 | apply plugin: 'org.springframework.boot'
16 | apply plugin: 'io.spring.dependency-management'
17 |
18 | group = 'com.tingfeng'
19 | version = '0.0.1-SNAPSHOT'
20 | sourceCompatibility = 1.8
21 |
22 | repositories {
23 | mavenCentral()
24 | }
25 |
26 |
27 | dependencies {
28 | compile('org.springframework.boot:spring-boot-starter-web')
29 | compile('org.mybatis.spring.boot:mybatis-spring-boot-starter:1.3.2')
30 | runtime('mysql:mysql-connector-java')
31 | }
32 |
--------------------------------------------------------------------------------
/rest-sso/cas_db/settings.gradle:
--------------------------------------------------------------------------------
1 | rootProject.name = 'cas_db'
2 |
--------------------------------------------------------------------------------
/rest-sso/cas_db/src/main/java/com/tingfeng/AppRun.java:
--------------------------------------------------------------------------------
1 | package com.tingfeng;
2 |
3 | import org.mybatis.spring.annotation.MapperScan;
4 | import org.springframework.boot.SpringApplication;
5 | import org.springframework.boot.autoconfigure.SpringBootApplication;
6 |
7 | @SpringBootApplication
8 | @MapperScan("com.tingfeng.mapper")
9 | public class AppRun {
10 |
11 | public static void main(String[] args) {
12 | SpringApplication.run(AppRun.class, args);
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/rest-sso/cas_db/src/main/java/com/tingfeng/mapper/SysUserMapper.java:
--------------------------------------------------------------------------------
1 | package com.tingfeng.mapper;
2 |
3 | import com.tingfeng.domain.SysUser;
4 | import org.apache.ibatis.annotations.Select;
5 |
6 | public interface SysUserMapper {
7 |
8 | @Select("select * from sys_user where username=#{username}")
9 | SysUser getSysUser(String username);
10 |
11 | }
12 |
--------------------------------------------------------------------------------
/rest-sso/cas_db/src/main/resources/application.properties:
--------------------------------------------------------------------------------
1 |
2 | server.port=8080
3 | spring.application.name=Auth Rest Client
4 |
5 | server.context-path=/cas_db
6 |
7 |
8 | spring.datasource.username=casuser
9 | spring.datasource.password=casuser
10 | spring.datasource.url=jdbc:mysql://127.0.0.1:3306/cas_sso_record?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false
11 |
12 |
13 |
14 | logging.level.com.tingfeng=debug
--------------------------------------------------------------------------------
/restful-api-sso/cas-app1/.gitignore:
--------------------------------------------------------------------------------
1 |
2 | # 以斜杠“/”开头表示目录;
3 | # 以星号“*”通配多个字符;
4 | # 以问号“?”通配单个字符
5 | # 以方括号“[]”包含单个字符的匹配列表;
6 | # 以叹号“!”表示不忽略(跟踪)匹配到的文件或目录;
7 |
8 | # 忽略文件
9 | .DS_Store
10 | */.settings/
11 | */.DS_Store
12 | *.class
13 | *.iml
14 | */*.iml
15 | **/*.iml
16 | *.log
17 | .classpath
18 |
19 | # 包文件 #
20 | *.jar
21 | *.war
22 | *.zip
23 | *.tar.gz
24 | *.rar
25 |
26 | # 忽略文件夹
27 | .settings/
28 | .gradle/
29 | .externalToolBuilders/
30 |
31 | **/target/
32 | **/build/
33 | **/out/
34 | classes/
35 | **/logs/
36 | **/.idea/
37 | .idea/
38 |
39 |
--------------------------------------------------------------------------------
/restful-api-sso/cas-app1/src/main/java/com/tingfeng/cas/auth/SimpleUrlPatternMatcherStrategy.java:
--------------------------------------------------------------------------------
1 | package com.tingfeng.cas.auth;
2 |
3 | import org.jasig.cas.client.authentication.UrlPatternMatcherStrategy;
4 |
5 | import java.util.Arrays;
6 | import java.util.List;
7 |
8 | /**
9 | * 机能概要:过滤掉一些不需要授权登录的URL
10 | */
11 | public class SimpleUrlPatternMatcherStrategy implements UrlPatternMatcherStrategy {
12 |
13 | /**
14 | * 机能概要: 判断是否匹配这个字符串
15 | *
16 | * @param url 用户请求的连接
17 | * @return true : 不拦截
18 | * false :必须得登录了
19 | */
20 | @Override
21 | public boolean matches(String url) {
22 |
23 | List list = Arrays.asList(
24 | "/index.html",
25 | "/login.html",
26 | "/hello.html",
27 | "/world.html",
28 | "/favicon.ico");
29 |
30 | String name = url.substring(url.lastIndexOf("/"));
31 |
32 | // String url = "http://app1.com:8181/login.html?service=http%3A%2F%2Fapp1.com%3A8181%2Fusers.html";
33 | // 为了防止出现匹配中,忽略了后续参数的URL,出现比如:/login.html?service=http%3A%2F%2Fapp1.com%3A8181%2Fusers.html 现象
34 | // 这种现象,会导致重定向过多异常,所以,不管什么url,只取出请求的最终 file.html 即可
35 |
36 | if (name.indexOf("?") != -1) {
37 | name = name.substring(0, name.indexOf("?"));
38 | }
39 | boolean result = list.contains(name);
40 | if (!result) {
41 | System.out.println("拦截URL:" + url);
42 | }
43 | return result;
44 | }
45 |
46 | /**
47 | * 正则表达式的规则,这个地方可以是web传递过来的
48 | */
49 | @Override
50 | public void setPattern(String pattern) {
51 |
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/restful-api-sso/cas-app1/src/main/java/com/tingfeng/cas/config/CasConfig.java:
--------------------------------------------------------------------------------
1 | package com.tingfeng.cas.config;
2 |
3 | /**
4 | * Cas 的一些配置项
5 | */
6 | public class CasConfig {
7 |
8 | /**
9 | * 当前应用程序的baseUrl(注意最后面的斜线)
10 | */
11 | public static String SERVER_NAME = "http://app1.com:8181/fire/";
12 |
13 | /**
14 | * 当前应用程序的登陆界面
15 | */
16 | public static String APP_LOGIN_PAGE = "http://app1.com:8181/fire/login.html";
17 |
18 |
19 | /**
20 | * CAS服务器地址
21 | */
22 | public static String CAS_SERVER_PATH = "https://cas.server.com:8443/cas";
23 |
24 | /**
25 | * CAS登陆服务器地址
26 | */
27 | public static String CAS_SERVER_LOGIN_PATH = "https://cas.server.com:8443/cas/login";
28 |
29 | /**
30 | * CAS登出服务器地址
31 | */
32 | public static String CAS_SERVER_LOGOUT_PATH = "https://cas.server.com:8443/cas/logout";
33 |
34 |
35 | }
36 |
--------------------------------------------------------------------------------
/restful-api-sso/cas-app1/src/main/java/com/tingfeng/controller/DemoController.java:
--------------------------------------------------------------------------------
1 | package com.tingfeng.controller;
2 |
3 | import com.google.gson.Gson;
4 | import com.tingfeng.domain.User;
5 | import com.tingfeng.utils.HttpProxy;
6 | import org.springframework.http.HttpMethod;
7 | import org.springframework.web.bind.annotation.GetMapping;
8 | import org.springframework.web.bind.annotation.RequestMapping;
9 | import org.springframework.web.bind.annotation.RestController;
10 |
11 | import java.util.List;
12 |
13 | @RestController
14 | @RequestMapping("/api")
15 | public class DemoController {
16 |
17 | private static String API_BASE_URL = "http://client1.com:8888/";
18 |
19 | @GetMapping("/hello")
20 | public String hello() {
21 | return "前端 Hello 接口响应";
22 | }
23 |
24 | @GetMapping("/world")
25 | public String world() {
26 |
27 | String result = HttpProxy.httpRequest(API_BASE_URL + "/world", null, HttpMethod.GET);
28 | System.out.println("Client1 接口响应结果:" + result);
29 |
30 | return result;
31 | }
32 |
33 | @GetMapping("/users")
34 | public List users() {
35 | String result = HttpProxy.httpRequest(API_BASE_URL + "/user/users", null, HttpMethod.GET);
36 | System.out.println("Client1 接口响应结果:" + result);
37 |
38 | if (null != result && !result.equals("")) {
39 | Gson gson = new Gson();
40 | List userList = gson.fromJson(result, List.class);
41 | return userList;
42 | }
43 |
44 | return null;
45 | }
46 |
47 | @GetMapping("/books")
48 | public List books() {
49 |
50 | String result = HttpProxy.httpRequest(API_BASE_URL + "/book/books", null, HttpMethod.GET);
51 | System.out.println("Client1 接口响应结果:" + result);
52 |
53 | if (null != result && !result.equals("")) {
54 | Gson gson = new Gson();
55 | List nameList = gson.fromJson(result, List.class);
56 | return nameList;
57 | }
58 |
59 | return null;
60 | }
61 |
62 | }
63 |
--------------------------------------------------------------------------------
/restful-api-sso/cas-app1/src/main/java/com/tingfeng/domain/User.java:
--------------------------------------------------------------------------------
1 | package com.tingfeng.domain;
2 |
3 | public class User {
4 |
5 | private String username;
6 | private String password;
7 | private String sex;
8 | private int age;
9 |
10 | public User() {
11 | }
12 |
13 | public User(String username, String password, String sex, int age) {
14 | this.username = username;
15 | this.password = password;
16 | this.sex = sex;
17 | this.age = age;
18 | }
19 |
20 | public String getUsername() {
21 | return username;
22 | }
23 |
24 | public void setUsername(String username) {
25 | this.username = username;
26 | }
27 |
28 | public String getPassword() {
29 | return password;
30 | }
31 |
32 | public void setPassword(String password) {
33 | this.password = password;
34 | }
35 |
36 | public String getSex() {
37 | return sex;
38 | }
39 |
40 | public void setSex(String sex) {
41 | this.sex = sex;
42 | }
43 |
44 | public int getAge() {
45 | return age;
46 | }
47 |
48 | public void setAge(int age) {
49 | this.age = age;
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/restful-api-sso/cas-app1/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | logging:
2 | file: "logs/app1.log"
3 | level: warn
4 | info:
5 | name : "前端 App1 项目"
6 |
7 | server:
8 | port: 8181
9 | context-path: /fire
10 | address: app1.com
--------------------------------------------------------------------------------
/restful-api-sso/cas-app1/src/main/webapp/assets/js/common.js:
--------------------------------------------------------------------------------
1 | /**
2 | * 获取项目根路径
3 | * 例如:http://app1.com:8181/fire
4 | * @returns {string}
5 | */
6 | function getRootPath() {
7 | var url = window.document.location.href;
8 | var pathName = window.document.location.pathname;
9 | var pos = url.indexOf(pathName);
10 | var path = url.substring(0, pos);
11 | var projectName = pathName.substring(0, pathName.substr(1).indexOf('/') + 1);
12 | return (path + projectName);
13 | }
14 |
15 | /**
16 | * 获取请求参数
17 | * 例如:http://app1.com:8181/fire?username=aaa&password=bbb,
18 | * 操作:GetQueryString('username') 返回 aaa
19 | *
20 | * @param name param 参数的 key
21 | * @returns {*} 根据 param 的 key,返回value
22 | */
23 | function GetQueryString(name) {
24 | var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
25 | var r = window.location.search.substr(1).match(reg);
26 | if (r != null) return unescape(r[2]);
27 | return null;
28 | }
29 |
--------------------------------------------------------------------------------
/restful-api-sso/cas-app1/src/main/webapp/books.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 图书列表数据
6 |
7 |
8 |
9 |
31 |
32 |
33 | 访问 books.html
34 |
35 | 图书列表
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/restful-api-sso/cas-app1/src/main/webapp/hello.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Hello
6 |
7 |
8 |
9 |
10 |
27 |
28 |
29 | 访问 Hello.html
30 |
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/restful-api-sso/cas-app1/src/main/webapp/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Index首页
6 |
7 |
8 | 访问App1 前端首页!
9 |
10 |
11 |
--------------------------------------------------------------------------------
/restful-api-sso/cas-app1/src/main/webapp/users.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 用户列表数据
6 |
7 |
8 |
9 |
10 |
11 |
33 |
34 |
35 | 访问 users.html
36 |
37 | 用户列表
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/restful-api-sso/cas-app1/src/main/webapp/world.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | World
6 |
7 |
8 |
9 |
26 |
27 |
28 | 访问 World.html
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/restful-api-sso/cas-app2/.gitignore:
--------------------------------------------------------------------------------
1 |
2 | # 以斜杠“/”开头表示目录;
3 | # 以星号“*”通配多个字符;
4 | # 以问号“?”通配单个字符
5 | # 以方括号“[]”包含单个字符的匹配列表;
6 | # 以叹号“!”表示不忽略(跟踪)匹配到的文件或目录;
7 |
8 | # 忽略文件
9 | .DS_Store
10 | */.settings/
11 | */.DS_Store
12 | *.class
13 | *.iml
14 | */*.iml
15 | **/*.iml
16 | *.log
17 | .classpath
18 |
19 | # 包文件 #
20 | *.jar
21 | *.war
22 | *.zip
23 | *.tar.gz
24 | *.rar
25 |
26 | # 忽略文件夹
27 | .settings/
28 | .gradle/
29 | .externalToolBuilders/
30 |
31 | **/target/
32 | **/build/
33 | **/out/
34 | classes/
35 | **/logs/
36 | **/.idea/
37 | .idea/
38 |
39 |
--------------------------------------------------------------------------------
/restful-api-sso/cas-app2/src/main/java/com/tingfeng/cas/auth/SimpleUrlPatternMatcherStrategy.java:
--------------------------------------------------------------------------------
1 | package com.tingfeng.cas.auth;
2 |
3 | import org.jasig.cas.client.authentication.UrlPatternMatcherStrategy;
4 |
5 | import java.util.Arrays;
6 | import java.util.List;
7 |
8 | /**
9 | * 机能概要:过滤掉一些不需要授权登录的URL
10 | */
11 | public class SimpleUrlPatternMatcherStrategy implements UrlPatternMatcherStrategy {
12 |
13 | /**
14 | * 机能概要: 判断是否匹配这个字符串
15 | *
16 | * @param url 用户请求的连接
17 | * @return true : 不拦截
18 | * false :必须得登录了
19 | */
20 | @Override
21 | public boolean matches(String url) {
22 |
23 | List list = Arrays.asList(
24 | "/index.html",
25 | "/login.html",
26 | "/hello.html",
27 | "/world.html",
28 | "/favicon.ico");
29 |
30 | String name = url.substring(url.lastIndexOf("/"));
31 |
32 | // String url = "http://app1.com:8181/login.html?service=http%3A%2F%2Fapp1.com%3A8181%2Fusers.html";
33 | // 为了防止出现匹配中,忽略了后续参数的URL,出现比如:/login.html?service=http%3A%2F%2Fapp1.com%3A8181%2Fusers.html 现象
34 | // 这种现象,会导致重定向过多异常,所以,不管什么url,只取出请求的最终 file.html 即可
35 |
36 | if (name.indexOf("?") != -1) {
37 | name = name.substring(0, name.indexOf("?"));
38 | }
39 | boolean result = list.contains(name);
40 | if (!result) {
41 | System.out.println("拦截URL:" + url);
42 | }
43 | return result;
44 | }
45 |
46 | /**
47 | * 正则表达式的规则,这个地方可以是web传递过来的
48 | */
49 | @Override
50 | public void setPattern(String pattern) {
51 |
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/restful-api-sso/cas-app2/src/main/java/com/tingfeng/cas/config/CasConfig.java:
--------------------------------------------------------------------------------
1 | package com.tingfeng.cas.config;
2 |
3 | /**
4 | * Cas 的一些配置项
5 | */
6 | public class CasConfig {
7 |
8 | /**
9 | * 当前应用程序的baseUrl(注意最后面的斜线)
10 | */
11 | public static String SERVER_NAME = "http://app2.com:8282/water/";
12 |
13 | /**
14 | * 当前应用程序的登陆界面
15 | */
16 | public static String APP_LOGIN_PAGE = "http://app2.com:8282/water/login.html";
17 |
18 |
19 | /**
20 | * CAS服务器地址
21 | */
22 | public static String CAS_SERVER_PATH = "https://cas.server.com:8443/cas";
23 |
24 | /**
25 | * CAS登陆服务器地址
26 | */
27 | public static String CAS_SERVER_LOGIN_PATH = "https://cas.server.com:8443/cas/login";
28 |
29 | /**
30 | * CAS登出服务器地址
31 | */
32 | public static String CAS_SERVER_LOGOUT_PATH = "https://cas.server.com:8443/cas/logout";
33 |
34 | }
35 |
--------------------------------------------------------------------------------
/restful-api-sso/cas-app2/src/main/java/com/tingfeng/controller/DemoController.java:
--------------------------------------------------------------------------------
1 | package com.tingfeng.controller;
2 |
3 | import com.google.gson.Gson;
4 | import com.tingfeng.domain.User;
5 | import com.tingfeng.utils.HttpProxy;
6 | import org.springframework.http.HttpMethod;
7 | import org.springframework.web.bind.annotation.GetMapping;
8 | import org.springframework.web.bind.annotation.RequestMapping;
9 | import org.springframework.web.bind.annotation.RestController;
10 |
11 | import java.util.List;
12 |
13 | @RestController
14 | @RequestMapping("/api")
15 | public class DemoController {
16 |
17 | private static String API_BASE_URL = "http://client2.com:8889/";
18 |
19 | @GetMapping("/hello")
20 | public String hello() {
21 | return "前端 Hello 接口响应";
22 | }
23 |
24 | @GetMapping("/world")
25 | public String world() {
26 |
27 | String result = HttpProxy.httpRequest(API_BASE_URL + "/world", null, HttpMethod.GET);
28 | System.out.println("Client2 接口响应结果:" + result);
29 |
30 | return result;
31 | }
32 |
33 | @GetMapping("/users")
34 | public List users() {
35 | String result = HttpProxy.httpRequest(API_BASE_URL + "/user/users", null, HttpMethod.GET);
36 | System.out.println("Client2 接口响应结果:" + result);
37 |
38 | if (null != result && !result.equals("")) {
39 | Gson gson = new Gson();
40 | List userList = gson.fromJson(result, List.class);
41 | return userList;
42 | }
43 |
44 | return null;
45 | }
46 |
47 | @GetMapping("/books")
48 | public List books() {
49 |
50 | String result = HttpProxy.httpRequest(API_BASE_URL + "/book/books", null, HttpMethod.GET);
51 | System.out.println("Client2 接口响应结果:" + result);
52 |
53 | if (null != result && !result.equals("")) {
54 | Gson gson = new Gson();
55 | List nameList = gson.fromJson(result, List.class);
56 | return nameList;
57 | }
58 |
59 | return null;
60 | }
61 |
62 | }
63 |
--------------------------------------------------------------------------------
/restful-api-sso/cas-app2/src/main/java/com/tingfeng/domain/User.java:
--------------------------------------------------------------------------------
1 | package com.tingfeng.domain;
2 |
3 | public class User {
4 |
5 | private String username;
6 | private String password;
7 | private String sex;
8 | private int age;
9 |
10 | public User() {
11 | }
12 |
13 | public User(String username, String password, String sex, int age) {
14 | this.username = username;
15 | this.password = password;
16 | this.sex = sex;
17 | this.age = age;
18 | }
19 |
20 | public String getUsername() {
21 | return username;
22 | }
23 |
24 | public void setUsername(String username) {
25 | this.username = username;
26 | }
27 |
28 | public String getPassword() {
29 | return password;
30 | }
31 |
32 | public void setPassword(String password) {
33 | this.password = password;
34 | }
35 |
36 | public String getSex() {
37 | return sex;
38 | }
39 |
40 | public void setSex(String sex) {
41 | this.sex = sex;
42 | }
43 |
44 | public int getAge() {
45 | return age;
46 | }
47 |
48 | public void setAge(int age) {
49 | this.age = age;
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/restful-api-sso/cas-app2/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | logging:
2 | file: "logs/app2.log"
3 | info:
4 | name : "前端 App2 项目"
5 |
6 | server:
7 | port: 8282
8 | context-path: /water
9 | address: app2.com
10 |
--------------------------------------------------------------------------------
/restful-api-sso/cas-app2/src/main/webapp/assets/js/common.js:
--------------------------------------------------------------------------------
1 | /**
2 | * 获取项目根路径
3 | * 例如:http://app1.com:8181/fire
4 | * @returns {string}
5 | */
6 | function getRootPath() {
7 | var url = window.document.location.href;
8 | var pathName = window.document.location.pathname;
9 | var pos = url.indexOf(pathName);
10 | var path = url.substring(0, pos);
11 | var projectName = pathName.substring(0, pathName.substr(1).indexOf('/') + 1);
12 | return (path + projectName);
13 | }
14 |
15 | /**
16 | * 获取请求参数
17 | * 例如:http://app1.com:8181/fire?username=aaa&password=bbb,
18 | * 操作:GetQueryString('username') 返回 aaa
19 | *
20 | * @param name param 参数的 key
21 | * @returns {*} 根据 param 的 key,返回value
22 | */
23 | function GetQueryString(name) {
24 | var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
25 | var r = window.location.search.substr(1).match(reg);
26 | if (r != null) return unescape(r[2]);
27 | return null;
28 | }
29 |
--------------------------------------------------------------------------------
/restful-api-sso/cas-app2/src/main/webapp/books.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 图书列表数据
6 |
7 |
8 |
9 |
31 |
32 |
33 | 访问 books.html
34 |
35 | 图书列表
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/restful-api-sso/cas-app2/src/main/webapp/hello.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Hello
6 |
7 |
8 |
9 |
10 |
27 |
28 |
29 | 访问 Hello.html
30 |
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/restful-api-sso/cas-app2/src/main/webapp/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Index首页
6 |
7 |
8 | 访问App2 前端首页!
9 |
10 |
11 |
--------------------------------------------------------------------------------
/restful-api-sso/cas-app2/src/main/webapp/users.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 用户列表数据
6 |
7 |
8 |
9 |
10 |
11 |
33 |
34 |
35 | 访问 users.html
36 |
37 | 用户列表
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/restful-api-sso/cas-app2/src/main/webapp/world.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | World
6 |
7 |
8 |
9 |
26 |
27 |
28 | 访问 World.html
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/restful-api-sso/cas-client1/.gitignore:
--------------------------------------------------------------------------------
1 | # 忽略文件
2 | .DS_Store
3 | */.settings/
4 | */.DS_Store
5 | *.class
6 | *.iml
7 | */*.iml
8 | **/*.iml
9 | *.log
10 | .classpath
11 |
12 | # 包文件 #
13 | *.jar
14 | *.war
15 | *.zip
16 | *.tar.gz
17 | *.rar
18 |
19 | # 忽略文件夹
20 | .settings/
21 | .gradle/
22 | .externalToolBuilders/
23 |
24 | **/target/
25 | **/build/
26 | **/out/
27 | classes/
28 | **/logs/
29 | **/.idea/
30 | .idea/
31 |
32 |
--------------------------------------------------------------------------------
/restful-api-sso/cas-client1/src/main/java/com/tingfeng/AppRun.java:
--------------------------------------------------------------------------------
1 | package com.tingfeng;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 |
6 | @SpringBootApplication
7 | public class AppRun {
8 |
9 | public static void main(String[] args) {
10 | SpringApplication.run(AppRun.class, args);
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/restful-api-sso/cas-client1/src/main/java/com/tingfeng/controller/BookController.java:
--------------------------------------------------------------------------------
1 | package com.tingfeng.controller;
2 |
3 | import org.springframework.web.bind.annotation.GetMapping;
4 | import org.springframework.web.bind.annotation.RequestMapping;
5 | import org.springframework.web.bind.annotation.RestController;
6 |
7 | import java.util.Arrays;
8 | import java.util.List;
9 |
10 | @RestController
11 | @RequestMapping("/book")
12 | public class BookController {
13 |
14 | @GetMapping("/books")
15 | public List books() {
16 | return Arrays.asList("《你今天真好看》", "《我能咬你一口吗?》", "《人性的弱点》", "《原则》");
17 | }
18 |
19 | }
20 |
--------------------------------------------------------------------------------
/restful-api-sso/cas-client1/src/main/java/com/tingfeng/controller/IndexController.java:
--------------------------------------------------------------------------------
1 | package com.tingfeng.controller;
2 |
3 | import org.springframework.web.bind.annotation.RequestMapping;
4 | import org.springframework.web.bind.annotation.RestController;
5 |
6 | @RestController
7 | public class IndexController {
8 |
9 | @RequestMapping("/")
10 | public String index(){
11 | return "Client 1 后端 index 接口";
12 | }
13 |
14 | @RequestMapping("/world")
15 | public String world(){
16 | return "Client 1 后端 api/world 接口";
17 | }
18 |
19 | }
20 |
--------------------------------------------------------------------------------
/restful-api-sso/cas-client1/src/main/java/com/tingfeng/controller/UserController.java:
--------------------------------------------------------------------------------
1 | package com.tingfeng.controller;
2 |
3 | import com.google.gson.Gson;
4 | import com.tingfeng.domain.User;
5 | import com.tingfeng.model.request.UserLogin;
6 | import com.tingfeng.utils.HttpProxy;
7 | import org.springframework.http.HttpMethod;
8 | import org.springframework.stereotype.Controller;
9 | import org.springframework.web.bind.annotation.GetMapping;
10 | import org.springframework.web.bind.annotation.RequestMapping;
11 | import org.springframework.web.bind.annotation.ResponseBody;
12 |
13 | import javax.servlet.http.HttpServletRequest;
14 | import java.util.Arrays;
15 | import java.util.List;
16 |
17 | @Controller
18 | @RequestMapping("/user")
19 | public class UserController {
20 |
21 | @RequestMapping(value = "/login")
22 | public String login(HttpServletRequest request) {
23 | String username = request.getParameter("username");
24 | String password = request.getParameter("password");
25 | String service = request.getParameter("service");
26 |
27 | System.out.println(username + ":" + password + ":" + service);
28 |
29 | String param = new Gson().toJson(new UserLogin(username, password, service));
30 |
31 | // 1、获取SSO端请求的ST
32 | String st = HttpProxy.httpRequest("http://sso.server.com:9000/sso/user/login", param, HttpMethod.POST);
33 |
34 | // 2、302重定向最后授权
35 | String redirectUrl = service + "?ticket=" + st;
36 | System.out.println("redirectUrl:" + redirectUrl);
37 |
38 | return "redirect:" + redirectUrl;
39 | }
40 |
41 | @GetMapping("/users")
42 | @ResponseBody
43 | public List users() {
44 |
45 | List userList = Arrays.asList(
46 | new User("听风", "123456", "男", 23),
47 | new User("阿敏", "123456", "女", 22)
48 | );
49 |
50 | return userList;
51 | }
52 |
53 |
54 | }
55 |
--------------------------------------------------------------------------------
/restful-api-sso/cas-client1/src/main/java/com/tingfeng/domain/User.java:
--------------------------------------------------------------------------------
1 | package com.tingfeng.domain;
2 |
3 | public class User {
4 |
5 | private String username;
6 | private String password;
7 | private String sex;
8 | private int age;
9 |
10 | public User() {
11 | }
12 |
13 | public User(String username, String password, String sex, int age) {
14 | this.username = username;
15 | this.password = password;
16 | this.sex = sex;
17 | this.age = age;
18 | }
19 |
20 | public String getUsername() {
21 | return username;
22 | }
23 |
24 | public void setUsername(String username) {
25 | this.username = username;
26 | }
27 |
28 | public String getPassword() {
29 | return password;
30 | }
31 |
32 | public void setPassword(String password) {
33 | this.password = password;
34 | }
35 |
36 | public String getSex() {
37 | return sex;
38 | }
39 |
40 | public void setSex(String sex) {
41 | this.sex = sex;
42 | }
43 |
44 | public int getAge() {
45 | return age;
46 | }
47 |
48 | public void setAge(int age) {
49 | this.age = age;
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/restful-api-sso/cas-client1/src/main/java/com/tingfeng/model/request/UserLogin.java:
--------------------------------------------------------------------------------
1 | package com.tingfeng.model.request;
2 |
3 | public class UserLogin {
4 |
5 | private String username;
6 | private String password;
7 | private String service;
8 |
9 | public UserLogin() {
10 | }
11 |
12 | public UserLogin(String username, String password, String service) {
13 | this.username = username;
14 | this.password = password;
15 | this.service = service;
16 | }
17 |
18 | public String getUsername() {
19 | return username;
20 | }
21 |
22 | public void setUsername(String username) {
23 | this.username = username;
24 | }
25 |
26 | public String getPassword() {
27 | return password;
28 | }
29 |
30 | public void setPassword(String password) {
31 | this.password = password;
32 | }
33 |
34 | public String getService() {
35 | return service;
36 | }
37 |
38 | public void setService(String service) {
39 | this.service = service;
40 | }
41 |
42 | @Override
43 | public String toString() {
44 | return "UserLoginRequest{" +
45 | "username='" + username + '\'' +
46 | ", password='" + password + '\'' +
47 | ", service='" + service + '\'' +
48 | '}';
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/restful-api-sso/cas-client1/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | logging:
2 | #日志存储地址
3 | file: "logs/app-client.log"
4 | info:
5 | name : "App 后端接口"
6 |
7 | server:
8 | #端口号
9 | port: 8888
10 | context-path: /
11 | address: client1.com
12 |
13 | spring:
14 | mvc:
15 | view:
16 | # 页面默认前缀目录
17 | prefix: /WEB-INF/jsp/
18 | # 响应页面默认后缀
19 | suffix: .jsp
20 |
21 |
22 |
--------------------------------------------------------------------------------
/restful-api-sso/cas-client2/.gitignore:
--------------------------------------------------------------------------------
1 | # 忽略文件
2 | .DS_Store
3 | */.settings/
4 | */.DS_Store
5 | *.class
6 | *.iml
7 | */*.iml
8 | **/*.iml
9 | *.log
10 | .classpath
11 |
12 | # 包文件 #
13 | *.jar
14 | *.war
15 | *.zip
16 | *.tar.gz
17 | *.rar
18 |
19 | # 忽略文件夹
20 | .settings/
21 | .gradle/
22 | .externalToolBuilders/
23 |
24 | **/target/
25 | **/build/
26 | **/out/
27 | classes/
28 | **/logs/
29 | **/.idea/
30 | .idea/
31 |
32 |
--------------------------------------------------------------------------------
/restful-api-sso/cas-client2/src/main/java/com/tingfeng/AppRun.java:
--------------------------------------------------------------------------------
1 | package com.tingfeng;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 |
6 | @SpringBootApplication
7 | public class AppRun {
8 |
9 | public static void main(String[] args) {
10 | SpringApplication.run(AppRun.class, args);
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/restful-api-sso/cas-client2/src/main/java/com/tingfeng/controller/BookController.java:
--------------------------------------------------------------------------------
1 | package com.tingfeng.controller;
2 |
3 | import org.springframework.web.bind.annotation.GetMapping;
4 | import org.springframework.web.bind.annotation.RequestMapping;
5 | import org.springframework.web.bind.annotation.RestController;
6 |
7 | import java.util.Arrays;
8 | import java.util.List;
9 |
10 | @RestController
11 | @RequestMapping("/book")
12 | public class BookController {
13 |
14 | @GetMapping("/books")
15 | public List books() {
16 | return Arrays.asList("《Java 编程高手之旅》", "《Python 3编程高手之旅》", "《MongoDB 编程高手之旅》", "《MySQL 编程高手之旅》");
17 | }
18 |
19 | }
20 |
--------------------------------------------------------------------------------
/restful-api-sso/cas-client2/src/main/java/com/tingfeng/controller/IndexController.java:
--------------------------------------------------------------------------------
1 | package com.tingfeng.controller;
2 |
3 | import org.springframework.web.bind.annotation.RequestMapping;
4 | import org.springframework.web.bind.annotation.RestController;
5 |
6 | @RestController
7 | public class IndexController {
8 |
9 | @RequestMapping("/")
10 | public String index(){
11 | return "Client 2 后端 index 接口";
12 | }
13 |
14 | @RequestMapping("/world")
15 | public String world(){
16 | return "Client 2 后端 api/world 接口";
17 | }
18 |
19 | }
20 |
--------------------------------------------------------------------------------
/restful-api-sso/cas-client2/src/main/java/com/tingfeng/controller/UserController.java:
--------------------------------------------------------------------------------
1 | package com.tingfeng.controller;
2 |
3 | import com.google.gson.Gson;
4 | import com.tingfeng.domain.User;
5 | import com.tingfeng.model.request.UserLogin;
6 | import com.tingfeng.utils.HttpProxy;
7 | import org.springframework.http.HttpMethod;
8 | import org.springframework.stereotype.Controller;
9 | import org.springframework.web.bind.annotation.GetMapping;
10 | import org.springframework.web.bind.annotation.RequestMapping;
11 | import org.springframework.web.bind.annotation.ResponseBody;
12 |
13 | import javax.servlet.http.HttpServletRequest;
14 | import java.util.Arrays;
15 | import java.util.List;
16 |
17 | @Controller
18 | @RequestMapping("/user")
19 | public class UserController {
20 |
21 | @RequestMapping(value = "/login")
22 | public String login(HttpServletRequest request) {
23 | String username = request.getParameter("username");
24 | String password = request.getParameter("password");
25 | String service = request.getParameter("service");
26 |
27 | System.out.println(username + ":" + password + ":" + service);
28 |
29 | String param = new Gson().toJson(new UserLogin(username, password, service));
30 |
31 | // 1、获取SSO端请求的ST
32 | String st = HttpProxy.httpRequest("http://sso.server.com:9000/sso/user/login", param, HttpMethod.POST);
33 |
34 | // 2、302重定向最后授权
35 | String redirectUrl = service + "?ticket=" + st;
36 | System.out.println("redirectUrl:" + redirectUrl);
37 |
38 | return "redirect:" + redirectUrl;
39 | }
40 |
41 | @GetMapping("/users")
42 | @ResponseBody
43 | public List users() {
44 |
45 | List userList = Arrays.asList(
46 | new User("听风", "123456", "男", 23),
47 | new User("阿敏", "123456", "女", 22)
48 | );
49 |
50 | return userList;
51 | }
52 |
53 |
54 | }
55 |
--------------------------------------------------------------------------------
/restful-api-sso/cas-client2/src/main/java/com/tingfeng/domain/User.java:
--------------------------------------------------------------------------------
1 | package com.tingfeng.domain;
2 |
3 | public class User {
4 |
5 | private String username;
6 | private String password;
7 | private String sex;
8 | private int age;
9 |
10 | public User() {
11 | }
12 |
13 | public User(String username, String password, String sex, int age) {
14 | this.username = username;
15 | this.password = password;
16 | this.sex = sex;
17 | this.age = age;
18 | }
19 |
20 | public String getUsername() {
21 | return username;
22 | }
23 |
24 | public void setUsername(String username) {
25 | this.username = username;
26 | }
27 |
28 | public String getPassword() {
29 | return password;
30 | }
31 |
32 | public void setPassword(String password) {
33 | this.password = password;
34 | }
35 |
36 | public String getSex() {
37 | return sex;
38 | }
39 |
40 | public void setSex(String sex) {
41 | this.sex = sex;
42 | }
43 |
44 | public int getAge() {
45 | return age;
46 | }
47 |
48 | public void setAge(int age) {
49 | this.age = age;
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/restful-api-sso/cas-client2/src/main/java/com/tingfeng/model/request/UserLogin.java:
--------------------------------------------------------------------------------
1 | package com.tingfeng.model.request;
2 |
3 | public class UserLogin {
4 |
5 | private String username;
6 | private String password;
7 | private String service;
8 |
9 | public UserLogin() {
10 | }
11 |
12 | public UserLogin(String username, String password, String service) {
13 | this.username = username;
14 | this.password = password;
15 | this.service = service;
16 | }
17 |
18 | public String getUsername() {
19 | return username;
20 | }
21 |
22 | public void setUsername(String username) {
23 | this.username = username;
24 | }
25 |
26 | public String getPassword() {
27 | return password;
28 | }
29 |
30 | public void setPassword(String password) {
31 | this.password = password;
32 | }
33 |
34 | public String getService() {
35 | return service;
36 | }
37 |
38 | public void setService(String service) {
39 | this.service = service;
40 | }
41 |
42 | @Override
43 | public String toString() {
44 | return "UserLoginRequest{" +
45 | "username='" + username + '\'' +
46 | ", password='" + password + '\'' +
47 | ", service='" + service + '\'' +
48 | '}';
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/restful-api-sso/cas-client2/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | logging:
2 | #日志存储地址
3 | file: "logs/app-client2.log"
4 | info:
5 | name : "App2 后端接口"
6 |
7 | server:
8 | #端口号
9 | port: 8889
10 | context-path: /
11 | address: client2.com
12 |
13 | spring:
14 | mvc:
15 | view:
16 | # 页面默认前缀目录
17 | prefix: /WEB-INF/jsp/
18 | # 响应页面默认后缀
19 | suffix: .jsp
20 |
21 |
22 |
--------------------------------------------------------------------------------
/restful-api-sso/cas-overlay-template-master/.gitignore:
--------------------------------------------------------------------------------
1 | !/.project
2 |
3 | # 忽略文件
4 | .DS_Store
5 | */.settings/
6 | */.DS_Store
7 | *.class
8 | *.iml
9 | */*.iml
10 | **/*.iml
11 | *.log
12 | .classpath
13 | .factorypath
14 |
15 | # 包文件 #
16 | *.jar
17 | *.war
18 | *.zip
19 | *.tar.gz
20 | *.rar
21 |
22 | # 忽略文件夹
23 | .settings/
24 | maven/
25 | .gradle/
26 | .externalToolBuilders/
27 |
28 | **/target/
29 | **/build/
30 | **/out/
31 | classes/
32 | **/logs/
33 | **/.idea/
34 | .idea/
35 |
36 | overlays/
--------------------------------------------------------------------------------
/restful-api-sso/cas-overlay-template-master/etc/cas/casServer.crt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/restful-api-sso/cas-overlay-template-master/etc/cas/casServer.crt
--------------------------------------------------------------------------------
/restful-api-sso/cas-overlay-template-master/etc/cas/casServer.keystore:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/restful-api-sso/cas-overlay-template-master/etc/cas/casServer.keystore
--------------------------------------------------------------------------------
/restful-api-sso/cas-overlay-template-master/etc/cas/config/application.yml:
--------------------------------------------------------------------------------
1 | info:
2 | description: CAS Configuration
--------------------------------------------------------------------------------
/restful-api-sso/cas-overlay-template-master/etc/cas/config/cas.properties:
--------------------------------------------------------------------------------
1 | cas.server.name: https://cas.example.com:8443
2 | cas.server.prefix: https://cas.example.com:8443/cas
3 |
4 | cas.adminPagesSecurity.ip=127\.0\.0\.1
5 |
6 | logging.config: file:/etc/cas/config/log4j2.xml
7 | # cas.serviceRegistry.config.location: classpath:/services
8 |
9 | server.ssl.keyStore=file:/etc/cas/casServer.keystore
10 | server.ssl.keyStorePassword=changeit
11 | server.ssl.keyPassword=changeit
12 | server.ssl.key-alias=cas.server.com
--------------------------------------------------------------------------------
/restful-api-sso/cas-overlay-template-master/src/main/java/com/tingfeng/auth/exception/CustomException.java:
--------------------------------------------------------------------------------
1 | package com.tingfeng.auth.exception;
2 |
3 | import javax.security.auth.login.AccountExpiredException;
4 |
5 | /**
6 | * 自定义异常类
7 | */
8 | public class CustomException extends AccountExpiredException{
9 |
10 | public CustomException() {
11 | super();
12 | }
13 |
14 | public CustomException(String msg) {
15 | super(msg);
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/restful-api-sso/cas-overlay-template-master/src/main/java/com/tingfeng/auth/handler/CustomerHandler.java:
--------------------------------------------------------------------------------
1 | package com.tingfeng.auth.handler;
2 |
3 | public class CustomerHandler {
4 | }
5 |
--------------------------------------------------------------------------------
/restful-api-sso/cas-overlay-template-master/src/main/resources/app1.properties:
--------------------------------------------------------------------------------
1 |
2 | css.file=/themes/app1/css/main.css
3 | pageTitle= \u8FD9\u662FAPP 1 \u7F51\u7AD9
4 |
5 | #standard.custom.css.file=/themes/[theme_name]/css/cas.css
6 | #cas.javascript.file=/themes/[theme_name]/js/cas.js
7 |
8 | standard.custom.css.file=/css/cas.css
9 | admin.custom.css.file=/css/admin.css
10 | cas.javascript.file=/js/cas.js
--------------------------------------------------------------------------------
/restful-api-sso/cas-overlay-template-master/src/main/resources/app2.properties:
--------------------------------------------------------------------------------
1 |
2 | css.file=/themes/app2/css/main.css
3 | pageTitle= \u8FD9\u662FAPP 2 \u7F51\u7AD9
4 |
5 | #standard.custom.css.file=/themes/[theme_name]/css/cas.css
6 | #cas.javascript.file=/themes/[theme_name]/js/cas.js
7 |
8 | standard.custom.css.file=/css/cas.css
9 | admin.custom.css.file=/css/admin.css
10 | cas.javascript.file=/js/cas.js
--------------------------------------------------------------------------------
/restful-api-sso/cas-overlay-template-master/src/main/resources/services/HTTPSandIMAPS-10000001.json:
--------------------------------------------------------------------------------
1 | {
2 | "@class" : "org.apereo.cas.services.RegexRegisteredService",
3 | "serviceId" : "^(https|http|imaps)://.*",
4 | "name" : "HTTPS and HTTP and IMAPS",
5 | "id" : 10000001,
6 | "description" : "This service definition authorizes all application urls that support HTTPS and HTTP and IMAPS protocols.",
7 | "evaluationOrder" : 10000,
8 | "attributeReleasePolicy": {
9 | "@class": "org.apereo.cas.services.ReturnAllAttributeReleasePolicy"
10 | },
11 | "proxyPolicy": {
12 | "@class": "org.apereo.cas.services.RegexMatchingRegisteredServiceProxyPolicy",
13 | "pattern": "^(https|http)?://.*"
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/restful-api-sso/cas-overlay-template-master/src/main/resources/services/app1-100001.json:
--------------------------------------------------------------------------------
1 | {
2 | "@class": "org.apereo.cas.services.RegexRegisteredService",
3 | "serviceId": "^(https|http)://app1.*",
4 | "name": "app1",
5 | "id": 100001,
6 | "description": "这是一个app1域名下的服务,通过app1访问都允许通过",
7 | "evaluationOrder": 10,
8 | "theme": "app1",
9 | "attributeReleasePolicy": {
10 | "@class": "org.apereo.cas.services.ReturnAllAttributeReleasePolicy"
11 | }
12 | }
--------------------------------------------------------------------------------
/restful-api-sso/cas-overlay-template-master/src/main/resources/services/app2-100002.json:
--------------------------------------------------------------------------------
1 | {
2 | "@class": "org.apereo.cas.services.RegexRegisteredService",
3 | "serviceId": "^(https|http)://app2.*",
4 | "name": "app2",
5 | "id": 100002,
6 | "description": "这是一个app2域名下的服务,通过app2访问都允许通过",
7 | "evaluationOrder": 11,
8 | "theme": "app2"
9 | }
--------------------------------------------------------------------------------
/restful-api-sso/cas-overlay-template-master/src/main/resources/static/themes/app1/css/main.css:
--------------------------------------------------------------------------------
1 | h3 {
2 | color: pink;
3 | }
--------------------------------------------------------------------------------
/restful-api-sso/cas-overlay-template-master/src/main/resources/static/themes/app2/css/main.css:
--------------------------------------------------------------------------------
1 | h3 {
2 | color: red; /**红色**/
3 | }
--------------------------------------------------------------------------------
/restful-api-sso/sso-server/.gitignore:
--------------------------------------------------------------------------------
1 | # 忽略文件
2 | .DS_Store
3 | */.settings/
4 | */.DS_Store
5 | *.class
6 | *.iml
7 | */*.iml
8 | **/*.iml
9 | *.log
10 | .classpath
11 |
12 | # 包文件 #
13 | *.jar
14 | *.war
15 | *.zip
16 | *.tar.gz
17 | *.rar
18 |
19 | # 忽略文件夹
20 | .settings/
21 | .gradle/
22 | .externalToolBuilders/
23 |
24 | **/target/
25 | **/build/
26 | **/out/
27 | classes/
28 | **/logs/
29 | **/.idea/
30 | .idea/
31 |
32 |
--------------------------------------------------------------------------------
/restful-api-sso/sso-server/src/main/java/com/tingfeng/AppRun.java:
--------------------------------------------------------------------------------
1 | package com.tingfeng;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 |
6 | @SpringBootApplication
7 | public class AppRun {
8 |
9 | public static void main(String[] args) {
10 | SpringApplication.run(AppRun.class, args);
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/restful-api-sso/sso-server/src/main/java/com/tingfeng/config/CasConfig.java:
--------------------------------------------------------------------------------
1 | package com.tingfeng.config;
2 |
3 | public class CasConfig {
4 |
5 | /**
6 | * CAS登录地址的token
7 | */
8 | public static String GET_TOKEN_URL = "https://cas.server.com:8443/cas/v1/tickets";
9 |
10 | /**
11 | * 设置Cookie的有效时长(1小时)
12 | */
13 | public static int COOKIE_VALID_TIME = 1 * 60 * 60;
14 |
15 | /*
16 | * 设置Cookie的有效时长(1小时)
17 | */
18 | public static String COOKIE_NAME = "UToken";
19 |
20 | }
21 |
--------------------------------------------------------------------------------
/restful-api-sso/sso-server/src/main/java/com/tingfeng/controller/IndexController.java:
--------------------------------------------------------------------------------
1 | package com.tingfeng.controller;
2 |
3 | import org.springframework.web.bind.annotation.RequestMapping;
4 | import org.springframework.web.bind.annotation.RestController;
5 |
6 | @RestController
7 | public class IndexController {
8 |
9 | @RequestMapping("/")
10 | public String index(){
11 | return "自定义 SSO-Server 项目,用于和 CAS-Server 进行交互";
12 | }
13 |
14 | }
15 |
--------------------------------------------------------------------------------
/restful-api-sso/sso-server/src/main/java/com/tingfeng/domain/User.java:
--------------------------------------------------------------------------------
1 | package com.tingfeng.domain;
2 |
3 | public class User {
4 |
5 | private String username;
6 | private String password;
7 | private String sex;
8 | private int age;
9 |
10 | public User() {
11 | }
12 |
13 | public User(String username, String password, String sex, int age) {
14 | this.username = username;
15 | this.password = password;
16 | this.sex = sex;
17 | this.age = age;
18 | }
19 |
20 | public String getUsername() {
21 | return username;
22 | }
23 |
24 | public void setUsername(String username) {
25 | this.username = username;
26 | }
27 |
28 | public String getPassword() {
29 | return password;
30 | }
31 |
32 | public void setPassword(String password) {
33 | this.password = password;
34 | }
35 |
36 | public String getSex() {
37 | return sex;
38 | }
39 |
40 | public void setSex(String sex) {
41 | this.sex = sex;
42 | }
43 |
44 | public int getAge() {
45 | return age;
46 | }
47 |
48 | public void setAge(int age) {
49 | this.age = age;
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/restful-api-sso/sso-server/src/main/java/com/tingfeng/server/TgtServer.java:
--------------------------------------------------------------------------------
1 | package com.tingfeng.server;
2 |
3 | import org.apache.commons.lang3.StringUtils;
4 | import org.springframework.beans.factory.annotation.Autowired;
5 | import org.springframework.data.redis.core.StringRedisTemplate;
6 | import org.springframework.data.redis.core.ValueOperations;
7 | import org.springframework.stereotype.Component;
8 |
9 | import java.util.concurrent.TimeUnit;
10 |
11 | /**
12 | * 通过 Redis 存储/获取 TGT 数据
13 | */
14 | @Component
15 | public class TgtServer {
16 |
17 | @Autowired
18 | private StringRedisTemplate stringRedisTemplate;
19 |
20 | /**
21 | * 设置用户TGT到Redis
22 | *
23 | * @param username
24 | * @param tgt
25 | * @param time
26 | * @return
27 | */
28 | public void setTGT(String username, String tgt, long time) {
29 | ValueOperations operations = stringRedisTemplate.opsForValue();
30 | String value = operations.get(username);
31 | if (StringUtils.isNotBlank(value)) {
32 | System.out.println("用户:" + username + " 缓存中旧值:" + value + " 替换为新值:" + tgt);
33 | }
34 | operations.set(username, tgt, time, TimeUnit.SECONDS);
35 | }
36 |
37 | /**
38 | * 获取 TGT
39 | *
40 | * @param username
41 | * @return
42 | */
43 | public String getTGT(String username) {
44 | ValueOperations operations = stringRedisTemplate.opsForValue();
45 | String value = operations.get(username);
46 | if (StringUtils.isNotBlank(value)) {
47 | return value;
48 | }
49 | return null;
50 | }
51 |
52 | /**
53 | * 删除 TGT
54 | *
55 | * @param username
56 | * @return
57 | */
58 | public void delTGT(String username) {
59 | stringRedisTemplate.delete(username);
60 | }
61 |
62 | }
63 |
--------------------------------------------------------------------------------
/restful-api-sso/sso-server/src/main/java/com/tingfeng/utils/IdGenerator.java:
--------------------------------------------------------------------------------
1 | package com.tingfeng.utils;
2 |
3 | import java.util.UUID;
4 |
5 | public class IdGenerator {
6 |
7 | /**
8 | * 生成UUID
9 | * @return
10 | */
11 | public static String generatorId() {
12 | return UUID.randomUUID().toString();
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/restful-api-sso/sso-server/src/main/java/com/tingfeng/utils/IpUtil.java:
--------------------------------------------------------------------------------
1 | package com.tingfeng.utils;
2 |
3 | import org.apache.commons.lang3.StringUtils;
4 | import org.apache.logging.log4j.LogManager;
5 | import org.apache.logging.log4j.Logger;
6 |
7 | import javax.servlet.http.HttpServletRequest;
8 |
9 | public class IpUtil {
10 | private static final Logger logger = LogManager.getLogger();
11 |
12 | public static String getClientIpAddress(HttpServletRequest request) {
13 | String ip = "";
14 | ip = request.getHeader("realClientIP");
15 | if (StringUtils.isNotBlank(ip) && !"unknown".equalsIgnoreCase(ip)) {
16 | logger.info("get ip form realClienUp and ip is " + ip);
17 | return ip;
18 | }
19 | ip = request.getHeader("X-Real-IP");
20 | if (StringUtils.isNotBlank(ip) && !"unknown".equalsIgnoreCase(ip)) {
21 | logger.info("get ip form X-Real-IP and ip is " + ip);
22 | return ip;
23 | }
24 | logger.info("get ip form RemoteAddr and ip is " + ip);
25 | ip = request.getRemoteAddr();
26 | return ip;
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/restful-api-sso/sso-server/src/main/java/com/tingfeng/viewmodel/req/UserLoginRequest.java:
--------------------------------------------------------------------------------
1 | package com.tingfeng.viewmodel.req;
2 |
3 | public class UserLoginRequest {
4 |
5 | private String username;
6 | private String password;
7 | private String service;
8 |
9 | public String getUsername() {
10 | return username;
11 | }
12 |
13 | public void setUsername(String username) {
14 | this.username = username;
15 | }
16 |
17 | public String getPassword() {
18 | return password;
19 | }
20 |
21 | public void setPassword(String password) {
22 | this.password = password;
23 | }
24 |
25 | public String getService() {
26 | return service;
27 | }
28 |
29 | public void setService(String service) {
30 | this.service = service;
31 | }
32 |
33 | @Override
34 | public String toString() {
35 | return "UserLoginRequest{" +
36 | "username='" + username + '\'' +
37 | ", password='" + password + '\'' +
38 | ", service='" + service + '\'' +
39 | '}';
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/restful-api-sso/sso-server/src/main/java/com/tingfeng/viewmodel/res/UserCheckResponse.java:
--------------------------------------------------------------------------------
1 | package com.tingfeng.viewmodel.res;
2 |
3 | public class UserCheckResponse {
4 |
5 | private int status = 0; // 0:fail,1:success
6 | private String data = "nothing";
7 |
8 | public UserCheckResponse() {
9 | }
10 |
11 | public UserCheckResponse(int status, String data) {
12 | this.status = status;
13 | this.data = data;
14 | }
15 |
16 | public int getStatus() {
17 | return status;
18 | }
19 |
20 | public void setStatus(int status) {
21 | this.status = status;
22 | }
23 |
24 | public String getData() {
25 | return data;
26 | }
27 |
28 | public void setData(String data) {
29 | this.data = data;
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/restful-api-sso/sso-server/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | logging:
2 | #日志存储地址
3 | file: "logs/sso-server.log"
4 | level: info
5 | info:
6 | name : "自定义SSO-Server,管理登录用户"
7 |
8 |
9 | server:
10 | port: 9000
11 | context-path: /sso
12 | address: sso.server.com
13 |
14 | spring:
15 | #MVC配置
16 | mvc:
17 | view:
18 | prefix: /WEB-INF/jsp/
19 | suffix: .jsp
20 |
21 | # Redis配置
22 | redis:
23 | ## Redis数据库索引(默认为0)
24 | database: 0
25 | host: 127.0.0.1
26 | port: 6379
27 | password:
28 | pool:
29 | # 最大连接数
30 | max-active: 8
31 | # 最大空闲链接
32 | max-idle: 8
33 | # 最大阻塞等待时间(负值无限制)
34 | max-wait: -1
35 | # 最小空闲链接
36 | min-idle: 0
37 |
38 | # 热部署
39 | devtools:
40 | restart:
41 | enabled: false
42 | livereload:
43 | enabled: false
--------------------------------------------------------------------------------
/simple-sso/cas-app1/.gitignore:
--------------------------------------------------------------------------------
1 | # 忽略文件
2 | .DS_Store
3 | */.settings/
4 | */.DS_Store
5 | *.class
6 | *.iml
7 | */*.iml
8 | **/*.iml
9 | *.log
10 | .classpath
11 |
12 | # 包文件 #
13 | *.jar
14 | *.war
15 | *.zip
16 | *.tar.gz
17 | *.rar
18 |
19 | # 忽略文件夹
20 | .settings/
21 | .gradle/
22 | .externalToolBuilders/
23 |
24 | **/target/
25 | **/build/
26 | **/out/
27 | classes/
28 | **/logs/
29 | **/.idea/
30 | .idea/
31 |
32 |
--------------------------------------------------------------------------------
/simple-sso/cas-app1/src/main/java/com/tingfeng/cas/auth/SimpleUrlPatternMatcherStrategy.java:
--------------------------------------------------------------------------------
1 | package com.tingfeng.cas.auth;
2 |
3 | import org.jasig.cas.client.authentication.UrlPatternMatcherStrategy;
4 |
5 | import java.util.Arrays;
6 | import java.util.List;
7 |
8 | /**
9 | * 机能概要:过滤掉一些不需要授权登录的URL
10 | */
11 | public class SimpleUrlPatternMatcherStrategy implements UrlPatternMatcherStrategy {
12 |
13 | /**
14 | * 机能概要: 判断是否匹配这个字符串
15 | *
16 | * @param url 用户请求的连接
17 | * @return true : 不拦截
18 | * false :必须得登录了
19 | */
20 | @Override
21 | public boolean matches(String url) {
22 |
23 | if(url.contains("/logout")){
24 | return true;
25 | }
26 |
27 | List list = Arrays.asList(
28 | "/",
29 | "/index",
30 | "/favicon.ico"
31 | );
32 |
33 | String name = url.substring(url.lastIndexOf("/"));
34 | if (name.indexOf("?") != -1) {
35 | name = name.substring(0, name.indexOf("?"));
36 | }
37 |
38 | System.out.println("name:" + name);
39 | boolean result = list.contains(name);
40 | if (!result) {
41 | System.out.println("拦截URL:" + url);
42 | }
43 | return result;
44 | }
45 |
46 | /**
47 | * 正则表达式的规则,这个地方可以是web传递过来的
48 | */
49 | @Override
50 | public void setPattern(String pattern) {
51 |
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/simple-sso/cas-app1/src/main/java/com/tingfeng/cas/config/CasConfig.java:
--------------------------------------------------------------------------------
1 | package com.tingfeng.cas.config;
2 |
3 | /**
4 | * Cas 的一些配置项
5 | */
6 | public class CasConfig {
7 |
8 | /**
9 | * 当前应用程序的baseUrl(注意最后面的斜线)
10 | */
11 | public static String SERVER_NAME = "http://app1.com:8181/";
12 |
13 |
14 | /**
15 | * App1 登出成功url
16 | */
17 | public static String APP_LOGOUT_PATH = SERVER_NAME + "user/logout/success";
18 |
19 |
20 | /**
21 | * CAS服务器地址
22 | */
23 | public static String CAS_SERVER_PATH = "https://cas.server.com:8443/cas";
24 |
25 | /**
26 | * CAS登陆服务器地址
27 | */
28 | public static String CAS_SERVER_LOGIN_PATH = "https://cas.server.com:8443/cas/login";
29 |
30 | /**
31 | * CAS登出服务器地址
32 | */
33 | public static String CAS_SERVER_LOGOUT_PATH = "https://cas.server.com:8443/cas/logout";
34 |
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/simple-sso/cas-app1/src/main/java/com/tingfeng/controller/BookController.java:
--------------------------------------------------------------------------------
1 | package com.tingfeng.controller;
2 |
3 | import org.springframework.web.bind.annotation.GetMapping;
4 | import org.springframework.web.bind.annotation.RequestMapping;
5 | import org.springframework.web.bind.annotation.RestController;
6 |
7 | import java.util.Arrays;
8 | import java.util.List;
9 |
10 | @RestController
11 | @RequestMapping("/book")
12 | public class BookController {
13 |
14 | @GetMapping("/books")
15 | public List books() {
16 | return Arrays.asList("《项塔兰》", "《肖申克的救赎?》", "《人类的群星闪耀时》", "《当我跑步时,我谈些什么》");
17 | }
18 |
19 | }
20 |
--------------------------------------------------------------------------------
/simple-sso/cas-app1/src/main/java/com/tingfeng/controller/IndexController.java:
--------------------------------------------------------------------------------
1 | package com.tingfeng.controller;
2 |
3 | import org.springframework.web.bind.annotation.RequestMapping;
4 | import org.springframework.web.bind.annotation.RestController;
5 |
6 | @RestController
7 | public class IndexController {
8 |
9 | @RequestMapping("/index")
10 | public String index(){
11 | return " index 接口";
12 | }
13 |
14 | @RequestMapping("/world")
15 | public String world(){
16 | return " world 接口";
17 | }
18 |
19 |
20 | }
21 |
--------------------------------------------------------------------------------
/simple-sso/cas-app1/src/main/java/com/tingfeng/controller/UserController.java:
--------------------------------------------------------------------------------
1 | package com.tingfeng.controller;
2 |
3 | import com.tingfeng.cas.config.CasConfig;
4 | import org.springframework.stereotype.Controller;
5 | import org.springframework.web.bind.annotation.RequestMapping;
6 | import org.springframework.web.bind.annotation.ResponseBody;
7 | import org.springframework.web.bind.annotation.RestController;
8 |
9 | import javax.servlet.http.HttpServletRequest;
10 | import javax.servlet.http.HttpServletResponse;
11 |
12 | @Controller
13 | @RequestMapping("/user")
14 | public class UserController {
15 |
16 | /**
17 | * 用户登出
18 | *
19 | * @param request
20 | * @return
21 | */
22 | @RequestMapping("/logout")
23 | public String logout(HttpServletRequest request) {
24 |
25 | // session失效
26 | request.getSession().invalidate();
27 |
28 | return "redirect:" + CasConfig.CAS_SERVER_LOGOUT_PATH;
29 | }
30 |
31 | /**
32 | * 用户登出,并重定向回来
33 | *
34 | * @param request
35 | * @return
36 | */
37 | @RequestMapping("/logout2")
38 | public String logout2(HttpServletRequest request) {
39 |
40 | // session失效
41 | request.getSession().invalidate();
42 |
43 | return "redirect:" + CasConfig.CAS_SERVER_LOGOUT_PATH + "?service="+CasConfig.APP_LOGOUT_PATH;
44 | }
45 |
46 | /**
47 | * 登出成功回调
48 | * @return
49 | */
50 | @ResponseBody
51 | @RequestMapping("/logout/success")
52 | public String logoutPage(){
53 | return "登出成功,跳转登出页面";
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/simple-sso/cas-app1/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 |
2 | logging:
3 | file: "logs/app1.log"
4 | info:
5 | name : "App1项目"
6 |
7 | server:
8 | port: 8181
9 | context-path: /
10 | address: app1.com
--------------------------------------------------------------------------------
/simple-sso/cas-app2/.gitignore:
--------------------------------------------------------------------------------
1 | # 忽略文件
2 | .DS_Store
3 | */.settings/
4 | */.DS_Store
5 | *.class
6 | *.iml
7 | */*.iml
8 | **/*.iml
9 | *.log
10 | .classpath
11 |
12 | # 包文件 #
13 | *.jar
14 | *.war
15 | *.zip
16 | *.tar.gz
17 | *.rar
18 |
19 | # 忽略文件夹
20 | .settings/
21 | .gradle/
22 | .externalToolBuilders/
23 |
24 | **/target/
25 | **/build/
26 | **/out/
27 | classes/
28 | **/logs/
29 | **/.idea/
30 | .idea/
31 |
32 |
--------------------------------------------------------------------------------
/simple-sso/cas-app2/src/main/java/com/tingfeng/cas/auth/SimpleUrlPatternMatcherStrategy.java:
--------------------------------------------------------------------------------
1 | package com.tingfeng.cas.auth;
2 |
3 | import org.jasig.cas.client.authentication.UrlPatternMatcherStrategy;
4 |
5 | import java.util.Arrays;
6 | import java.util.List;
7 |
8 | /**
9 | * 机能概要:过滤掉一些不需要授权登录的URL
10 | */
11 | public class SimpleUrlPatternMatcherStrategy implements UrlPatternMatcherStrategy {
12 |
13 | /**
14 | * 机能概要: 判断是否匹配这个字符串
15 | *
16 | * @param url 用户请求的连接
17 | * @return true : 不拦截
18 | * false :必须得登录了
19 | */
20 | @Override
21 | public boolean matches(String url) {
22 |
23 | if(url.contains("/logout")){
24 | return true;
25 | }
26 |
27 | List list = Arrays.asList(
28 | "/",
29 | "/index",
30 | "/favicon.ico"
31 | );
32 |
33 | String name = url.substring(url.lastIndexOf("/"));
34 | if (name.indexOf("?") != -1) {
35 | name = name.substring(0, name.indexOf("?"));
36 | }
37 |
38 | System.out.println("name:" + name);
39 | boolean result = list.contains(name);
40 | if (!result) {
41 | System.out.println("拦截URL:" + url);
42 | }
43 | return result;
44 | }
45 |
46 | /**
47 | * 正则表达式的规则,这个地方可以是web传递过来的
48 | */
49 | @Override
50 | public void setPattern(String pattern) {
51 |
52 | }
53 | }
--------------------------------------------------------------------------------
/simple-sso/cas-app2/src/main/java/com/tingfeng/cas/config/CasConfig.java:
--------------------------------------------------------------------------------
1 | package com.tingfeng.cas.config;
2 |
3 | /**
4 | * Cas 的一些配置项
5 | */
6 | public class CasConfig {
7 |
8 | /**
9 | * 当前应用程序的baseUrl(注意最后面的斜线)
10 | */
11 | public static String SERVER_NAME = "http://app2.com:8282/";
12 |
13 | /**
14 | * App2 登出成功url
15 | */
16 | public static String APP_LOGOUT_PATH = SERVER_NAME + "user/logout/success";
17 |
18 | /**
19 | * CAS服务器地址
20 | */
21 | public static String CAS_SERVER_PATH = "https://cas.server.com:8443/cas";
22 |
23 | /**
24 | * CAS登陆服务器地址
25 | */
26 | public static String CAS_SERVER_LOGIN_PATH = "https://cas.server.com:8443/cas/login";
27 |
28 | /**
29 | * CAS登出服务器地址
30 | */
31 | public static String CAS_SERVER_LOGOUT_PATH = "https://cas.server.com:8443/cas/logout";
32 |
33 |
34 | }
35 |
--------------------------------------------------------------------------------
/simple-sso/cas-app2/src/main/java/com/tingfeng/controller/BookController.java:
--------------------------------------------------------------------------------
1 | package com.tingfeng.controller;
2 |
3 | import org.springframework.web.bind.annotation.GetMapping;
4 | import org.springframework.web.bind.annotation.RequestMapping;
5 | import org.springframework.web.bind.annotation.RestController;
6 |
7 | import java.util.Arrays;
8 | import java.util.List;
9 |
10 | @RestController
11 | @RequestMapping("/book")
12 | public class BookController {
13 |
14 | @GetMapping("/books")
15 | public List books() {
16 | return Arrays.asList("《Java》", "《C#?》", "《NodeJs》", "《Docker》");
17 | }
18 |
19 | }
20 |
--------------------------------------------------------------------------------
/simple-sso/cas-app2/src/main/java/com/tingfeng/controller/IndexController.java:
--------------------------------------------------------------------------------
1 | package com.tingfeng.controller;
2 |
3 | import org.springframework.web.bind.annotation.RequestMapping;
4 | import org.springframework.web.bind.annotation.RestController;
5 |
6 | @RestController
7 | public class IndexController {
8 |
9 | @RequestMapping("/index")
10 | public String index(){
11 | return " index 接口";
12 | }
13 |
14 | @RequestMapping("/world")
15 | public String world(){
16 | return " world 接口";
17 | }
18 |
19 | }
20 |
--------------------------------------------------------------------------------
/simple-sso/cas-app2/src/main/java/com/tingfeng/controller/UserController.java:
--------------------------------------------------------------------------------
1 | package com.tingfeng.controller;
2 |
3 | import com.tingfeng.cas.config.CasConfig;
4 | import org.springframework.stereotype.Controller;
5 | import org.springframework.web.bind.annotation.RequestMapping;
6 | import org.springframework.web.bind.annotation.ResponseBody;
7 | import org.springframework.web.bind.annotation.RestController;
8 |
9 | import javax.servlet.http.HttpServletRequest;
10 | import javax.servlet.http.HttpServletResponse;
11 |
12 | @Controller
13 | @RequestMapping("/user")
14 | public class UserController {
15 |
16 | /**
17 | * 用户登出
18 | *
19 | * @param request
20 | * @return
21 | */
22 | @RequestMapping("/logout")
23 | public String logout(HttpServletRequest request) {
24 |
25 | // session失效
26 | request.getSession().invalidate();
27 |
28 | return "redirect:" + CasConfig.CAS_SERVER_LOGOUT_PATH;
29 | }
30 |
31 | /**
32 | * 用户登出,并重定向回来
33 | *
34 | * @param request
35 | * @return
36 | */
37 | @RequestMapping("/logout2")
38 | public String logout2(HttpServletRequest request) {
39 |
40 | // session失效
41 | request.getSession().invalidate();
42 |
43 | return "redirect:" + CasConfig.CAS_SERVER_LOGOUT_PATH + "?service="+CasConfig.APP_LOGOUT_PATH;
44 | }
45 |
46 | /**
47 | * 登出成功回调
48 | * @return
49 | */
50 | @ResponseBody
51 | @RequestMapping("/logout/success")
52 | public String logoutPage(){
53 | return "登出成功,跳转登出页面";
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/simple-sso/cas-app2/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 |
2 | logging:
3 | file: "logs/app2.log"
4 | info:
5 | name : "App2项目"
6 |
7 | server:
8 | #端口号
9 | port: 8282
10 | context-path: /
11 | address: app2.com
--------------------------------------------------------------------------------
/simple-sso/cas-overlay-template-master/.gitignore:
--------------------------------------------------------------------------------
1 | !/.project
2 |
3 | # 忽略文件
4 | .DS_Store
5 | */.settings/
6 | */.DS_Store
7 | *.class
8 | *.iml
9 | */*.iml
10 | **/*.iml
11 | *.log
12 | .classpath
13 | .factorypath
14 |
15 | # 包文件 #
16 | *.jar
17 | *.war
18 | *.zip
19 | *.tar.gz
20 | *.rar
21 |
22 | # 忽略文件夹
23 | .settings/
24 | maven/
25 | .gradle/
26 | .externalToolBuilders/
27 |
28 | **/target/
29 | **/build/
30 | **/out/
31 | classes/
32 | **/logs/
33 | **/.idea/
34 | .idea/
35 |
36 | overlays/
--------------------------------------------------------------------------------
/simple-sso/cas-overlay-template-master/etc/cas/casServer.crt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/simple-sso/cas-overlay-template-master/etc/cas/casServer.crt
--------------------------------------------------------------------------------
/simple-sso/cas-overlay-template-master/etc/cas/casServer.keystore:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/simple-sso/cas-overlay-template-master/etc/cas/casServer.keystore
--------------------------------------------------------------------------------
/simple-sso/cas-overlay-template-master/etc/cas/config/application.yml:
--------------------------------------------------------------------------------
1 | info:
2 | description: CAS Configuration
--------------------------------------------------------------------------------
/simple-sso/cas-overlay-template-master/etc/cas/config/cas.properties:
--------------------------------------------------------------------------------
1 | cas.server.name: https://cas.example.com:8443
2 | cas.server.prefix: https://cas.example.com:8443/cas
3 |
4 | cas.adminPagesSecurity.ip=127\.0\.0\.1
5 |
6 | logging.config: file:/etc/cas/config/log4j2.xml
7 | # cas.serviceRegistry.config.location: classpath:/services
8 |
9 | server.ssl.keyStore=file:/etc/cas/casServer.keystore
10 | server.ssl.keyStorePassword=changeit
11 | server.ssl.keyPassword=changeit
12 | server.ssl.key-alias=cas.server.com
--------------------------------------------------------------------------------
/simple-sso/cas-overlay-template-master/src/main/resources/services/HTTPSandIMAPS-10000001.json:
--------------------------------------------------------------------------------
1 | {
2 | "@class" : "org.apereo.cas.services.RegexRegisteredService",
3 | "serviceId" : "^(https|http|imaps)://.*",
4 | "name" : "HTTPS and HTTP and IMAPS",
5 | "id" : 10000001,
6 | "description" : "This service definition authorizes all application urls that support HTTPS and HTTP and IMAPS protocols.",
7 | "evaluationOrder" : 10000
8 | }
9 |
--------------------------------------------------------------------------------
/yml-config/cas-overlay-template-master/.gitignore:
--------------------------------------------------------------------------------
1 | !/.project
2 |
3 | # 忽略文件
4 | .DS_Store
5 | */.settings/
6 | */.DS_Store
7 | *.class
8 | *.iml
9 | */*.iml
10 | **/*.iml
11 | *.log
12 | .classpath
13 | .factorypath
14 |
15 | # 包文件 #
16 | *.jar
17 | *.war
18 | *.zip
19 | *.tar.gz
20 | *.rar
21 |
22 | # 忽略文件夹
23 | .settings/
24 | maven/
25 | .gradle/
26 | .externalToolBuilders/
27 |
28 | **/target/
29 | **/build/
30 | **/out/
31 | classes/
32 | **/logs/
33 | **/.idea/
34 | .idea/
35 |
36 | overlays/
--------------------------------------------------------------------------------
/yml-config/cas-overlay-template-master/etc/cas/casServer.crt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/yml-config/cas-overlay-template-master/etc/cas/casServer.crt
--------------------------------------------------------------------------------
/yml-config/cas-overlay-template-master/etc/cas/casServer.keystore:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/X-rapido/CAS_SSO_Record/ae354d56e11d757b7f5db02dedc815ba70674caa/yml-config/cas-overlay-template-master/etc/cas/casServer.keystore
--------------------------------------------------------------------------------
/yml-config/cas-overlay-template-master/etc/cas/config/application.yml:
--------------------------------------------------------------------------------
1 | info:
2 | description: CAS Configuration
--------------------------------------------------------------------------------
/yml-config/cas-overlay-template-master/etc/cas/config/cas.properties:
--------------------------------------------------------------------------------
1 | cas.server.name: https://cas.example.com:8443
2 | cas.server.prefix: https://cas.example.com:8443/cas
3 |
4 | cas.adminPagesSecurity.ip=127\.0\.0\.1
5 |
6 | logging.config: file:/etc/cas/config/log4j2.xml
7 | # cas.serviceRegistry.config.location: classpath:/services
8 |
9 | server.ssl.keyStore=file:/etc/cas/casServer.keystore
10 | server.ssl.keyStorePassword=changeit
11 | server.ssl.keyPassword=changeit
12 | server.ssl.key-alias=cas.server.com
--------------------------------------------------------------------------------
/yml-config/cas-overlay-template-master/src/main/resources/application.properties:
--------------------------------------------------------------------------------
1 | ##
2 | # CAS Server Context Configuration
3 | #
--------------------------------------------------------------------------------