zoukankan      html  css  js  c++  java
  • cas源码心得

    /*配置文件内容:
    #设置jdbc认证
    cas.authn.jdbc.query[0].url=jdbc:mysql://127.0.0.1:3306/springdemo?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false&serverTimezone=GMT%2B8
    cas.authn.jdbc.query[0].user=root
    cas.authn.jdbc.query[0].password=****
    cas.authn.jdbc.query[0].driverClass=com.mysql.jdbc.Driver
    cas.authn.jdbc.query[0].sql=select * from user where name=?
    cas.authn.jdbc.query[0].fieldPassword=password

    *其中fieldPassword是指数据库中用户表的密码字段
    *
    */
    public
    class QueryDatabaseAuthenticationHandler extends AbstractJdbcUsernamePasswordAuthenticationHandler {//这个是cas默认的jdbc验证方式 private final String sql;//这个是获取配置文件中的sql命令 private final String fieldPassword; private final String fieldExpired; private final String fieldDisabled; private final Map<String, Object> principalAttributeMap; public QueryDatabaseAuthenticationHandler(final String name, final ServicesManager servicesManager, final PrincipalFactory principalFactory, final Integer order, final DataSource dataSource, final String sql, final String fieldPassword, final String fieldExpired, final String fieldDisabled, final Map<String, Object> attributes) { super(name, servicesManager, principalFactory, order, dataSource); this.sql = sql; this.fieldPassword = fieldPassword; this.fieldExpired = fieldExpired; this.fieldDisabled = fieldDisabled; this.principalAttributeMap = attributes; if (StringUtils.isBlank(this.fieldPassword)) { LOGGER.warn("When the password field is left undefined, CAS will skip comparing database and user passwords for equality " + ", (specially if the query results do not contain the password field)," + "and will instead only rely on a successful query execution with returned results in order to verify credentials"); } }

    如何修改cas 的jdbc验证方式,做更多自定义的操作?

  • 相关阅读:
    Python协程
    Python3常用标准库
    温故而知新--day3
    温故而知新--day2
    解决 WPF 绑定集合后数据变动界面却不更新的问题
    WPF 消息框 TextBox 绑定新数据时让光标和滚动条跳到最下面
    C# 枚举转列表
    真・WPF 按钮拖动和调整大小
    使用 GB28181.Solution + ZLMediaKit + MediaServerUI 进行摄像头推流和播放
    将 .NET Framework 项目转换为 .NET Standard 项目
  • 原文地址:https://www.cnblogs.com/ljangle/p/10268224.html
Copyright © 2011-2022 走看看