springBoot项目中已有权限和登录组件后集成cas单点登录的主要步骤
配置过程:
1.添加依赖:
<dependency>
<groupId>net.unicon.cas</groupId>
<artifactId>cas-client-autoconfig-support</artifactId>
<version>2.3.0-GA</version>
</dependency>
<dependency>
<groupId>org.jasig.cas.client</groupId>
<artifactId>cas-client-core</artifactId>
<version>3.6.2</version>
</dependency>
2.主要的配置属性yml(可参考配置属性组装类:net.unicon.cas.client.configuration.CasClientConfigurationProperties):
cas:
# CAS server URL E.g. https://example.com/cas or https://cas.example. Required.
server-url-prefix:
# CAS server login URL E.g. https://example.com/cas/login or https://cas.example/login. Required.
server-login-url:
# CAS-protected client application host URL E.g. https://myclient.example.com Required.
client-host-url:
# Validation filter useSession parameter.
# casValidationFilter 中的useSession属性
use-session: true
# ValidationType the CAS protocol validation type. Defaults to CAS3 if not explicitly set.
# 不设置的话默认CAS3
validation-type: cas
# List of URL patterns protected by CAS authentication filter.
# 访问下面这些链接时,如果未在server端登录,将重定向到 server-login-url.
# 进行登录.配置的url中不包含本项目的context,处理url的方法中一般处理单点成功后的token的设置和页面跳转
authentication-url-patterns:
- /base/login/thirdLogin
3.在权限/安全管理框架中放行对应的cas:authentication-url-patterns
4.在启动类上添加@EnableCasClient
详细的注意事项和跳转过程分析会写在我的个人博客网站 https://chenyl.fun ,欢迎访问