bl双性强迫侵犯h_国产在线观看人成激情视频_蜜芽188_被诱拐的少孩全彩啪啪漫画

CAS4.0連接mysql數據庫的詳細步驟-創新互聯

本文主要給大家介紹CAS4.0連接mysql數據庫的詳細步驟,文章內容都是筆者用心摘選和編輯的,具有一定的針對性,對大家的參考意義還是比較大的,下面跟筆者一起了解下CAS4.0連接mysql數據庫的詳細步驟吧。

為曲沃等地區用戶提供了全套網頁設計制作服務,及曲沃網站建設行業解決方案。主營業務為成都網站建設、網站制作、曲沃網站設計,以傳統方式定制建設網站,并提供域名空間備案等一條龍服務,秉承以專業、用心的態度為用戶提供真誠的服務。我們深信只要達到每一位用戶的要求,就會得到認可,從而選擇與我們長期合作。這樣,我們也可以走得更遠!

步驟如下

一:

在cas-4.0.0\cas-server-webapp\pom.xml中添加依賴后(如下方所示),打開cmd在cas-4.0.0\cas-server-webapp文件夾下運行mvn clean package,然后將cas-4.0.0\cas-server-webapp\target下的cas.war包部署至tomcat

Xml代碼  CAS4.0連接mysql數據庫的詳細步驟

  1. <dependency>

  2.     <groupId>org.jasig.cas</groupId>

  3.     <artifactId>cas-server-support-jdbc</artifactId>

  4.     <version>${project.version}</version>

  5.     <type>jar</type>

  6. </dependency>

  7. <!-- https://mvnrepository.com/artifact/commons-dbcp/commons-dbcp -->

  8. <dependency>

  9.     <groupId>commons-dbcp</groupId>

  10.     <artifactId>commons-dbcp</artifactId>

  11.     <version>1.4</version>

  12. </dependency>

  13. <!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->

  14. <dependency>

  15.     <groupId>mysql</groupId>

  16.     <artifactId>mysql-connector-java</artifactId>

  17.     <version>5.1.6</version>

  18. </dependency>

 CAS4.0連接mysql數據庫的詳細步驟

二:

本地創建數據庫,并新建表 cas_user,創建語句如下載

Sql代碼  CAS4.0連接mysql數據庫的詳細步驟

  1. create table cas_user (

  2.     id bigint not null auto_increment,

  3.     email varchar(255),

  4.     username varchar(255) not null unique,

  5.     name varchar(255),

  6.     password varchar(255),

  7.     primary key (id)

  8. ) ENGINE=InnoDB;

三:

配置數據庫相關文件,在tomcat-for-cas\webapps\cas\WEB-INF\deployerConfigContext.xml中配置對應的datasource,數據庫地址,用戶名,密碼,以及查詢用戶的sql。需要注意的是,如果是自己建的表,要把相應的字段名,數據庫名替換掉,以及,不要忘記注釋掉默認用戶名密碼的配置(casuser/Mellon)。下載以下配置可以全拷貝

