1. 程式人生 > >CAS單點登陸更改認證方式和持久化ticket

CAS單點登陸更改認證方式和持久化ticket

基於以上,有一些問題處理.

CAS3.5.2.1

修改認證方式 deployerConfigContext.xml

<?xml version="1.0" encoding="UTF-8"?>
<!--


    Licensed to Jasig under one or more contributor license
    agreements. See the NOTICE file distributed with this work
    for additional information regarding copyright ownership.
    Jasig licenses this file to you under the Apache License,
    Version 2.0 (the "License"); you may not use this file
    except in compliance with the License.  You may obtain a
    copy of the License at the following location:


      http://www.apache.org/licenses/LICENSE-2.0


    Unless required by applicable law or agreed to in writing,
    software distributed under the License is distributed on an
    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    KIND, either express or implied.  See the License for the
    specific language governing permissions and limitations
    under the License.


-->
<!--
| deployerConfigContext.xml centralizes into one file some of the declarative configuration that
| all CAS deployers will need to modify.
|
| This file declares some of the Spring-managed JavaBeans that make up a CAS deployment.  
| The beans declared in this file are instantiated at context initialization time by the Spring 
| ContextLoaderListener declared in web.xml.  It finds this file because this
| file is among those declared in the context parameter "contextConfigLocation".
|
| By far the most common change you will need to make in this file is to change the last bean
| declaration to replace the default SimpleTestUsernamePasswordAuthenticationHandler with
| one implementing your approach for authenticating usernames and passwords.
+-->


<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:tx="http://www.springframework.org/schema/tx"
       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.1.xsd
       http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd
       http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.1.xsd">
<!--
| This bean declares our AuthenticationManager.  The CentralAuthenticationService service bean
| declared in applicationContext.xml picks up this AuthenticationManager by reference to its id, 
| "authenticationManager".  Most deployers will be able to use the default AuthenticationManager
| implementation and so do not need to change the class of this bean.  We include the whole
| AuthenticationManager here in the userConfigContext.xml so that you can see the things you will
| need to change in context.
+-->
<bean id="authenticationManager" class="org.jasig.cas.authentication.AuthenticationManagerImpl">

<!-- Uncomment the metadata populator to allow clearpass to capture and cache the password
    This switch effectively will turn on clearpass.
<property name="authenticationMetaDataPopulators">
  <list>
     <bean class="org.jasig.cas.extension.clearpass.CacheCredentialsMetaDataPopulator">
        <constructor-arg index="0" ref="credentialsCache" />
     </bean>
  </list>
</property>
-->

<!--
| This is the List of CredentialToPrincipalResolvers that identify what Principal is trying to authenticate.
| The AuthenticationManagerImpl considers them in order, finding a CredentialToPrincipalResolver which 
| supports the presented credentials.
|
| AuthenticationManagerImpl uses these resolvers for two purposes.  First, it uses them to identify the Principal
| attempting to authenticate to CAS /login .  In the default configuration, it is the DefaultCredentialsToPrincipalResolver
| that fills this role.  If you are using some other kind of credentials than UsernamePasswordCredentials, you will need to replace
| DefaultCredentialsToPrincipalResolver with a CredentialsToPrincipalResolver that supports the credentials you are
| using.
|
| Second, AuthenticationManagerImpl uses these resolvers to identify a service requesting a proxy granting ticket. 
| In the default configuration, it is the HttpBasedServiceCredentialsToPrincipalResolver that serves this purpose. 
| You will need to change this list if you are identifying services by something more or other than their callback URL.
+-->
<property name="credentialsToPrincipalResolvers">
<list>
<bean class="org.jasig.cas.authentication.principal.UsernamePasswordCredentialsToPrincipalResolver" >
<property name="attributeRepository" ref="attributeRepository" />
</bean>
<bean class="org.jasig.cas.authentication.principal.HttpBasedServiceCredentialsToPrincipalResolver" />
</list>
</property>


