Cas 服务器 为Service定义UI
Cas服务器允许用户为每个Service自定义登陆等UI外观,但需要尊着Cas定于的规则:
一、为Service配置theme(主题)
在《Cas 服务器 Service(Cas客户端)注册信息维护》中的 TEST-10000003.json 配置中增加 "theme": "test"
以上配置为该Service指定了要应用的主题为test,所以当以http://localhost:8081为域名的Cas客户端来请求登陆时,将展示test主题登陆UI。
二、建立theme(主题)资源
现在已经假定test主题,下面就要把该主题实现出来。要实现cas theme先要了解cas对theme实现的基本规则:
1、css、js等theme用到的静态资源,应放置在:src\main\resources\static\themes\主题名称目录下

2、theme用到的web视图资源,应放置在:src\main\resources\templates\主题名称目录下

3、theme配置文件,应放置在:src\main\resources\下,并命名为:主题名称.properties(或主题名称.yml)

注:只要用户按照上述规则完成资源文件的实现后,cas服务器将自动加载对应theme资源应用到Service。
三、编写theme资源文件内容
1、theme配置文件(test.properties)内容
css.file=/themes/test/css/test.css
pageTitle=Test主题演示
2、css样式表(test.css)内容
h3 {
color: red;
}
3、Web视图(casLoginView.html)内容
<!DOCTYPE html>
<html> <head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title th:text="${#themes.code('pageTitle')}"></title>
<link rel="stylesheet" th:href="@{${#themes.code('css.file')}}" />
</head> <body>
<h3 th:text="${#themes.code('pageTitle')}"></h3>
<div>
<form method="post" th:object="${credential}">
<div th:if="${#fields.hasErrors('*')}"><span th:each="err : ${#fields.errors('*')}" th:utext="${err}" />
</div>
<h4 th:utext="#{screen.welcome.instructions}"></h4>
<section class="row">
<label for="username" th:utext="#{screen.welcome.label.netid}" />
<div th:unless="${openIdLocalId}">
<input class="required" id="username" size="25" tabindex="1" type="text" th:disabled="${guaEnabled}" th:field="*{username}" th:accesskey="#{screen.welcome.label.netid.accesskey}" autocomplete="off" th:value="casuser" />
</div>
</section>
<section class="row">
<label for="password" th:utext="#{screen.welcome.label.password}" />
<div>
<input class="required" type="password" id="password" size="25" tabindex="2" th:accesskey="#{screen.welcome.label.password.accesskey}" th:field="*{password}" autocomplete="off" th:value="Mellon" />
</div>
</section>
<section>
<input type="hidden" name="execution" th:value="${flowExecutionKey}" />
<input type="hidden" name="_eventId" value="submit" />
<input type="hidden" name="geolocation" />
<input class="btn btn-submit btn-block" name="submit" accesskey="l" th:value="#{screen.welcome.button.login}" tabindex="6" type="submit" />
</section>
</form>
</div>
</body> </html>
注:关于cas web视图的语法,不在该文范围之内。要了解具体语法涵义,请自行百度。
四、运行测试

注:需要Cas客户端进行访问测试,单纯浏览器访问无法呈现该主题。
Cas 服务器 为Service定义UI的更多相关文章
- Cas 服务器 Service(Cas客户端)注册信息维护
作为Cas服务器,允许哪些客户端接入与否是通过配置来定义的.对Cas服务器来说,每一个接入的客户端与一个Service配置对应:在Cas服务器启动时加载并注册上这些Service,与之对应的客户端才能 ...
- cas协议,以及tomcat搭建cas服务器
1. CAS 简介 1.1. What is CAS ? CAS ( Central Authentication Service ) 是 Yale 大学发起的一个企业级的.开源的项目,旨 ...
- Cas服务器设置(java),java、php客户端配置
由于多个项目需要帐号的互通,所以一开始就是用cas去做的,不得不说cas要配置的东西挺多的,但是项目安全性不需要太高,所以没有做https的请求,也就是没有弄证书,这虽然省了很多时间和精力,但是项目之 ...
- cas服务器源码阅读笔记,对标博客
对标源码阅读博客:http://www.cnblogs.com/jiuzhongguo/category/375405.html 在CAS中很多地方使用了策略模式,那么根据什么方式来确定使用哪种策略呢 ...
- 安装CAS服务器
1.简介 参考: http://www.coin163.com/java/cas/cas.html CAS主要用于多系统单点登录,属于WEB SSO.SSO体系主要角色有三种:User(多个),WEB ...
- 单点登录CAS使用记(二):部署CAS服务器以及客户端
CAS-Server下载地址:https://www.apereo.org/projects/cas/download-cas CAS-Client下载地址:http://developer.jasi ...
- 应用整合CAS服务器方法
概要 在开发WEB程序时需要整合CAS实现单点登录,下面介绍一下应用整合CAS服务器的过程. 在开始之前,我们确定CAS服务器已经搭建完毕. 实现步骤 1.新建一个maven项目,引入casclien ...
- CAS5.2x单点登录(二)cas服务器连接数据库
前面一节应该已经告诉大家如何搭建cas的服务器了,可是搭建好能用吗?我们现在的用户验证是在哪呢?哪个默认的用户名和密码有是在哪呢? 本节就讲一下如何使用cas服务器连接我们自己的用户数据库,毕竟没有哪 ...
- CAS5.2x单点登录(一)——搭建cas服务器
系列文章列表: https://blog.csdn.net/u013825231/article/category/7517313 单点登录的介绍 单点登录(Single Sign On ,简称SSO ...
随机推荐
- 模板发送java邮件
Creating email content using a templating library The code in the previous examples explicitly creat ...
- WebBrowser使用例子
本文参考了:http://www.cnblogs.com/txw1958/archive/2012/09/24/CSharp-WebBrowser.html 在上文的基础上加入了 一些处理弹出对话框的 ...
- 逆向知识第一讲,IDA的熟悉使用
逆向知识第一讲,IDA的熟悉使用 一丶熟悉IDA,以及手工制作sig文件. IDA,静态分析工具,网上随便找一个即可下载. 首先,我们写一个可执行EXE,最简单的 使用IDA打开. 1.提示使用什么格 ...
- WebService SOAP
<wsdl:definitions xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http:// ...
- Go实用开源库收集
框架 https://github.com/go-martini/martini 图形验证码 https://github.com/dchest/captcha ORM https://github. ...
- Python系列:二、数据类型--技术流ken
标准数据类型 Python3 中有六个标准的数据类型: Number(数字) String(字符串) List(列表) Tuple(元组) Set(集合) Dictionary(字典) Python3 ...
- js如何获取url参数
匹配URL参数的正则是: var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", ...
- 第一册:lesson eighty nine.
原文: For sale. A:Good afternoon. I believe that the house is for sale. B:That's right. A:May I have a ...
- 水晶报表Crystal 无效索引
这几天项目用到水晶报表做报表打印,没有前辈指导,都自己摸着石头过河,真是痛并快乐着.其实水晶报表还是挺好用的,对初学者也并不难(我就是初学者).昨天遇到一个问题:无效索引 ……开始以为是报表设置的问题 ...
- 推荐数据库、Web、Net、架构的PDF数据,书不在多,在看!
先收藏,后看:千万不要做一个屯书的人,一定要坚持有选择性的看下去: 数据库类 SqlServer Oracle .NET 更多... Web 更多... 架构 不刮了,直接可以看到了. 链接: h ...
