单点登录 CAS 客户端搭建与服务注册 -2

服务端已经搭建完毕,现在搭建一个客户端,并测试一下单点登录。

使用springboot搭建一个客户端服务

 

 增加web运行,和cas client jar包

  <!--boot web支持-->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <!--cas client支持-->
        <dependency>
            <groupId>net.unicon.cas</groupId>
            <artifactId>cas-client-autoconfig-support</artifactId>
            <version>1.7.0-GA</version>
        </dependency>

  编辑登录成功后跳转的页面

 配置cas客户端

增加cas客户端启动注解@EnableCasClient,并启动服务

运行服务端地址singin   客户端 地址访问 http://localhost:8081/login  

为了方便后续对于配置文件的修改,复制一份 application.properties

由于cas是以http链接为基础的,所以需要修改cas server  以支持http链接, 在箭头处增加http

1、增加http

 2、在 application.properties 文件增加两行

cas.tgc.secure=false
cas.serviceRegistry.initFromJson=true

  然后,再次访问客户端 输入账号密码

登录成功

原文地址:https://www.cnblogs.com/lewskay/p/10266826.html