<!--
| Whereas CredentialsToPrincipalResolvers identify who it is some Credentials might authenticate, 
| AuthenticationHandlers actually authenticate credentials.  Here we declare the AuthenticationHandlers that
| authenticate the Principals that the CredentialsToPrincipalResolvers identified.  CAS will try these handlers in turn
| until it finds one that both supports the Credentials presented and succeeds in authenticating.
+-->
<property name="authenticationHandlers">
<!-- 以下3中驗證方式有一種通過即可 -->
<list>
<!-- <bean class="org.jasig.cas.authentication.handler.support.HttpBasedServiceCredentialsAuthenticationHandler"
p:httpClient-ref="httpClient" /> -->
<bean  class="com.infohold.ecif.EcifQueryDatabastAuthenticationHandler">
<property name="dataSource" ref="dataSource" ></property>  
<property name="passwordEncoder" ref="passwordEncoder"></property>
</bean>

</list>
</property>
</bean>

<!-- mysql連線 -->
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
  <property name="driverClass" value="${jdbc.driverClass}" />
<property name="jdbcUrl" value="${jdbc.jdbcUrl}" />
<property name="user" value="${jdbc.user}" />
<property name="password" value="${jdbc.password}" />
</bean> 
<bean id="passwordEncoder" class="org.jasig.cas.authentication.handler.DefaultPasswordEncoder">
<constructor-arg value="MD5" />
</bean>
<!--
This bean defines the security roles for the Services Management application.  Simple deployments can use the in-memory version.
More robust deployments will want to use another option, such as the Jdbc version.

The name of this should remain "userDetailsService" in order for Spring Security to find it.
-->
    <!-- <sec:user name="@@THIS SHOULD BE

[email protected]@" password="notused" authorities="ROLE_ADMIN" />-->


    <sec:user-service id="userDetailsService">
        <sec:user name="@@THIS SHOULD BE [email protected]@" password="notused" authorities="ROLE_ADMIN" />
    </sec:user-service>

<!-- 
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.jdbc.SingleRowJdbcPersonAttributeDao">
<constructor-arg index="0" ref="dataSource" />
<constructor-arg index="1" value="SELECT u.user_id ,u.login_id FROM auth_user u where {0} "/>
<property name="queryAttributeMapping">
<map>
<entry key="username" value="u.user_id" />
</map>
</property>
<property name="resultAttributeMapping">
<map>
<entry key="user_id" value="user_id" />
<entry key="login_id" value="login_id" />
</map>
</property>
</bean>
<!-- <bean id="attributeRepository"
class="org.jasig.services.persondir.support.StubPersonAttributeDao">
<property name="backingMap">
<map>
<entry key="uid" value="uid" />
<entry key="eduPersonAffiliation" value="eduPersonAffiliation" /> 
<entry key="groupMembership" value="groupMembership" />
</map>
</property>
</bean> -->

<!-- 
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.JpaServiceRegistryDaoImpl"
p:entityManagerFactory-ref="entityManagerFactory"> 
</bean>
  -->
<bean id="serviceRegistryDao" class="org.jasig.cas.services.InMemoryServiceRegistryDaoImpl">
            <property name="registeredServices">
                <list>
                    <bean class="org.jasig.cas.services.RegexRegisteredService">
                        <property name="id" value="0" />
                        <property name="name" value="HTTP and IMAP" />
                        <property name="description" value="Allows HTTP(S) and IMAP(S) protocols" />
                        <property name="serviceId" value="^(https?|imaps?)://.*" />
                        <property name="evaluationOrder" value="10000001" />
                        <property name="allowedAttributes">
                        <list>
                        <value>user_id</value>
                        <value>login_id</value>
                        </list>
                        </property>
                    </bean>
                    
                   <!--  Use the following definition instead of the above to further restrict access
                    to services within your domain (including subdomains).
                    Note that example.com must be replaced with the domain you wish to permit. -->
                   
                    
                   <!--  <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" />
                    </bean> -->
                   
                </list>
            </property>
        </bean>


  <bean id="auditTrailManager" class="com.github.inspektr.audit.support.Slf4jLoggingAuditTrailManager" />
  
  <bean id="healthCheckMonitor" class="org.jasig.cas.monitor.HealthCheckMonitor">
    <property name="monitors">
      <list>
        <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" />
      </list>
    </property>
  </bean>