Xml代碼  CAS4.0連接mysql數據庫的詳細步驟

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

  2. <!--

  3.     Licensed to Jasig under one or more contributor license

  4.     agreements. See the NOTICE file distributed with this work

  5.     for additional information regarding copyright ownership.

  6.     Jasig licenses this file to you under the Apache License,

  7.     Version 2.0 (the "License"); you may not use this file

  8.     except in compliance with the License.  You may obtain a

  9.     copy of the License at the following location:

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

  11.     Unless required by applicable law or agreed to in writing,

  12.     software distributed under the License is distributed on an

  13.     "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY

  14.     KIND, either express or implied.  See the License for the

  15.     specific language governing permissions and limitations

  16.     under the License.

  17. -->

  18. <!--

  19. | deployerConfigContext.xml centralizes into one file some of the declarative configuration that

  20. | all CAS deployers will need to modify.

  21. |

  22. | This file declares some of the Spring-managed JavaBeans that make up a CAS deployment.

  23. | The beans declared in this file are instantiated at context initialization time by the Spring

  24. | ContextLoaderListener declared in web.xml.  It finds this file because this

  25. | file is among those declared in the context parameter "contextConfigLocation".

  26. |

  27. | By far the most common change you will need to make in this file is to change the last bean

  28. | declaration to replace the default authentication handler with

  29. | one implementing your approach for authenticating usernames and passwords.

  30. +-->

  31. <beans xmlns="http://www.springframework.org/schema/beans"

  32.        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

  33.        xmlns:p="http://www.springframework.org/schema/p"

  34.        xmlns:c="http://www.springframework.org/schema/c"

  35.        xmlns:tx="http://www.springframework.org/schema/tx"

  36.        xmlns:util="http://www.springframework.org/schema/util"

  37.        xmlns:sec="http://www.springframework.org/schema/security"

  38.        xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd

  39.        http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.2.xsd

  40.        http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.2.xsd

  41.        http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd">

  42.     <!--

  43.        | The authentication manager defines security policy for authentication by specifying at a minimum

  44.        | the authentication handlers that will be used to authenticate credential. While the AuthenticationManager

  45.        | interface supports plugging in another implementation, the default PolicyBasedAuthenticationManager should

  46.        | be sufficient in most cases.

  47.        +-->  下載

  48.     <bean id="authenticationManager" class="org.jasig.cas.authentication.PolicyBasedAuthenticationManager">

  49.         <constructor-arg>

  50.             <map>

  51.                 <!--

  52.                    | IMPORTANT

  53.                    | Every handler requires a unique name.

  54.                    | If more than one instance of the same handler class is configured, you must explicitly

  55.                    | set its name to something other than its default name (typically the simple class name).

  56.                    -->

  57.                     <entry key-ref="proxyAuthenticationHandler" value-ref="proxyPrincipalResolver" />

  58.                  <entry key-ref="primaryAuthenticationHandler" value-ref="primaryPrincipalResolver" />

  59.             </map>

  60.         </constructor-arg>

  61.         <!-- Uncomment the metadata populator to allow clearpass to capture and cache the password

  62.              This switch effectively will turn on clearpass.

  63.         <property name="authenticationMetaDataPopulators">

  64.            <util:list>

  65.               <bean class="org.jasig.cas.extension.clearpass.CacheCredentialsMetaDataPopulator"

  66.                     c:credentialCache-ref="encryptedMap" />

  67.            </util:list>

  68.         </property>

  69.         -->

  70.         <!--

  71.            | Defines the security policy around authentication. Some alternative policies that ship with CAS:

  72.            |

  73.            | * NotPreventedAuthenticationPolicy - all credential must either pass or fail authentication

  74.            | * AllAuthenticationPolicy - all presented credential must be authenticated successfully

  75.            | * RequiredHandlerAuthenticationPolicy - specifies a handler that must authenticate its credential to pass

  76.            -->

  77.         <property name="authenticationPolicy">

  78.             <bean class="org.jasig.cas.authentication.AnyAuthenticationPolicy" />

  79.         </property>

  80.     </bean>

  81.     <!-- Required for proxy ticket mechanism. -->

  82.     <bean id="proxyAuthenticationHandler"

  83.           class="org.jasig.cas.authentication.handler.support.HttpBasedServiceCredentialsAuthenticationHandler"

  84.           p:httpClient-ref="httpClient" p:requireSecure="true" />

  85.     <!--

  86.        | TODO: Replace this component with one suitable for your enviroment.

  87.        |

  88.        | This component provides authentication for the kind of credential used in your environment. In most cases

  89.        | credential is a username/password pair that lives in a system of record like an LDAP directory.

  90.        | The most common authentication handler beans:

  91.        |  下載

  92.        | * org.jasig.cas.authentication.LdapAuthenticationHandler

  93.        | * org.jasig.cas.adaptors.jdbc.QueryDatabaseAuthenticationHandler

  94.        | * org.jasig.cas.adaptors.x509.authentication.handler.support.X509CredentialsAuthenticationHandler

  95.        | * org.jasig.cas.support.spnego.authentication.handler.support.JCIFSSpnegoAuthenticationHandler

  96.        -->

  97.     <bean id="primaryAuthenticationHandler"

  98.           class="org.jasig.cas.adaptors.jdbc.QueryDatabaseAuthenticationHandler">

  99.           <property name="dataSource" ref="dataSource"/>

  100.           <property name="sql" value="select password from cas_user where username = ?"/>

  101.     </bean>

  102.     <!-- Required for proxy ticket mechanism -->

  103.     <bean id="proxyPrincipalResolver"

  104.           class="org.jasig.cas.authentication.principal.BasicPrincipalResolver" />

  105.     <!--

  106.        | Resolves a principal from a credential using an attribute repository that is configured to resolve

  107.        | against a deployer-specific store (e.g. LDAP).

  108.        -->

  109.     <bean id="primaryPrincipalResolver"

  110.           class="org.jasig.cas.authentication.principal.PersonDirectoryPrincipalResolver" >

  111.         <property name="attributeRepository" ref="selfAttributeRepository" />

  112.     </bean>

  113.     <!--

  114.     Bean that defines the attributes that a service may return.  This example uses the Stub/Mock version.  A real implementation

  115.     may go against a database or LDAP server.  The id should remain "attributeRepository" though.

  116.     +-->

  117.     <bean id="attributeRepository" class="org.jasig.services.persondir.support.StubPersonAttributeDao"

  118.             p:backingMap-ref="attrRepoBackingMap" />

  119.     <util:map id="attrRepoBackingMap">

  120.         <entry key="uid" value="uid" />

  121.         <entry key="eduPersonAffiliation" value="eduPersonAffiliation" />

  122.         <entry key="groupMembership" value="groupMembership" />

  123.     </util:map>

  124.     <!--

  125.     Sample, in-memory data store for the ServiceRegistry. A real implementation

  126.     would probably want to replace this with the JPA-backed ServiceRegistry DAO

  127.     The name of this bean should remain "serviceRegistryDao".

  128.     +-->

  129.     <bean id="serviceRegistryDao" class="org.jasig.cas.services.InMemoryServiceRegistryDaoImpl"

  130.             p:registeredServices-ref="registeredServicesList" />

  131.     <util:list id="registeredServicesList">

  132.         <bean class="org.jasig.cas.services.RegexRegisteredService"

  133.               p:id="0" p:name="HTTP and IMAP" p:description="Allows HTTP(S) and IMAP(S) protocols"

  134.               p:serviceId="^(https?|imaps?)://.*" p:evaluationOrder="10000001" />

  135.         <!--

  136.         Use the following definition instead of the above to further restrict access

  137.         to services within your domain (including sub domains).

  138.         Note that example.com must be replaced with the domain you wish to permit.

  139.         This example also demonstrates the configuration of an attribute filter

  140.         that only allows for attributes whose length is 3.

  141.         -->

  142.         <!--

  143.         <bean class="org.jasig.cas.services.RegexRegisteredService">

  144.             <property name="id" value="1" />

  145.             <property name="name" value="HTTP and IMAP on example.com" />

  146.             <property name="description" value="Allows HTTP(S) and IMAP(S) protocols on example.com" />

  147.             <property name="serviceId" value="^(https?|imaps?)://([A-Za-z0-9_-]+\.)*example\.com/.*" />

  148.             <property name="evaluationOrder" value="0" />

  149.             <property name="attributeFilter">

  150.               <bean class="org.jasig.cas.services.support.RegisteredServiceRegexAttributeFilter" c:regex="^\w{3}$" />

  151.             </property>

  152.         </bean>

  153.         -->

  154.     </util:list>

  155.     <bean id="auditTrailManager" class="com.github.inspektr.audit.support.Slf4jLoggingAuditTrailManager" />

  156.     <bean id="healthCheckMonitor" class="org.jasig.cas.monitor.HealthCheckMonitor" p:monitors-ref="monitorsList" />

  157.     下載

  158.     <util:list id="monitorsList">

  159.       <bean class="org.jasig.cas.monitor.MemoryMonitor" p:freeMemoryWarnThreshold="10" />

  160.       <!--

  161.         NOTE

  162.         The following ticket registries support SessionMonitor:

  163.           * DefaultTicketRegistry

  164.           * JpaTicketRegistry

  165.         Remove this monitor if you use an unsupported registry.

  166.       -->

  167.       <bean class="org.jasig.cas.monitor.SessionMonitor"

  168.           p:ticketRegistry-ref="ticketRegistry"

  169.           p:serviceTicketCountWarnThreshold="5000"

  170.           p:sessionCountWarnThreshold="100000" />

  171.     </util:list>

  172.     <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">

  173.                    <property name="driverClassName">

  174.                            <value>com.mysql.jdbc.Driver</value>

  175.                    </property>

  176.                    <property name="url">

  177.                             <value>jdbc:mysql://localhost:3306/test</value>

  178.                    </property>

  179.                    <property name="username">

  180.                             <value>root</value>

  181.                    </property>

  182.                    <property name="password">

  183.                             <value>123456</value>

  184.                    </property>

  185.     </bean>

  186.     <bean id="selfAttributeRepository"

  187.   class="org.jasig.services.persondir.support.jdbc.SingleRowJdbcPersonAttributeDao">

  188.   <constructor-arg index="0" ref="dataSource" />

  189.   <constructor-arg index="1"

  190.    value="select username,password from cas_user where {0}" />

  191.   <!-- 組裝sql用的查詢條件屬性 -->

  192.   <property name="queryAttributeMapping">

  193.    <map>

  194.        <!-- key必須是uername而且是小寫否則會導致取不到用戶的其它信息,value對應數據庫用戶名字段,系統會自己匹配 -->

  195.     <entry key="username" value="username" />

  196.     <entry key="password" value="password" />

  197.    </map>

  198.   </property>

  199.   <property name="resultAttributeMapping">

  200.    <map>

  201.        <!-- key為對應的數據庫字段名稱,value為提供給客戶端獲取的屬性名字,系統會自動填充值 -->

  202.     <entry key="username" value="username"></entry>

  203.     <entry key="password" value="password"></entry>

  204.    </map>

  205.   </property>

  206.  </bean>

  207. </beans>

看完以上關于CAS4.0連接mysql數據庫的詳細步驟,很多讀者朋友肯定多少有一定的了解,如需獲取更多的行業知識信息 ,可以持續關注我們的行業資訊欄目的。

另外有需要云服務器可以了解下創新互聯cdcxhl.cn,海內外云服務器15元起步,三天無理由+7*72小時售后在線,公司持有idc許可證,提供“云服務器、裸金屬服務器、高防服務器、香港服務器、美國服務器、虛擬主機、免備案服務器”等云主機租用服務以及企業上云的綜合解決方案,具有“安全穩定、簡單易用、服務可用性高、性價比高”等特點與優勢,專為企業上云打造定制,能夠滿足用戶豐富、多元化的應用場景需求。

當前題目:CAS4.0連接mysql數據庫的詳細步驟-創新互聯
本文鏈接:http://vcdvsql.cn/article46/pjpeg.html

成都網站建設公司_創新互聯,為您提供Google響應式網站軟件開發定制網站移動網站建設外貿建站

廣告

聲明:本網站發布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網站立場,如需處理請聯系客服。電話:028-86922220;郵箱:631063699@qq.com。內容未經允許不得轉載,或轉載時需注明來源: 創新互聯

成都網頁設計公司