文章目录
一. 需求
- cas如何接收参数
- 接收参数如何更改登录页配置,如登录title
具体需求描述:cas登录页中的title(如平台名称)是可配置的,比如从apollo读取,apollo配置样例:
{
"2201": "平台名称2201",
"2202": "平台名称2202",
"default": "默认平台名称"
}
通过传递参数,控制登录页平台名称,如传入**“2201”,平台名称为"平台名称2201",传入"2202",平台名称为"平台名称2202"**。
二. 实现步骤
1. 访问方式
http://192.168.200.111:8085/cas/login?area=2202&service=http://192.168.200.111:8089/center
传入参数为area
2. 参数接收及应用
重载org.apereo.cas.web.flow.login.InitialFlowSetupAction
public Event doExecute(final RequestContext context) {
HttpServletRequest request = WebUtils.getHttpServletRequestFromExternalWebflowContext(context);
if (request.getMethod().equalsIgnoreCase(HttpMethod.POST.name())) {
WebUtils.putInitialHttpRequestPostParameters(context);
}
this.configureCookieGenerators(context);
this.configureWebflowContext(context);
this.configureWebflowContextForService(context);
//增加了此方法
this.configureBussinessSetting(context);
return this.success();
}
private void c