</beans>

增加認證類

package com.infohold.ecif;


import java.io.UnsupportedEncodingException;
import java.util.List;
import java.util.Map;


import net.sf.json.JSONObject;


import org.apache.log4j.Logger;
import org.jasig.cas.adaptors.jdbc.AbstractJdbcUsernamePasswordAuthenticationHandler;
import org.jasig.cas.authentication.handler.AuthenticationException;
import org.jasig.cas.authentication.principal.UsernamePasswordCredentials;
import org.springframework.dao.DataAccessException;


/**
 * Cas 登入資訊驗證Handler
 * @author wanglei
 *
 */
@SuppressWarnings("deprecation")
public class EcifQueryDatabastAuthenticationHandler extends AbstractJdbcUsernamePasswordAuthenticationHandler{

private Logger logger = Logger.getLogger(EcifQueryDatabastAuthenticationHandler.class);


//校驗使用者資訊SQL
final String check_sql = "SELECT * FROM auth_user u where u.login_id = ? ";
//CAS登入-查詢使用者資訊
final String query_user_sql="SELECT "
+ "  u.user_id,"
+ "  u.login_id,"
+ "  u.user_name,"
+ "  u.tel_no,"
+ "  u.status,"
+ "  o.org_id,"
+ "  o.org_name "
+ " FROM "
+ "  auth_user u,"
+ "  auth_organization o "
+ " WHERE u.org_id = o.org_id "
+ "    AND u.status <> 2 "
+ "    AND u.user_id =  ?"
;
//查詢角色資訊SQL
String query_role_sql ="SELECT "
+ "  r.role_id,"
+ "  r.role_name "
+ " FROM "
+ "  auth_user u,"
+ "  auth_user_role_ref ur,"
+ "  auth_role r "
+ "WHERE u.user_id = ur.user_id "
+ "  AND ur.role_id = r.role_id "
+ "  AND u.user_id = ? ";
//查詢會計日期
final String query_sysdate_sql = "select value_ AS sysdate from sys_parameter_cfg a where a.key_ ='system_date'";
@Override
protected boolean authenticateUsernamePasswordInternal(UsernamePasswordCredentials credentials) throws AuthenticationException {

final String username = getPrincipalNameTransformer().transform(credentials.getUsername());

final String password = credentials.getPassword();

final String encryptedPassword = this.getPasswordEncoder().encode(password);
if(username==null||"".equals(username)||password==null||"".equals(password)){
throw new AuthenticationException(("使用者/密碼不允許為空!")){
private static final long serialVersionUID = 8332664732922045828L;
};
}else{
Map<String, Object> register;
try {
register = getJdbcTemplate().queryForMap(this.check_sql,username);

final String login_pwd = (String) register.get("user_password");
final String user_id = (String) register.get("user_id");
String str="";
if(login_pwd.equals(encryptedPassword)){
//查詢使用者
List<Map<String, Object>> userList =getJdbcTemplate().queryForList(this.query_user_sql,user_id);
if (userList.isEmpty()) {
throw new AuthenticationException(("使用者資訊存在異常,請聯絡管理員!")){
private static final long serialVersionUID = 8332664732922045828L;
};
} else {
// 查詢使用者角色資訊
List<Map<String, Object>> roleList =getJdbcTemplate().queryForList(this.query_role_sql,user_id);
List<Map<String, Object>> sysList =getJdbcTemplate().queryForList(this.query_sysdate_sql);
//查詢會計日期
//拼裝session
Map<String,Object> map=userList.get(0);
map.put("roleList", roleList);
map.put("sysdate", sysList.get(0).get("sysdate")+"");
//System.out.println(map.get("user_name")+"");
str=this.parseMapToJSON(map);
}
logger.info("使用者資訊:"+str);
byte[] s;
try {
s = str.getBytes("UTF-8");
String ss=new sun.misc.BASE64Encoder().encode(s);
credentials.setUsername(ss);
} catch (UnsupportedEncodingException e) {
logger.info(e);
}
return true;
}else{
throw new AuthenticationException(("密碼輸入錯誤,請重新輸入!")){
private static final long serialVersionUID = 8332664732922045828L;
};
}
} catch (DataAccessException e) {
logger.info(e);
return false;
}
}
}

/**
     * 將MAP物件轉換成JSON字串
     * @param map
     * @return
     */
    public String parseMapToJSON(Map<String, Object> map){  
        JSONObject str=JSONObject.fromObject(map);
        String data=str.toString().replace("\"","'");
        return data;
    }  

}

