CAS4.0配置Mysql数据库,认证失败

2023-05-16

##CAS4.0配置Mysql数据库,认证失败
真崩溃啊,看别人的视频都能成功,自己研究一下午了,也还是不行。问题出在哪儿呢?请大神指教。
在这里插入图片描述
截图,在代码片里有

在这里插入图片描述
在这里插入图片描述

三个jar包:

在这里插入图片描述
代码片.

<?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 authentication handler 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: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.
       +-->
	   <!-- 认证管理器authenticationManager-->
    <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" />
				 -->
				<!--这个被我注释掉了,20200703,目的是指定自己的本地数据库进行访问,
                <entry key-ref="primaryAuthenticationHandler" value-ref="primaryPrincipalResolver" />
				-->
				<!--这个没调试好,只要打开网页就访问不到!!!!!!!!!!!! (因为dbAuthHandler里写的东西有问题,改了就好了)
					第一个操作点!!!:key-ref指定自己的本地数据库访问,配置如下-->
				<entry key-ref="dbAuthHandler" 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>
        -->

        <!--
           | Defines the security policy around authentication. Some alternative policies that ship with CAS:
           |
           | * NotPreventedAuthenticationPolicy - all credential must either pass or fail authentication
           | * AllAuthenticationPolicy - all presented credential must be authenticated successfully
           | * RequiredHandlerAuthenticationPolicy - specifies a handler that must authenticate its credential to pass
           -->
        <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" />

    <!--
       | TODO: Replace this component with one suitable for your enviroment.
       |
       | This component provides authentication for the kind of credential used in your environment. In most cases
       | credential is a username/password pair that lives in a system of record like an LDAP directory.
       | The most common authentication handler beans:
       |
       | * org.jasig.cas.authentication.LdapAuthenticationHandler
       | * org.jasig.cas.adaptors.jdbc.QueryDatabaseAuthenticationHandler
       | * org.jasig.cas.adaptors.x509.authentication.handler.support.X509CredentialsAuthenticationHandler
       | * org.jasig.cas.support.spnego.authentication.handler.support.JCIFSSpnegoAuthenticationHandler
       -->
	   <!-- 下边这个配置是默认静态配置用户名和密码,那就在浏览器的CAS服务的登陆框中输入用户名casuser和密码Mellon,登录看看效果,就会出现验证成功的页面,如下图。你也可以在文件中自己配置自己的用户名和密码。
	   -->
	   
  <!--第二个操作点!!!:将默认的用户名和密码注释,其实上边的此种登陆方式已经被注释掉了,这里留着也没影响-->
    <bean id="primaryAuthenticationHandler"
          class="org.jasig.cas.authentication.AcceptUsersAuthenticationHandler">
        <property name="users">
            <map>
                <entry key="casuser" value="Mellon"/>
				<entry key="admin" value="admin"/>
            </map>
        </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>

	<!-- 再在这个xml中新加入2个bean配置, 第三个操作点!!!:1、指定c3p0数据源(连接池);
注意,改了一下user,改成了username就会报404,所以必须是user	-->
	<bean id="dataSource" 
		class="com.mchange.v2.c3p0.ComboPooledDataSource"
		p:driverClass="com.mysql.jdbc.Driver"
		p:jdbcUrl="jdbc:mysql://127.0.0.1:3306/myproject?characterEncoding=uft8"
		p:user="root"
		p:password="123123" />
		
	<!-- 第四个操作点!!!:2、查询匹配的字段。-->	
	<bean id="dbAuthHandler"
		  class="org.jasig.cas.adaptors.jdbc.QueryDatabaseAuthenticationHandler"
		  p:dataSource-ref="dataSource"
		  p:sql="SELECT password FROM sec_user WHERE username = ?" />
    	
		
</beans>

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

