Lake's Blog Lake's Blog
首页
HCFrame
  • 博客搭建

    • 搜索引擎
    • SEO优化
    • 问题记录
  • Vue

    • 问题记录
  • uni-app
  • 开发

    • Spring
  • 数据库及中间件

    • Elasticsearch
    • SQL
  • 杂谈

    • 杂谈
  • 微服务

    • nacos
    • CAS
  • 算法说明

    • algorithm
  • leetCode

    • leetCode
  • 代理

    • Nginx
  • Linux

    • ubuntu
  • Docker
  • 数据库
  • 消息队列
  • openwrt
  • 友情链接
关于
  • 网站
  • 资源
  • 分类
  • 标签
  • 归档
GitHub

Lake Liu

很菜的程序员
首页
HCFrame
  • 博客搭建

    • 搜索引擎
    • SEO优化
    • 问题记录
  • Vue

    • 问题记录
  • uni-app
  • 开发

    • Spring
  • 数据库及中间件

    • Elasticsearch
    • SQL
  • 杂谈

    • 杂谈
  • 微服务

    • nacos
    • CAS
  • 算法说明

    • algorithm
  • leetCode

    • leetCode
  • 代理

    • Nginx
  • Linux

    • ubuntu
  • Docker
  • 数据库
  • 消息队列
  • openwrt
  • 友情链接
关于
  • 网站
  • 资源
  • 分类
  • 标签
  • 归档
GitHub
  • Spring

  • 数据库及中间件

  • 杂谈

  • 微服务

    • nacos

    • CAS

      • SpringBoot集成CAS单点登录
        • 一、部署好CAS服务器
        • 二、添加依赖
        • 三、yml文件添加配置
        • 四、配置启动注解
        • 五、其他yml配置

SpringBoot集成CAS单点登录

# SpringBoot集成CAS单点登录

提示

  1. CAS Server版本 5.3.2
  2. CAS core依赖版本 3.5.0
  3. Cas Client AutoConfig Support 依赖版本 1.4.0-GA

# 一、部署好CAS服务器

此处参考 官放文档 ,我部署的版本是 5.3.2

# 二、添加依赖

打开项目中的 pom.xml 文件

添加依赖:

<dependency>
    <groupId>net.unicon.cas</groupId>
    <artifactId>cas-client-autoconfig-support</artifactId>
    <version>1.4.0-GA</version>
    <exclusions>
        <exclusion>
            <groupId>org.jasig.cas.client</groupId>
            <artifactId>cas-client-core</artifactId>
        </exclusion>
    </exclusions>
</dependency>
<dependency>
    <groupId>org.jasig.cas.client</groupId>
    <artifactId>cas-client-core</artifactId>
    <version>5.3.2</version>
</dependency>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16

# 三、yml文件添加配置

在 yml 文件中添加配置

cas:
	# cas服务端地址
  server-url-prefix: http://192.168.1.131:8080/cas
  # 需要注册的服务地址
  client-host-url: http://localhost:8080
  # cas验证版本
  validation-type: cas3
  # cas登录url
  server-login-url: http://192.168.1.131:8080/cas/login
1
2
3
4
5
6
7
8
9

# 四、配置启动注解

在启动类上新增注解 @EnableCasClient

@SpringBootApplication
@EnableCasClient
public class DemoApplication {
    public static void main(String[] args) {
        SpringApplication.run(DemoApplication.class, args);
    }
}
1
2
3
4
5
6
7

# 五、其他yml配置

上述配置完成后就完成CAS集成了

其余的cas配置如下

cas.authentication-url-patterns
cas.validation-url-patterns
cas.request-wrapper-url-patterns
cas.assertion-thread-local-url-patterns
cas.gateway
cas.use-session
cas.redirect-after-validation
cas.allowed-proxy-chains
cas.proxy-callback-url
cas.proxy-receptor-url
cas.accept-any-proxy
server.context-parameters.renew
1
2
3
4
5
6
7
8
9
10
11
12
编辑
#Spring#CAS
上次更新: 2021/03/05, 08:28:53
Win10搭建并启动nacos

← Win10搭建并启动nacos

最近更新
01
IDEA行号太宽
03-11
02
uniapp中实现h5扫码功能(微信版)
08-12
03
Docker安装Rabbitmq
07-22
更多文章>
本站总访问量次 | 您是本站第位访问者
Theme by Vdoing | Copyright © 2020-2024 Lake Liu | MIT License | 背景图、Logo、头像设计@Drrizzee
  • 跟随系统
  • 深色模式
  • 浅色模式
  • 阅读模式