持久化ticket

增加src/persistence.xml

<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence 
http://java.sun.com/xml/ns/persistence/persistence_version=1">
<persistence-unit name="mysqlJPA" transaction-type="RESOURCE_LOCAL">
<!-- <properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5Dialect" />
<property name="hibernate.connection.driver_class" value="${jdbc.driverClass}" />
<property name="hibernate.connection.username" value="${jdbc.user}" />
<property name="hibernate.connection.password" value="${jdbc.password}" />
<property name="hibernate.connection.url" value="${jdbc.jdbcUrl}" />
<property name="hibernate.hbm2ddl.auto" value="update" />
<property name="hibernate.max_fetch_depth" value="600" />

</properties> -->
<class>org.jasig.cas.services.AbstractRegisteredService</class>
<class>org.jasig.cas.services.RegexRegisteredService</class>
<class>org.jasig.cas.services.RegisteredServiceImpl</class>
<class>org.jasig.cas.ticket.TicketGrantingTicketImpl</class>
<class>org.jasig.cas.ticket.ServiceTicketImpl</class>
<class>org.jasig.cas.ticket.registry.support.JpaLockingStrategy$Lock
</class>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect" />
</properties>
</persistence-unit>
</persistence>  

修改 ticketRegistry.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:tx="http://www.springframework.org/schema/tx"
       xsi:schemaLocation="http://www.springframework.org/schema/beans 
       http://www.springframework.org/schema/beans/spring-beans-2.0.xsd 
            http://www.springframework.org/schema/tx 
            http://www.springframework.org/schema/tx/spring-tx-2.0.xsd
            ">
    <description>
        Configuration for the default TicketRegistry which stores the tickets in-memory and cleans them out as specified intervals.
    </description>
    <!-- Ticket Registry -->
    <bean id="ticketRegistry" class="org.jasig.cas.ticket.registry.JpaTicketRegistry"></bean>
     <!--  讓@PersistenceUnit and @PersistenceContext 自動注入 EntityManager/Factory 例項 -->
 <bean class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor"/>
 
    <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
        <property name="dataSource" ref="dataSource" />
        <property name="jpaVendorAdapter">
            <bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
                <property name="generateDdl" value="true" />
                <property name="showSql" value="true" />
            </bean>
        </property>
        <property name="jpaProperties">
            <props>
                <prop key="hibernate.dialect">org.hibernate.dialect.MySQL5InnoDBDialect</prop>
                <prop key="hibernate.hbm2ddl.auto">update</prop>
            </props>
        </property>
    </bean>

    <bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager"
        p:entityManagerFactory-ref="entityManagerFactory" />
    <tx:annotation-driven transaction-manager="transactionManager" />
  
   <!-- mysql連線 -->
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
  <property name="driverClass" value="${jdbc.driverClass}" />
