cas4.1证书生成,服务端搭建,注意事项
来源:互联网 发布:伴唱软件 编辑:程序博客网 时间:2024/04/29 20:25
服务器端证书
我们在F盘下建立一个cas文件夹,在此文件夹中生成证书文件,打开dos命令窗口,进入此目录下,这样我们就不用来回制定路径了,只用关心证书生成,它会自动生成到cas文件夹里如图:
生成服务器端证书,
此命令用于在当前目录下新建别名为:server,执行完此命令cas文件夹下多了一个server.keystore文件。
导出服务器端证书,
执行完此命令cas文件夹下多了一个server.cer文件
导入服务器端证书,
执行完此命令cas文件夹下多了一个cacerts文件。
如果输入密码后报错,请将密码改为changeit。
END
客户端证书
生成客户端证书,
执行完此命令cas文件夹下多了一个client.keystore文件。
导出客户端证书,
执行完此命令cas文件夹下多了一个client.cer文件。
导入客户端证书,
执行完此命令cas文件夹文件数量不变。
END
然后是搭建服务器端
只需要在这里http://developer.jasig.org/cas/下载cas4.1文件,然后放到tomcat里,确保tomcat根目录下(就是和webapps同一级目录)放了我们上面生成的四个证书(除了cacerts),然后就是修改server.xml文件
修改8443端口为
<Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true" keystoreFile="D:\cas\server.keystore"keystorePass="changeit" maxThreads="150" scheme="https" secure="true" clientAuth="false" sslProtocol="TLS" />此时就可以启动项目登陆了,这时用户名密码都是写死的, casuser Mellon
我们可以自己配置读取数据库 修改apache-tomcat-7.0.52\webapps\cas\WEB-INF下的deployerConfigContext.xml文件
<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p" xmlns:c="http://www.springframework.org/schema/c" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:util="http://www.springframework.org/schema/util" xmlns:sec="http://www.springframework.org/schema/security" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.2.xsd http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.2.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd"> <!-- | The authentication manager defines security policy for authentication by specifying at a minimum | the authentication handlers that will be used to authenticate credential. While the AuthenticationManager | interface supports plugging in another implementation, the default PolicyBasedAuthenticationManager should | be sufficient in most cases. +--> <bean id="authenticationManager" class="org.jasig.cas.authentication.PolicyBasedAuthenticationManager"> <constructor-arg> <map> <!-- | IMPORTANT | Every handler requires a unique name. | If more than one instance of the same handler class is configured, you must explicitly | set its name to something other than its default name (typically the simple class name). --> <entry key-ref="proxyAuthenticationHandler" value-ref="proxyPrincipalResolver" /> <entry key-ref="primaryAuthenticationHandler" value-ref="primaryPrincipalResolver" /> </map> </constructor-arg> <!-- Uncomment the metadata populator to allow clearpass to capture and cache the password This switch effectively will turn on clearpass. <property name="authenticationMetaDataPopulators"> <util:list> <bean class="org.jasig.cas.extension.clearpass.CacheCredentialsMetaDataPopulator" c:credentialCache-ref="encryptedMap" /> </util:list> </property> --> <property name="authenticationPolicy"> <bean class="org.jasig.cas.authentication.AnyAuthenticationPolicy" /> </property> </bean> <!-- Required for proxy ticket mechanism. --> <bean id="proxyAuthenticationHandler" class="org.jasig.cas.authentication.handler.support.HttpBasedServiceCredentialsAuthenticationHandler" p:httpClient-ref="httpClient" /> <bean id="primaryAuthenticationHandler" class="org.jasig.cas.adaptors.jdbc.QueryDatabaseAuthenticationHandler"><property name="dataSource" ref="dataSource"></property><property name="sql" value="select password from user_info where username=? "></property><property name="passwordEncoder" ref="MD5PasswordEncoder"></property></bean> <!-- Required for proxy ticket mechanism --> <bean id="proxyPrincipalResolver" class="org.jasig.cas.authentication.principal.BasicPrincipalResolver" /> <!-- | Resolves a principal from a credential using an attribute repository that is configured to resolve | against a deployer-specific store (e.g. LDAP). --> <bean id="primaryPrincipalResolver" class="org.jasig.cas.authentication.principal.PersonDirectoryPrincipalResolver" > <property name="attributeRepository" ref="attributeRepository" /> </bean> <!-- Bean that defines the attributes that a service may return. This example uses the Stub/Mock version. A real implementation may go against a database or LDAP server. The id should remain "attributeRepository" though. +--> <bean id="attributeRepository" class="org.jasig.services.persondir.support.StubPersonAttributeDao" p:backingMap-ref="attrRepoBackingMap" /> <util:map id="attrRepoBackingMap"> <entry key="uid" value="uid" /> <entry key="eduPersonAffiliation" value="eduPersonAffiliation" /> <entry key="groupMembership" value="groupMembership" /> </util:map> <!-- Sample, in-memory data store for the ServiceRegistry. A real implementation would probably want to replace this with the JPA-backed ServiceRegistry DAO The name of this bean should remain "serviceRegistryDao". +--> <bean id="serviceRegistryDao" class="org.jasig.cas.services.InMemoryServiceRegistryDaoImpl" p:registeredServices-ref="registeredServicesList" /> <util:list id="registeredServicesList"> <bean class="org.jasig.cas.services.RegexRegisteredService" p:id="0" p:name="HTTP and IMAP" p:description="Allows HTTP(S) and IMAP(S) protocols" p:serviceId="^(https?|imaps?)://.*" p:evaluationOrder="10000001" /> <!-- Use the following definition instead of the above to further restrict access to services within your domain (including sub domains). Note that example.com must be replaced with the domain you wish to permit. This example also demonstrates the configuration of an attribute filter that only allows for attributes whose length is 3. --> <!-- <bean class="org.jasig.cas.services.RegexRegisteredService"> <property name="id" value="1" /> <property name="name" value="HTTP and IMAP on example.com" /> <property name="description" value="Allows HTTP(S) and IMAP(S) protocols on example.com" /> <property name="serviceId" value="^(https?|imaps?)://([A-Za-z0-9_-]+\.)*example\.com/.*" /> <property name="evaluationOrder" value="0" /> <property name="attributeFilter"> <bean class="org.jasig.cas.services.support.RegisteredServiceRegexAttributeFilter" c:regex="^\w{3}$" /> </property> </bean> --> </util:list> <bean id="auditTrailManager" class="com.github.inspektr.audit.support.Slf4jLoggingAuditTrailManager" /> <bean id="healthCheckMonitor" class="org.jasig.cas.monitor.HealthCheckMonitor" p:monitors-ref="monitorsList" /> <util:list id="monitorsList"> <bean class="org.jasig.cas.monitor.MemoryMonitor" p:freeMemoryWarnThreshold="10" /> <!-- NOTE The following ticket registries support SessionMonitor: * DefaultTicketRegistry * JpaTicketRegistry Remove this monitor if you use an unsupported registry. --> <bean class="org.jasig.cas.monitor.SessionMonitor" p:ticketRegistry-ref="ticketRegistry" p:serviceTicketCountWarnThreshold="5000" p:sessionCountWarnThreshold="100000" /> </util:list><bean id="MD5PasswordEncoder" class="org.jasig.cas.authentication.handler.DefaultPasswordEncoder"><constructor-arg index="0" ><value>MD5</value></constructor-arg></bean><bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"><property name="driverClassName"><value>com.mysql.jdbc.Driver</value></property><property name="url"><value>jdbc:mysql://localhost:3306/test</value></property><property name="username"><value>root</value></property><property name="password"><value>root</value></property></bean></beans>
至此服务端就完了,如果想让用户登出后跳到我们指定的地址,则需要在cas-servelt.xml文件里修改followServiceRedirects属性为true。
坑:
1、客户端的web.xml文件的登出过滤器一定要放在所有的filter之前,不仅仅是单点登录的filter之前,否则会一个登出了但是另外的客户端还在线。
2、cas服务端4.2以上也有是maven构建的,只不过需要tomcat8和jdk8
3、关于登出操作后不能跳转到我们自定义的页面的问题,需要我们设置cas服务端的cas-servlet.xml文件的followServiceRedirects属性为true才可以
4、在将cas客户端与springBoot整合时发现如果不在cas5.1的配置文件 HTTPSandIMAPS-10000001.json内添加支持http请求的话会报未认证授权的服务的错误,
阅读全文
0 0
- cas4.1证书生成,服务端搭建,注意事项
- 生成服务端推送证书
- APNS 证书生成注意事项
- cas4.0服务端集群
- 1、cas4.0 单点登录 之 https证书
- 单点登录cas综述之cas4.2.7服务端+cas客户端+示例程序+环境搭建说明-陈杰
- CAS4搭建HTTP环境
- DAY19_openssl命令行生成服务端证书+建立服务器端
- 【SSO单点系列】(1):CAS4.0 环境的搭建
- 【SSO单点系列】(1):CAS4.0 环境的搭建
- 【SSO单点系列】(1):CAS4.0 环境的搭建
- CAS4.0 服务端配置与自定义拓展
- CAS4.0之环境搭建
- IOS 消息推送---服务端.p12证书的生成
- 服务端生成技术(1)
- CAS4.0 4.1 服务器端搭建(一)
- CAS4.0 4.1 服务器端搭建(二)
- 利用keytool/Openssl来生成服务端和客户端证书,根证书。
- Spring:源码解读Spring IOC原理
- js动态添加div 用于java后台的form表单的提交
- springboot附件上传超限org.apache.tomcat.util.http.fileupload.FileUploadBase$FileSizeLimitExceededException
- Android Jni OpenCV图片灰度处理
- 通过COOKIE统计网站的访问量
- cas4.1证书生成,服务端搭建,注意事项
- 使用Session技术实现网站换肤
- css3浏览器前缀兼容
- IntelliJ-IDEA编译Maven工程如何跳过test代码
- 启用GD2函数库
- HTML5 高级系列:web Storage
- oracle关于索引
- GD2创建画布
- Nginx解决代理冲突问题图片访问不出来的问题
原创粉丝点击
热门IT博客
热门问题
老师的惩罚
人脸识别
我在镇武司摸鱼那些年
重生之率土为王
我在大康的咸鱼生活
盘龙之生命进化
天生仙种
凡人之先天五行
春回大明朝
姑娘不必设防,我是瞎子
检查肾功能要空腹吗
尿酸高肾功能不全
肾功能不全能吃醋吗
做个肾功能检查多少钱
肝功肾功怎么检查
肾功能检查要多少钱
肾功能尿素氮偏高
肾功能四项
肾功能不全能活多少年
肾功能异常的表现
肾功能不全能活几年
秋水仙碱 肾功能不全
肾功能检查需要多少钱
肾功能恢复
慢性肾功能衰竭饮食
怎么锻炼肾功能
肾功能检查能查出什么
肾功能衰竭会怎样
肾功能衰竭有哪些症状
健骨宝
肾骨片
肾安片
肾骨片价格
肾康片
什么茶对肾好
药茶大全
肾黄金
肾积水药
肾囊肿吃什么药能消除
肾不好吃什么药
肾两虚吃什么药
张国周胃强散
第九区2降临者来袭
第九区2降临者来袭在线
第九区2 降临者来袭
强调句
英语强调句
英语强调句例句20个
强调句练习
强调句 英语怎么说
强调句句型结构