当前位置:网站首页>CAS deployment and successful login jump address

CAS deployment and successful login jump address

2022-07-27 03:03:00 Fear dominated by baldness

1.CAS The login process

CAS In two parts :CAS Server and CAS Client, Each request first enters client,client Will identify whether it is carried service ticket(CAS Server The unique ID generated ), If not, it means that you are not logged in , Redirect to CAS Server,Server Send the login page to the user , The user fills in the account and password and submits it to Server, Login through Server Will generate a service ticket Send to CAS Client in , Each subsequent request will be carried ticket. The flow chart is as follows :
 Insert picture description here

2.CAS Deploy

First download CASwar package . I'm going to use 5.3 edition , Direct download , Good configuration tomcat Can run .
https://gitee.com/zzh971213/cas
When the following screen appears, it means successful startup :
 Insert picture description here
The above is the login address , Exit the login address and put login Change it to logout that will do
The default account and password are configured in application.properties in
 Insert picture description here

3.CAS Single sign on docking VUE

① stay router—》index.js Configure the global routing hook , Call before each route enters , Here's some of the code

if (
    from.path.includes('/authorize') &&
    to.path.includes(config.project.loginHeaderRouter)
  ) {
    
    window.location.href = 'http://localhost:8070/login?service=http://192.168.1.89:8080/#/login';
  }

If you are not logged in, jump to CAS Login page for http://localhost:8070/login, Here we will focus on why we need to add ?service=http://192.168.1.89:8080/#/login. It's to make CAS After successful login, redirect to service Back address
, An error may be reported here : Unauthorized Services
 Insert picture description here
terms of settlement : stay HTTPSandIMAPS-10000001.json Lieutenant general "serviceId" : “^(https|imaps)/.“, Change it to "serviceId” : "^(https|http|imaps)/.”, That is to add http Insert picture description here
design sketch : Notice the changes in the address bar
open vue Landing page of the project
 open vue Landing page of the project
After successful login, jump to
 Insert picture description here
Configure the jump page to log out : stay application.properties Add a row to , In this way, you can enter localhost:8080/logout Then it will redirect to www.baidu.com

cas.logout.redirectUrl=http://www.baidu.com
原网站

版权声明
本文为[Fear dominated by baldness]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/208/202207270021515515.html