<property name="jdbcUrl" value="${jdbc.jdbcUrl}" />
<property name="user" value="${jdbc.user}" />
<property name="password" value="${jdbc.password}" />
</bean> 
    
    <!-- Ticket Registry -->
    <!-- 預設的ticket registry,放記憶體裡CAS伺服器端改造
    <bean id="ticketRegistry" class="org.jasig.cas.ticket.registry.DefaultTicketRegistry" />
    -->
    <!-- 在叢集環境,多個cas 伺服器共享同一個資料庫節點,當需要清理ticket時,會出現表爭用,
但是cas通過cleanerLock解決了這個問題,同時並不會影響應用的效能。-->
<bean id="cleanerLock" class="org.jasig.cas.ticket.registry.support.JpaLockingStrategy"
            p:uniqueId="${host.name}"
            p:applicationId="cas-ticket-registry-cleaner"/>
     
    <!--Quartz -->
    <!-- TICKET REGISTRY CLEANER -->
    <bean id="ticketRegistryCleaner" class="org.jasig.cas.ticket.registry.support.DefaultTicketRegistryCleaner"
        p:ticketRegistry-ref="ticketRegistry" 
        p:lock-ref="cleanerLock"/>
    


    <bean id="jobDetailTicketRegistryCleaner" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean"
        p:targetObject-ref="ticketRegistryCleaner"
        p:targetMethod="clean" />
    
  <bean id="triggerJobDetailTicketRegistryCleaner" class="org.springframework.scheduling.quartz.SimpleTriggerBean"
        p:jobDetail-ref="jobDetailTicketRegistryCleaner"
        p:startDelay="20000"
        p:repeatInterval="5000000" /> 
        
</beans>

增加jdbc.properties

jdbc.driverClass=com.mysql.jdbc.Driver
jdbc.jdbcUrl=jdbc:mysql://****3306/portal?characterEncoding=utf8
jdbc.user=a
jdbc.password=a

相關推薦

CAS登陸更改認證方式持久化ticket

基於以上,有一些問題處理. CAS3.5.2.1 修改認證方式 deployerConfigContext.xml <?xml version="1.0" encoding="UTF-8"?> <!--     Licensed to Jasig und

cas登陸系統-建立登陸系統的應用

dep authent loginurl get nth spring password list c項目 上一篇如果已經操作成功,說明casServer已經實現了,下面就是搭建casClient與casServer聯合調試。代碼已經上傳到github上。你可以下載看看,如

cas 登陸實戰-sso-config篇(五)

  本篇我們講解cas單點登陸在與shiro整合,在與redis整合遇到的問題 先看完整程式碼吧 package com.madnet.config; import com.google.common.base.CaseFormat; import com.madnet

cas 登陸實戰-sso-config篇(四)

本篇章繼續講解寫cas時遇到的坑------證書生成。 在window下的證書生成,在linxu下的cas證書生成,證書用域名,證書用ip 糾正一點,網上說的cas證書生成只能用域名是錯誤的。也是可以用ip的,親測有效。 1.在windows下的證書生成(域名) 注意:CN=域名,我

cas 登陸實戰-sso-config篇(三)

本篇介紹一下遇到的一些問題: 一. 在cas伺服器端寫java程式碼,寫controller,設計頁面。 1.因為用的springboot,所以,你需要注意一下你的目錄結構。  2.controller類需要繼承AbstractController這個類。 3.

cas 登陸實戰-sso-config篇(二)

回顧:上章我們簡單介紹了服務端的目錄結構。現在來介紹目錄結構的第一部分 sso-config 一.看一下目錄結構      1.這裡面先重點關注兩個檔案  cas-management-dev.properties和sso-dev.properti

cas 登陸實戰-整體目錄結構(一)

我儘量把該教程寫的貼合實戰,減少理論知識,以快速開發為主 一. 教程結構       該教程分為兩部分,第一部分為cas 服務端 。第二部分為client 客戶端。       簡單解釋一下:  你在做cas

CAS登陸

