单点登录CAS-03:cas配置02-开启/status
单点登录CAS-03:cas配置02-开启/status
- 1、前言
- 2、开启/status/dashboard
- 2.1找到相关的配置项参数
- 2.1.1 Spring Boot Endpoints属性列表
- 2.1.2 CAS Endpoints属性列表
- 2.2 配置案例演示
- 2.2.1 案例1:使用全局性配置
- 2.2.2 案例1:验证
- 2.2.3 案例2:明细配置版本
- 2.2.4 案例2:验证
- 2.2.3 案例3:明细配置版本-禁用某节点
- 2.2.4 案例3:验证
1、前言
CAS官方推荐使用/status/dashboard来管理CAS的配置,见https://apereo.github.io/cas/5.3.x/installation/Configuration-Management.html
点击上图的链接,进入文档页:https://apereo.github.io/cas/5.3.x/installation/Monitoring-Statistics.html
此页面有一个应用映射表格列述如下:
应用路径 | 作用描述 |
---|---|
/status/dashboard |
The control panel to CAS server functionality and management CAS服务器功能与管理的【控制面板】. |
/status |
Monitor CAS status and other underlying components. 监控CAS状态及其它底层组件 |
/status/sso |
Describes if there exists an active SSO session for this request tied to this browser session. 描述此请求是否存在绑定到此浏览器会话的活动SSO会话 |
/status/swf |
Describes the current configured state of CAS webflow in JSON. 描述JSON中CAS webflow的当前配置状态 |
/status/stats |
Visual representation of CAS statistics with graphs and charts, etc. CAS统计的图形、图表等可视化表示 |
/status/logging |
Monitor CAS logs in a streaming fashion and review the audit log. 以流式方式监视CAS日志并查看审核日志 |
/status/config |
Visual representation of application properties and configuration. 应用程序属性和配置的可视化表示 |
/status/ssosessions |
Reports active SSO sessions. Examine attributes, services and log users out. 报告活动的SSO会话。检查属性、服务并注销用户 |
/status/services |
Reports the collection of applications registered with CAS. 报告在CAS注册的应用程序的集合 |
/status/trustedDevs |
Reports on the registered trusted devices/browsers. 关于注册的受信任设备/浏览器的报告 |
/status/authnEvents |
When enabled, reports on the events captured by CAS. 启用后,报告由CAS捕获的事件 |
/status/attrresolution |
Examine resolution of user attributes via CAS attribute resolution. 通过CAS属性解析检查用户属性的解析 |
/status/discovery |
Advertises the CAS server’s profile, features and capabilities for auto-configuration of client applications. 宣传CAS服务器的配置文件、功能和自动配置客户端应用程序的功能 |
2、开启/status/dashboard
CAS默认情况下,是禁用/status路径的访问的,如下图:
2.1找到相关的配置项参数
在https://apereo.github.io/cas/5.3.x/installation/Configuration-Management.html页面,点击链接
进入到https://apereo.github.io/cas/5.3.x/installation/Configuration-Properties.html#cas-endpoints此处可看到需要配置的参数列表。
在页面上按Ctrl+F查找"/status"可以看到有一段这样的文字“The following properties describe access controls and settings for the /status endpoint of CAS which provides administrative functionality and oversight into the CAS software. These endpoints are specific to Spring Boot”。大意是说以下的属性描述/status节点的访问控制。
综上所述,我们找到了开启/status权限需要了两上配置列表,我将其列在下面,并且写上备注以便理解。
2.1.1 Spring Boot Endpoints属性列表
# Globally control whether endpoints are enabled
# 全局控制是否开启endpoints节点
# or marked as sensitive to require authentication.
# 或标记sensitive为要求授权(即设置为true)#所有终结点打开。默认为false
#经验证此选项为true时,/cas/status/config能看到属性列表,否则看不到endpoints.enabled=true
#所有终结点敏感。默认为trueendpoints.sensitive=true#管理上下文路径,默认为/status。
management.contextPath=/status
#是否开启管理安全,默认为true
management.security.enabled=true
#管理安全用户角色,默认为ACTUATOR,ADMIN
management.security.roles=ACTUATOR,ADMIN
#是否管理安全会话,默认为if_required
management.security.sessions=if_required# Each of the below endpoints can either be disabled
# 以下每个endpoints既可禁用(enabled=false),
# or can be marked as 'sensitive' (or not)
# 也可以标记为sensive即敏感项。
# to enable authentication. The global flags above control
# 来开启授权。以上所列述是全局标志控制所有内容
# everything and individual settings below act as overrides.
# 以下所述的是单独设置用作覆盖# 以下配置默认是注释掉的,此处将其打开
#配置列表《开始》
#------------------------------------------
#启用/restart端点重新启动应用程序上下文。如果设置为true,则浏览器中输入网址/cas/restart按回车,就自动重新启动应用程序上下文
#注:设为true后,在/cas/status/dashboard页面会出现Reboot操作按钮endpoints.restart.enabled=false
#启用/shutdown端点来关闭应用程序。如果设置为true,则浏览器中输入网址/cas/shutdown按回车,就自动关闭应用的端点
#注:设为true后,在/cas/status/dashboard页面会出现shutdown操作按钮endpoints.shutdown.enabled=false
# 启用端点的自动配置。默认为trueendpoints.autoconfig.enabled=true
# 启用端点的bean加载。默认为trueendpoints.beans.enabled=true
# 是否启用总线endpoints.bus.enabled=true
# 是否启用配置属性 endpoints.configprops.enabled=true
#是否启用dump。endpoints.dump.enabled=true
#是否启用环境变化事件endpoints.env.enabled=true
#是否启用节点健康检查 endpoints.health.enabled=true
#是否启用节点功能endpoints.features.enabled=true
#是否启用infoendpoints.info.enabled=true
#是否启动节点日志endpoints.loggers.enabled=true
#是否启用节点日志文件endpoints.logfile.enabled=true
#是否启用节点追踪endpoints.trace.enabled=true
#是否启用节点文档endpoints.docs.enabled=false
#是否启用堆栈导出endpoints.heapdump.enabled=true
#配置列表《结束》
#------------------------------------------# IP address may be enough to protect all endpoints.
#IP地址可能足以保护所有终结点
# It's set to always protect the /status endpoint.
#它设置为始终保护/状态终结点#安全管理页访问时要校验的IP地址。例如设置成127.0.0.1那么在浏览器中只能用127.0.0.1来访问,即使用localhost也是无权限访问的。
#这样做的用意是保护安全管理页的访问权限。此项默认是注释掉的,默认值为127\.0\.0\.1,这里需要将其打开,否则是访问不到的。cas.adminPagesSecurity.ip=127.0.0.1
#
# cas.adminPagesSecurity.alternateIpHeaderName=X-Forwarded-For# If you wish to protect the admin pages via CAS itself, configure the rest.
#如果希望通过CAS本身保护管理页,请配置其余的配置项。# cas登录页网址。默认不用开启。如果开启则要写成应用的访问路径。
# cas.adminPagesSecurity.loginUrl=https://sso.example.org/cas/login
#cas控制面板网址。默认不用开启。如果开启则要写成应用的访问路径。
# cas.adminPagesSecurity.service=https://sso.example.org/cas/status/dashboard
#cas安全管理页的用户帐号。这里可以指向一个配置文件
# 如果不指定帐号文件,则默认会读取user-details.properties
#cas.adminPagesSecurity.users=file:/etc/cas/config/adminusers.properties
#cas安全管理页的角色。
# cas.adminPagesSecurity.adminRoles[0]=ROLE_ADMIN
#是否启用CAS安全管理页执行者节点。默认为tree
# cas.adminPagesSecurity.actuatorEndpointsEnabled=true
2.1.2 CAS Endpoints属性列表
cas.monitor.endpoints
#终结点dashboard对应uri为/cas/status/dashboard
#这是一个快捷方式页面,里面有很多按钮可以进入到其他节点
cas.monitor.endpoints.dashboard
cas.monitor.endpoints.discovery
cas.monitor.endpoints.auditEvents
#管理身份验证事件,终结点/cas/status/authnEvents
cas.monitor.endpoints.authenticationEvents
#配置页,终结点/cas/status/config
cas.monitor.endpoints.configurationState
cas.monitor.endpoints.healthCheck
#查看日志,终结点/cas/status/logging
cas.monitor.endpoints.loggingConfig
#度量指标,终结点/cas/status/metrics
cas.monitor.endpoints.metrics
#属性配置列表,终结点/cas/status/attrresolution
cas.monitor.endpoints.attributeResolution
cas.monitor.endpoints.singleSignOnReport
#ticket凭证统计,终结点/cas/status/stats
cas.monitor.endpoints.statistics
cas.monitor.endpoints.trustedDevices
#cas状态,终结点/cas/status
#注:该终结点不会影响子级终结点。例如
#-------------------------------------------------
#cas.monitor.endpoints.status.enabled=false
#cas.monitor.endpoints.dashboard.enabled=true
#-------------------------------------------------
#如上配置/cas/status不能访问,但是/cas/status/dashboard仍能访问
cas.monitor.endpoints.status
#单点登录,终结点/cas/status/sso
cas.monitor.endpoints.singleSignOnStatus
#springWebflow,终结点/cas/status/swf
#注此配置.enabled只能控制dashboard面板是否显示模块入口,即使.enabled=false浏览器输入网址仍能访问
cas.monitor.endpoints.springWebflowReport
#服务注册,终结点/cas/status/services
cas.monitor.endpoints.registeredServicesReport
#配置元数据,终结点/cas/status/configmetadata
cas.monitor.endpoints.configurationMetadata
注 :CAS Endpoints的属性列表只是给出了一个属性项目,每个项目有两个参数enabled(是否启用true或false),sensitive(用于标志该配置是否敏感信息——即是否需要授权的操作,如果设置为true,则所有的原生端点都需要授权操作,设置为false则不需要,默认是false)
因此可以得到一个设置CAS Endpoints的属性的原则:
- 所有的enabled属性应该设置为true
- 所有的sensitive属性应该设置为false——需要严格授权的情况除外
参考文章:https://www.iteye.com/blog/357029540-2392530
此处引述作者的话 |
---|
2.endpoints.enabled 该配置属性用于控制所有的访问原生端点的可用性,设置为false的时候所有的原生端点都不可以访问,设置为true时所有的原生端点可以访问。默认为true。 3.endpoints.{name}.enabled 该配置属性是相对endpoints.enabled来说的,endpoints.enabled是将所有的原生端点的禁止访问,而enedpoints.{name}.enabled属性是针对某个具体的原生端点进行控制,设置为true时该原生端点可以访问,设置为false的时候不可访问,默认为true。 4.endpoints.sensitive 该配置属性用于配置敏感信息,即是否需要授权的操作,如果设置为true,则所有的原生端点都需要授权操作,设置为false则不需要,默认是false,这里需要注意的是如果没有主动设置该值的话,有些原生端点是需要授权才能访问的,如/beans,/env等,当与management.security.enabled一起使用时以management.security.enabled为主。 5.endpoints.{name}.sensitive 该配置属性是相对endpoints.sensitive来说的,endpoints.sensitive是将所有的原生端点进行授权操作,而endpoints.{name}.sensitive是对某个具体的原生端点进行控制,设置为true时该原生端点需要授权操作,设置为false的时候不需要授权访问,具体的默认值需要看具体的原生端点。 |
2.2 配置案例演示
在cas-overlay-template工程目录下创建src\main\resources\文件夹,所有的配置文件放到这里面去。
默认的配置文件可以从cas.war文件中获得。如果你没有cas.war,请看前面的博文:单点登录CAS-02:如何得到一个cas.war?
请先下载工程执行mvn clean package得到一个默认的cas.war。
2.2.1 案例1:使用全局性配置
本案例使用到文件:application.properties。这个文件的默认版本能从cas.war中获得。
以下配置加入到application.properties中,如果配置项已存在则覆盖。
#安全管理页访问时要校验的IP地址。例如设置成127.0.0.1那么在浏览器中只能用127.0.0.1来访问,即使用localhost也是无权限访问的。
#这样做的用意是保护安全管理页的访问权限。此项默认是注释掉的,默认值为127\.0\.0\.1,这里需要将其打开,否则是访问不到的。cas.adminPagesSecurity.ip=127.0.0.1
#管理上下文路径,默认为/status。
management.contextPath=/status
#是否开启管理安全,默认为true
management.security.enabled=true
#管理安全用户角色,默认为ACTUATOR,ADMIN
management.security.roles=ACTUATOR,ADMIN
#是否管理安全会话,默认为if_required
management.security.sessions=if_required#节点开关配置(全局)
cas.monitor.endpoints.enabled=true
cas.monitor.endpoints.sensitive=false
2.2.2 案例1:验证
cmd窗口进入cas-overlay-template工程目录,执行mvn clean package生成cas.war后部署到tomcat\webapps目录下。
启动tomcat加载完成后,打开浏览器访问网址http://127.0.0.1:7711/cas/status/dashboard。
以上可以看到即使不登录用户,也是可以访问/status/dashboard页面的。
2.2.3 案例2:明细配置版本
本案例使用到文件:application.properties。这个文件的默认版本能从cas.war中获得。
以下配置加入到application.properties中,如果配置项已存在则覆盖。
#安全管理页访问时要校验的IP地址。例如设置成127.0.0.1那么在浏览器中只能用127.0.0.1来访问,即使用localhost也是无权限访问的。
#这样做的用意是保护安全管理页的访问权限。此项默认是注释掉的,默认值为127\.0\.0\.1,这里需要将其打开,否则是访问不到的。cas.adminPagesSecurity.ip=127.0.0.1
#管理上下文路径,默认为/status。
management.contextPath=/status
#是否开启管理安全,默认为true
management.security.enabled=true
#管理安全用户角色,默认为ACTUATOR,ADMIN
management.security.roles=ACTUATOR,ADMIN
#是否管理安全会话,默认为if_required
management.security.sessions=if_required#节点开关配置(全局)
#cas.monitor.endpoints.enabled=true
#cas.monitor.endpoints.sensitive=false#节点开关配置(明细)。每项后面指定enabled和sensitive
cas.monitor.endpoints.dashboard.enabled=true
cas.monitor.endpoints.dashboard.sensitive=falsecas.monitor.endpoints.discovery.enabled=true
cas.monitor.endpoints.discovery.sensitive=falsecas.monitor.endpoints.auditEvents.enabled=true
cas.monitor.endpoints.auditEvents.sensitive=falsecas.monitor.endpoints.authenticationEvents.enabled=true
cas.monitor.endpoints.authenticationEvents.sensitive=falsecas.monitor.endpoints.configurationState.enabled=true
cas.monitor.endpoints.configurationState.sensitive=falsecas.monitor.endpoints.healthCheck.enabled=true
cas.monitor.endpoints.healthCheck.sensitive=falsecas.monitor.endpoints.loggingConfig.enabled=true
cas.monitor.endpoints.loggingConfig.sensitive=falsecas.monitor.endpoints.metrics.enabled=true
cas.monitor.endpoints.metrics.sensitive=falsecas.monitor.endpoints.attributeResolution.enabled=true
cas.monitor.endpoints.attributeResolution.sensitive=falsecas.monitor.endpoints.singleSignOnReport.enabled=true
cas.monitor.endpoints.singleSignOnReport.sensitive=falsecas.monitor.endpoints.statistics.enabled=true
cas.monitor.endpoints.statistics.sensitive=falsecas.monitor.endpoints.trustedDevices.enabled=true
cas.monitor.endpoints.trustedDevices.sensitive=falsecas.monitor.endpoints.status.enabled=true
cas.monitor.endpoints.status.sensitive=falsecas.monitor.endpoints.singleSignOnStatus.enabled=true
cas.monitor.endpoints.singleSignOnStatus.sensitive=falsecas.monitor.endpoints.springWebflowReport.enabled=true
cas.monitor.endpoints.springWebflowReport.sensitive=falsecas.monitor.endpoints.registeredServicesReport.enabled=true
cas.monitor.endpoints.registeredServicesReport.sensitive=falsecas.monitor.endpoints.configurationMetadata.enabled=true
cas.monitor.endpoints.configurationMetadata.sensitive=false
2.2.4 案例2:验证
cmd窗口进入cas-overlay-template工程目录,执行mvn clean package生成cas.war后部署到tomcat\webapps目录下。
启动tomcat加载完成后,打开浏览器访问网址http://127.0.0.1:7711/cas/status/dashboard。
打开浏览器访问网址http://127.0.0.1:7711/cas/status/dashboard。
以上可以看到即使不登录用户,也是可以访问/status/dashboard和/status/stats页面的。
2.2.3 案例3:明细配置版本-禁用某节点
本案例使用到文件:application.properties。这个文件的默认版本能从cas.war中获得。
以下配置加入到application.properties中,如果配置项已存在则覆盖。
#安全管理页访问时要校验的IP地址。例如设置成127.0.0.1那么在浏览器中只能用127.0.0.1来访问,即使用localhost也是无权限访问的。
#这样做的用意是保护安全管理页的访问权限。此项默认是注释掉的,默认值为127\.0\.0\.1,这里需要将其打开,否则是访问不到的。cas.adminPagesSecurity.ip=127.0.0.1
#管理上下文路径,默认为/status。
management.contextPath=/status
#是否开启管理安全,默认为true
management.security.enabled=true
#管理安全用户角色,默认为ACTUATOR,ADMIN
management.security.roles=ACTUATOR,ADMIN
#是否管理安全会话,默认为if_required
management.security.sessions=if_required#节点开关配置(全局)
#cas.monitor.endpoints.enabled=true
#cas.monitor.endpoints.sensitive=false#节点开关配置(明细)。每项后面指定enabled和sensitive
cas.monitor.endpoints.dashboard.enabled=true
cas.monitor.endpoints.dashboard.sensitive=falsecas.monitor.endpoints.discovery.enabled=true
cas.monitor.endpoints.discovery.sensitive=falsecas.monitor.endpoints.auditEvents.enabled=true
cas.monitor.endpoints.auditEvents.sensitive=falsecas.monitor.endpoints.authenticationEvents.enabled=true
cas.monitor.endpoints.authenticationEvents.sensitive=falsecas.monitor.endpoints.configurationState.enabled=true
cas.monitor.endpoints.configurationState.sensitive=falsecas.monitor.endpoints.healthCheck.enabled=true
cas.monitor.endpoints.healthCheck.sensitive=falsecas.monitor.endpoints.loggingConfig.enabled=true
cas.monitor.endpoints.loggingConfig.sensitive=falsecas.monitor.endpoints.metrics.enabled=true
cas.monitor.endpoints.metrics.sensitive=falsecas.monitor.endpoints.attributeResolution.enabled=true
cas.monitor.endpoints.attributeResolution.sensitive=falsecas.monitor.endpoints.singleSignOnReport.enabled=true
cas.monitor.endpoints.singleSignOnReport.sensitive=false#关闭/status/stats
cas.monitor.endpoints.statistics.enabled=false
cas.monitor.endpoints.statistics.sensitive=falsecas.monitor.endpoints.trustedDevices.enabled=true
cas.monitor.endpoints.trustedDevices.sensitive=falsecas.monitor.endpoints.status.enabled=true
cas.monitor.endpoints.status.sensitive=falsecas.monitor.endpoints.singleSignOnStatus.enabled=true
cas.monitor.endpoints.singleSignOnStatus.sensitive=falsecas.monitor.endpoints.springWebflowReport.enabled=true
cas.monitor.endpoints.springWebflowReport.sensitive=falsecas.monitor.endpoints.registeredServicesReport.enabled=true
cas.monitor.endpoints.registeredServicesReport.sensitive=falsecas.monitor.endpoints.configurationMetadata.enabled=true
cas.monitor.endpoints.configurationMetadata.sensitive=false
2.2.4 案例3:验证
cmd窗口进入cas-overlay-template工程目录,执行mvn clean package生成cas.war后部署到tomcat\webapps目录下。
启动tomcat加载完成后,打开浏览器访问网址http://127.0.0.1:7711/cas/status/dashboard。
打开浏览器访问网址http://127.0.0.1:7711/cas/status/stats。
以上可以看到当设置cas.monitor.endpoints.statistics.enabled=false时/status/stats模块无法访问了。
单点登录CAS-03:cas配置02-开启/status相关推荐
- 单点登录CAS-03:cas配置01-配置文件类型
单点登录CAS-03:cas配置01-配置文件类型 1.前言 2.配置文件分类 3.application.properties详解 3.1springboot相关参数 3.1.1 内置容器配置 3. ...
- SSO、单点登录、集成 CAS、OAuth2
SSO.单点登录.集成 CAS.OAuth2 JeeSite 已经默认集成了两种单点登录方式(Single Sign On): 1.SSO(简单登录)接口,实现快速登录系统. 2.与 Apereo C ...
- SSO单点登录系列2:cas客户端和cas服务端交互原理动画图解,cas协议终极分析
落雨 cas 单点登录 一.用户第一次访问web1应用. ps:上图少画了一条线,那一条线,应该再返回来一条,然后再到server端,画少了一步...谢谢提醒.而且,重定向肯定是从浏览器过去的.我写的 ...
- 单点登录系统和CAS的简介
什么是单点登录? 单点登录(Single Sign On),简称为SSO,是目前比较流行的企业业务整合的解决方案之一.SSO的定义是在多个应用系统中,用户只需要登录一次就可以访问所有相互信任的应用系统 ...
- cas登录成功什么意思_单点登录系统和CAS的简介
---恢复内容开始--- 什么是单点登录? 单点登录(Single Sign On),简称为SSO,是目前比较流行的企业业务整合的解决方案之一.SSO的定义是在多个应用系统中,用户只需要登录一次就可以 ...
- cas 单点登录_47 使用cas完成单点登录-02 搭建cas client完成单点登录
上一节我们搭建了cas server.这一节我们将搭建两个客户端完成单点登录的测试. 1.前提约束 完成搭建cas serverhttps://www.jianshu.com/p/ed0c1359b8 ...
- php java 单点登录_用cas来实现php的单点登陆
最近项目中需要做单点登录,客户端包含Java.ruby和PHP,java有几个应用程序,php是discuz+supesite+ucenter,配置步骤如下: 1.cas服务端:下载地址:http:/ ...
- CAS5.2x单点登录(一)——搭建cas服务器
系列文章列表: https://blog.csdn.net/u013825231/article/category/7517313 单点登录的介绍 单点登录(Single Sign On ,简称SSO ...
- Web 单点登录系统 JA-SIG CAS
JA-SIG CAS(Central Authentication Service)为Web应用系统提供了单点登录服务.它的特性包括:一个开放和具有很好文档支持的协议:一个Java开源服务器组件:提供 ...
最新文章
- 关于php的cgi,php-fpm的关系
- r语言和python-R语言和Python哪个适合生物信息学?
- c++ fstream用得多不?_自动挡中的“手自一体”,其实很好用,但真正会用的不多...
- 区块链系列教程之:比特币中的挖矿
- 关于单位基金资产净值
- CORS预检请求详谈
- dubbo的下载与运行
- 面向对象——面向客户端编程
- mysql 安装部署
- oa是计算机辅助系统吗,oa是管理系统吗
- eds能谱图分析实例_电子产品质量的提升,离不开这些失效分析!
- TMK2SLNO TMK1SLNO 华为OSN1800 2路STM-16,8路STM-4或8路STM-1光接口板
- IDEA如何设置author头注解
- android app闪退的原因分析,打开一个app就闪退解决方法
- Swagger、Rap与Yapi接口管理
- aligned_alloc
- DDR5 trainning
- 陀螺仪mpu6050的使用(附带HAL的使用)
- 设置使用 CUDA/显卡 的编号
- 正态分布离群值检验——偏度与峰度方法