CAS4.0配置Mysql数据库,认证失败 的相关文章

  • MySQL 创建和更新时的 CURRENT_TIMESTAMP

    我想定义一个有 2 个 TIMESTAMP 字段的表 如下所示 CREATE TABLE msgs id INT PRIMARY KEY AUTO INCREMENT msg VARCHAR 256 ts create TIMESTAMP
  • 语言翻译语法

    我正在尝试为我的项目添加另一种语言 我们知道语言可以表现出主语和谓语的差异 例如 英语 Mustafa和他的朋友去看电影ahmet today 土耳其 Mustafa布昆 阿卡达西ahmetile birlikte sinemaya git
  • SQL:比较不同表中的两个计数

    我有 3 张桌子 一张桌子上有世界上每个国家及其代币 NAME CODE Afghanistan AFG Albania AL Algeria DZ American Samoa AMSA Andorra AND Angola ANG An
  • 不唯一的表/别名

    因此 我尝试使用多个联接来运行此查询 以获得我想要的精确行 但我不断收到此错误 不唯一的表 别名 ss prices 我正在运行的查询 select ss accounts id ss accounts bot acc id ss acco
  • 使用 pip3 安装 mysqlclient 时遇到问题

    我正在尝试使用 Django 设置 python 3 6 环境 安装说明说我应该安装 mysqlclient 才能连接到 mySQL 我明白了 dennis django sudo H pip3 install mysqlclient Co
  • PDO::commit 之后使用 PDOStatement::rowCount 结果?

    在 MySQL 文档中 有一个关于使用的注释mysql affected rows事务提交后 http php net manual en function mysql affected rows php http php net manu
  • MySQL:你能指定一个随机限制吗?

    有没有办法在 SQL MySQL 中随机化限制数字 我希望能够做的是在查询中获取随机数量的结果以在插入子查询中使用 而无需任何服务器端脚本 我希望能够作为假设说明运行的查询是 SELECT id FROM users ORDER BY RA
  • 使用 EXPLAIN 进行 MYSQL 存储过程调用

    如何分析和使用 EXPLAIN 来调用我的存储过程 我需要优化查询时间 但是似乎没有地方可以执行 EXPLAIN 调用 proc name 你可以试试 set profiling 1 call proc name show profiles
  • 如何在 Laravel 中编写联合查询?

    我正在使用 laravel 5 0 并且我有 mysql 查询 SELECT surat masuk id surat surat masuk nomor surat FROM surat masuk WHERE EXISTS SELECT
  • 使用 mysql2 gem 获取最后插入的 id

    我有这样的代码 require mysql2 db query insert into clients Name values client 我可以通过 1 个查询返回最后插入的 ID 吗 您可以使用last id客户端实例的方法 clie
  • 显示过去 7 天 PHP 的结果

    我想做的是显示过去 30 天的文章 但我现有的代码不断给我一个 mysql fetch assoc 错误 然后追溯到我的查询 这是代码 sql mysql query SELECT FROM table WHERE DATE datetim
  • 自动将所有mysql表转储到单独的文件中?

    我想将每个 mysql 表转储到单独的文件中 手册指出其语法是 mysqldump options db name tbl name 这表明您事先知道表名称 我现在可以设置知道每个表名称的脚本 但是假设我在路上添加了一个新表并且忘记更新转储
  • MySQL 中的断言

    我有一个针对大型数据库运行的 SQL 脚本 我想在开始时提出几个简单的查询 作为健全性检查 有没有办法在MySQL中写断言 或者任何类型的 选择 如果它与该值不匹配 则中止整个脚本 一些疯狂的代码 要点是 SET可能会引发 mysql 变量
  • 在mysql中搜索“SanF”时获取旧金山的记录

    当我搜索 SanF 时获得 San Francisco 记录 SELECT FROM table WHERE col LIKE san Works SELECT FROM table WHERE col LIKE san F Works S
  • 在 MySQL 中将行转置为列

    如何在 MySQL 查询中将行转换为列 您可以将行变成a列与GROUP CONCAT 但您无法以任何自动方式转置整个结果集 您可以编写手动生成每一列的查询 也可以在应用程序中执行此操作 以下是有关编写复杂查询来模拟转置的教程 http ww
  • Sql:计算随时间的增长

    我几周前发布了这个问题 但我认为我没有清楚地提出这个问题 因为我得到的答案不是我想要的 我认为最好重新开始 我正在尝试查询数据库以检索一段时间内唯一条目的数量 数据看起来像这样 Day UserID 1 A 1 B 2 B 3 A 4 B
  • 使用MySQL计算单个表中借方和贷方的余额

    下面的 MySQL 表包含带有关联金额的借方或贷方 操作 如何选择具有非零 余额 的所有 CLIENT ID 我尝试将表连接到自身以计算所有借方和贷方总额 但有些东西无法正常工作 CLIENT ID ACTION TYPE ACTION A
  • PHP 的 PDO 可以限制为单个查询吗?

    PHP 的 PDO 允许通过 query 方法或作为准备好的语句同时执行多个查询 以下两个示例均有效 Two SQL queries query SELECT FROM table DROP table Execute via query
  • PHP/MySQL:如何在网站中创建评论部分[关闭]

    很难说出这里问的是什么 这个问题是含糊的 模糊的 不完整的 过于宽泛的或修辞性的 无法以目前的形式得到合理的回答 如需帮助澄清此问题以便重新打开 访问帮助中心 help reopen questions 我不会问 如何使用 PHP MySQ
  • 如何在Sequelize中从主模型同一级别的包含模型返回结果?

    这是我在项目中完成的代码和结果 我想获得包含模型的结果与主模型相同的结果 下面的代码是我所做的 序列化查询 User findAll include model Position attributes POSITION NAME then