1、主要是兩個應用server和client 2、server一般單獨部署。client跟應用一起,通過filter的方式監控,保護受保護的資源 3、流程: 客戶端先發送請求受保護的資源(需要登陸才能獲取到的東西)——發現沒有登陸(HTTP請求中沒有Service Ticket,一般登陸

登陸CAS實現1搭建cas伺服器子系統並去除https

什麼是CAS CAS是Central Authentication Service的縮寫,中央認證服務,一種獨立開放指令協議。CAS 是 Yale 大學發起的一個開源專案,旨在為 Web 應用系統提供一種可靠的單點登入方法,CAS 在 2004 年 12 月正式成為 JA

CAS登入-配置資料庫認證方式

接下來,說一下配置資料庫認證單點登入 如果你之前的單點登入搭成功了,之後就簡單多了,只需要新增一些配置和jar包即可。若未成功,請參考CAS單點登入入門配置 步驟: 1、引入相關jar包 2、建立資料庫和表,填入資料 3、修改配置檔案 4、部署,啟動tomcat 完成 1

cas登錄-jdbc認證(三)

warn uil 單向加密 admin rom hibernate con als salt 前言 本節的內容為JDBC認證,查找數據庫進行驗證,其中包括: 密碼加密策略(無密碼,簡單加密,加鹽處理) 認證策略(jdbc) 一、業務需求 不同的公司,需求業務需求或者架

JEPLUS平臺登陸實現方式——JEPLUS軟件快速開發平臺

Edito proc eight tex 閱讀 note 圖片 term 功能 JEPLUS平臺單點登陸實現方式單點登陸是一個比較實用比較常用的功能,一些客戶也遇到過這些問題,今天這篇筆記就講解一下JEPLUS平臺如何集成單點登陸,如何在JE

CAS統一登入認證(16): openedx 通過oauth2.0接入cas登入

openedx 是流行的開源mooc(慕課)平臺,我這安裝的是edx-ginkgo.2-7版本,cas是5.3.2 這個接入頗費了一番周折,總是設定不成功,因為沒有可以直接參考的案例,只有edx的官方站點有些說明,但都是針對google,facebook,github等賬號的第三方oauth2.

springSecurity的練習筆記--認證伺服器,資源伺服器,以及登陸

   花了一天半左右,將springSecurity後面的練習看完並且進行練習實踐與測試!   按照慣例進行筆記的整理。  認證伺服器的構建:    核心依賴:    注意,是oauth2而不

CAS-開源登陸系統-實踐

一、CAS入門 1、什麼是單點登陸?     單點登入(Single Sign On),簡稱為 SSO,是目前比較流行的企業業務整合的解決方案之一。SSO的定義是在多個應用系統中,使用者只需要登入一次就可以訪問所有相互信任的應用系統。     我們目前的系統存在諸多子系統,而這些子系統是分別部署在不同的

登陸cas實現3之cas伺服器配置資料來源

  之前的時候登陸使用者和密碼都是寫死在cas.properties檔案中,可實際上是需要從資料庫查詢,如下  1.新增jar        4.2.7版本我們需要新增的jar只有這兩 cas-server-suppo

登陸cas實現2之tomcat支援https訪問

keystool  參考 https://blog.csdn.net/yjaspire/article/details/82858084 cas伺服器 (1)生成keystore檔案 keytool -genkey -keystore "D:\keyst

CAS登入(4):cas-4.0.0-server 配置mysql資料庫查詢認證

目錄 目錄 概述 環境要求 建立資料庫 Tips 配置cas-server 配置dataSource 配置passwordEnco

nginxshiro-redis解決登陸的問題

引言:當我們使用nginx做叢集,shiro-redis解決session共享的問題的時候,我們是否會遇到其他系統也要經過我們系統登陸才可以使用,這裡我們將介紹nginx和shiro-redis(這裡的配置就不多說了,直接可以檢視上篇文章:解決使用redis進行基於shiro

HttpClientHtmlParser配合實現自動CAS登入系統抽取頁面資訊

httpclient下載地址:http://mirror.bit.edu.cn/apache//httpcomponents/httpclient/binary/httpcomponents-client-4.5.1-bin.zip 專案中引入所有的jar包,然後看下面的