如何基于springboot搭建CAS Client客户端

这篇文章主要介绍“如何基于springboot搭建CAS Client客户端”,在日常操作中,相信很多人在如何基于springboot搭建CAS Client客户端问题上存在疑惑,小编查阅了各式资料,整理出简单好用的操作方法,希望对大家解答”如何基于springboot搭建CAS Client客户端”的疑惑有所帮助!接下来,请跟着小编一起来学习吧!

1.新建springboot项目并引入依赖

<dependency>  <groupId>org.jasig.cas.client</groupId>  <artifactId>cas-client-support-springboot</artifactId>  <version>3.6.2</version></dependency>

2.配置@EnableCasClient注解

package com.codetiler.demo;import org.jasig.cas.client.boot.configuration.EnableCasClient;import org.springframework.boot.SpringApplication;import org.springframework.boot.autoconfigure.SpringBootApplication;@SpringBootApplication@EnableCasClientpublic class Application {    public static void main(String[] args) {        SpringApplication.run(Application.class, args);    }}

3.配置application.properties文件

server.port=8081#cas服务端配置cas.server-url-prefix=http://cas.codetiler.org:8443/cascas.server-login-url=http://cas.codetiler.org:8443/cas/login#cas客户端配置cas.client-host-url=http://demo.codetiler.org:8081cas.validation-type=CAS3

4.在浏览器中输入认证服务端的地址http://cas.codetiler.org:8443/cas并登录,再次在浏览器中输入应用的地址http://demo.codetiler.org:8081浏览器直接请求到,不需要再次登录。

到此,关于“如何基于springboot搭建CAS Client客户端”的学习就结束了,希望能够解决大家的疑惑。理论与实践的搭配能更好的帮助大家学习,快去试试吧!若想继续学习更多相关知识,请继续关注网站,小编会继续努力为大家带来更多实用的文章!