随机推荐

  • 在sql语句中,like所有的用法

    在sql结构化查询语言中 xff0c like语句有着至关重要的作用 like语句的语法格式是 xff1a select from 表名 where 字段名 like 对应值 xff08 子串 xff09 xff0c 它主要是针对字符型字段
  • 解决当使用element table fix column 固定列时,滚动条在固定列下方无法滚动

    解决当使用element table fix column 固定列时 xff0c 滚动条在固定列下方无法滚动 在全局css中添加这行代码 xff0c 提高滚动条在z轴的坐标 建议使用下面的代码 xff0c 使用参考文章里面的代码会导致 右f
  • 使用funcraft管理阿里云函数计算

    Fun 是一个用于支持Serverless应用部署的工具 xff0c 能帮助您便捷地管理函数计算 API 网关和日志服务等资源 它通过一个资源配置文件 xff08 template yml xff09 xff0c 协助您进行开发 构建和部署
  • 阿里云 ServerLess:Todo list 应用安装

    安装Node js环境 执行如下命令 xff0c 下载Node js安装包 xff1a wget https npm taobao org mirrors node v12 4 0 node v12 4 0 linux x64 tar xz
  • Maven中pom.xml的scope

    一 compile xff1a 编译范围 compile是默认的范围 xff1b 如果没有提供一个范围 xff0c 编译范围依赖在所有的classpath 中可用 xff0c 同时它们也会被打包 而且这些dependency会传递到依赖的项
  • 如何通过CSS绘制三角形和小箭头

    1 绘制三角形的作用 xff0c 主要是提供指示性 xff0c 如下图 2 那么如何画出三角形呢 xff1f 我们先看下border的用法 lt div class 61 34 box 34 gt lt div gt box box siz
  • 利用python pil 实现给图片上添加文字

    最近的一个工程项目是讲文字添加到图像上 使用了opencv xff0c 结果发现利用opencv给图像添加文字有局限 xff08 1 xff09 可利用的字体类型比较少 xff0c 需要安装Freetype扩展 xff0c 比较复杂 xff
  • esp8266 error: espcomm_open failed

    gpi0 没有接地 xff0c 接上地就可以了注意和usb分出的gnd接口接的是同一个地
  • 微信小程序quickstart项目中有关userInfoReadyCallback的解释

    userInfoReadyCallback 在index js中定义 xff0c 在app js中使用 附app js代码 xff1a app js App onLaunch function 展示本地存储能力 var logs 61 wx
  • 微信小程序引入模块中wxml、wxss、js

    先描述下目录结构 xff0c 见下图 UI页面见下图 其中ok按键是引入的log模块 xff0c log模块非page页 indexButton是index页本身拥有的组件 xff0c index页直接导入Log模块中的组件 xff0c c
  • PHP解析错误 PHP Parse error: syntax error, unexpected '[' in

    之前做了一次php后台代码在不同服务器的迁移 xff0c 代码迁移到新服务器上 xff0c 代码运行不了 xff0c 返回500内部错误 500 内部错误 xff0c 就查看服务器上 var log php fpm www error lo
  • 微信小程序使用video组件时的一些坑

    xff08 1 xff09 mp4视频用video组件播放会卡顿 绿屏 尤其是在快进 拖动时间条时 在video组件上 xff0c 试试加个custom cache 61 false 属性 xff0c 可以完美解决卡顿 绿屏的现象 xff0
  • java中JFrame中函数removeAll的用法

    解答链接 用baidu搜了半天搜不出来 xff0c 用google一下就出来了 下面用自己的代码来解释下removeAll xff08 xff09 的用法 注意一定要在getContentPane xff08 xff09 中用removeA
  • C#基础教程(十三)消息队列——MSMQ

    Net使用消息队列 xff0c 借助windows组件来存储要完成的一系列任务 xff0c 不用程序使用同一个队列 xff0c 方便不同程序之间的数据共享和协作 队列分事务性队列和非事务性队列 xff0c 默认创建的是非事务性队列 那么什么
  • 创建vue项目时报错Failed to download,解决办法

    当我们想要通过vue脚手架 xff0c 创建一个vue项目时 xff0c 正常的步骤是 xff0c 通过执行下面命令 xff1a vue init webpack 项目名 然后根据自己的实际情况 xff0c 选择需要安装哪些东西 xff0c
  • Linux下生产者与消费者实现的问题详解

    生产者与消费者问题 什么是生产者消费者问题 xff1f 背景问题的核心解决思路 单生产者和单消费者同步信号的使用伪代码 xff08 逻辑 xff09 解释上述伪代码 多生产者和多消费者与单生产者和单消费者的区别理解多生产者和多消费者解决方法
  • 参加中国移动开发者大会有感

    作为我校CSDN俱乐部的主席 xff0c 我很荣幸受到CSDN的邀请参加中国移动开发者大会 xff0c 下面写点自己的感悟 xff1a 移动互联网应用大时代已经到来 xff0c 所有的IT应用都将移动化 xff0c 所有的信息服务都将移动化
  • ESXI 安装并部署主机

    一 ESXI的相关知识 ESXI是VMware的企业虚拟化产品 xff0c 可视为虚拟化的平台基础 xff0c 部署于实体服务器 不同于VMware Workstation VMware Server xff0c ESXI采用的是 xff0
  • html中的简单实例演示(checkbox)的使用

    演示一个小小的例子 xff1a 在购物车里面 xff0c 我们能够勾选自己所选的商品 xff0c 然后能够显示出相应的价格 1 xff0c 首先显示出相应的界面 xff1a 相关 代码 xff1a lt body gt 商品列表 xff1a
  • CAS4.0配置Mysql数据库,认证失败

    CAS4 0配置Mysql数据库 xff0c 认证失败 真崩溃啊 xff0c 看别人的视频都能成功 xff0c 自己研究一下午了 xff0c 也还是不行 问题出在哪儿呢 xff1f 请大神指教 三个jar包 xff1a 代码片 span c