1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
| #mysql认证 1.先修改tomcat7/webapps/cas/WEB-INF/deployerConfigContext.xml 配置文件 将<alias name="acceptUsersAuthenticationHandler" alias="primaryAuthenticationHandler" /> 注释 再添加: ------------------------------------------------------------ <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" p:driverClass="${database.driverClass}" p:jdbcUrl="${database.url}" p:user="${database.user}" p:password="${database.password}" p:initialPoolSize="${database.pool.minSize}" p:minPoolSize="${database.pool.minSize}" p:maxPoolSize="${database.pool.maxSize}" p:maxIdleTimeExcessConnections="${database.pool.maxIdleTime}" p:checkoutTimeout="${database.pool.maxWait}" p:acquireIncrement="${database.pool.acquireIncrement}" p:acquireRetryAttempts="${database.pool.acquireRetryAttempts}" p:acquireRetryDelay="${database.pool.acquireRetryDelay}" p:idleConnectionTestPeriod="${database.pool.idleConnectionTestPeriod}" p:preferredTestQuery="${database.pool.connectionHealthQuery}" />
<alias name="defaultPasswordEncoder" alias="passwordEncoder" /> <alias name="queryDatabaseAuthenticationHandler" alias="primaryAuthenticationHandler" /> <alias name="dataSource" alias="queryDatabaseDataSource" /> ------------------------------------------------------------ 2.在cas.properties文件中定义数据源值 ------------------------------------------------------------ cas.authn.password.encoding.char=UTF-8 #配置密码编码 cas.authn.password.encoding.alg=MD5 #配置密码MD5加密(只会加密为小写) #cas.authn.password.encoding.alg=SHA-256 #配置密码SHA-256加密 cas.jdbc.authn.query.sql=select pwd from cas_test where user=? #查询密码字段即可 locale.default=zh_CN #指定首页语言 # == Basic database connection pool configuration == #c3p0连接池数据源配置 database.driverClass=com.mysql.jdbc.Driver database.url=jdbc:mysql://10.151.0.208:3306/multiple-srm-mobile-dev?useUnicode=true&characterEncoding=utf8&useSSL=true database.user=root database.password=handhand database.pool.minSize=6 database.pool.maxSize=18 # Maximum amount of time to wait in ms for a connection to become # available when the pool is exhausted database.pool.maxWait=10000 # Amount of time in seconds after which idle connections # in excess of minimum size are pruned. database.pool.maxIdleTime=120 # Number of connections to obtain on pool exhaustion condition. # The maximum pool size is always respected when acquiring # new connections. database.pool.acquireIncrement=6 # == Connection testing settings == # Period in s at which a health query will be issued on idle # connections to determine connection liveliness. database.pool.idleConnectionTestPeriod=30 # Query executed periodically to test health database.pool.connectionHealthQuery=select 1 from dual # == Database recovery settings == # Number of times to retry acquiring a _new_ connection # when an error is encountered during acquisition. database.pool.acquireRetryAttempts=5 # Amount of time in ms to wait between successive aquire retry attempts. database.pool.acquireRetryDelay=2000 ------------------------------------------------------------
|