CAS之5.2x版本配置密码加密(MD5和SHA)-yellowcong
来源:互联网 发布:金蝶kis数据库不兼容 编辑:程序博客网 时间:2024/05/21 15:38
在上一篇,俺说到了如何配置CAS如何通过访问数据库进行验证操作,这篇讲解如何通过MD5加密算法验证,和自定义密码的加密策略
修改加密方式
修改application.properties 配置文件
设定MD5加密
默认是不加密
#无加密的策略,默认不加密#cas.authn.jdbc.query[0].passwordEncoder.type=NONE
MD5加密
cas.authn.jdbc.query[0].passwordEncoder.type=DEFAULTcas.authn.jdbc.query[0].passwordEncoder.characterEncoding=UTF-8#MD5加密策略cas.authn.jdbc.query[0].passwordEncoder.encodingAlgorithm=MD5
SHA加密
cas.authn.jdbc.query[0].passwordEncoder.type=DEFAULTcas.authn.jdbc.query[0].passwordEncoder.characterEncoding=UTF-8#SHA加密的策略cas.authn.jdbc.query[0].passwordEncoder.encodingAlgorithm=SHA
完整配置
这个配置里面,我是使用的Mysql配置,如果你也是,注意搭建环境的时候,需要导入的依赖包。
### CAS Server Context Configuration#server.context-path=/casserver.port=8443#添加认证服务cas.serviceRegistry.initFromJson=true#STEP 4签发证书,如果是用spring boot之类嵌入式的容器,则需要改这里的配置,如果是直接部在tomcat中,则需要把tomcat改成https的#server.ssl.key-store=file:/etc/cas/thekeystore#server.ssl.key-store-password=changeit#server.ssl.key-password=changeit# server.ssl.ciphers=# server.ssl.client-auth=# server.ssl.enabled=# server.ssl.key-alias=# server.ssl.key-store-provider=# server.ssl.key-store-type=# server.ssl.protocol=# server.ssl.trust-store=# server.ssl.trust-store-password=# server.ssl.trust-store-provider=# server.ssl.trust-store-type=#server.max-http-header-size=2097152#server.use-forward-headers=true#server.connection-timeout=20000#server.error.include-stacktrace=ALWAYS#server.compression.enabled=true#server.compression.mime-types=application/javascript,application/json,application/xml,text/html,text/xml,text/plain#server.tomcat.max-http-post-size=2097152#server.tomcat.basedir=build/tomcat#server.tomcat.accesslog.enabled=true#server.tomcat.accesslog.pattern=%t %a "%r" %s (%D ms)#server.tomcat.accesslog.suffix=.log#server.tomcat.max-threads=10#server.tomcat.port-header=X-Forwarded-Port#server.tomcat.protocol-header=X-Forwarded-Proto#server.tomcat.protocol-header-https-value=https#server.tomcat.remote-ip-header=X-FORWARDED-FOR#server.tomcat.uri-encoding=UTF-8spring.http.encoding.charset=UTF-8spring.http.encoding.enabled=truespring.http.encoding.force=true### CAS Cloud Bus Configuration#spring.cloud.bus.enabled=false# spring.cloud.bus.refresh.enabled=true# spring.cloud.bus.env.enabled=true# spring.cloud.bus.destination=CasCloudBus# spring.cloud.bus.ack.enabled=trueendpoints.enabled=falseendpoints.sensitive=trueendpoints.restart.enabled=falseendpoints.shutdown.enabled=falsemanagement.security.enabled=truemanagement.security.roles=ACTUATOR,ADMINmanagement.security.sessions=if_requiredmanagement.context-path=/statusmanagement.add-application-context-header=falsesecurity.basic.authorize-mode=rolesecurity.basic.enabled=falsesecurity.basic.path=/cas/status/**### CAS Web Application Session Configuration#server.session.timeout=300server.session.cookie.http-only=trueserver.session.tracking-modes=COOKIE### CAS Thymeleaf View Configuration#spring.thymeleaf.encoding=UTF-8spring.thymeleaf.cache=falsespring.thymeleaf.mode=HTML### CAS Log4j Configuration## logging.config=file:/etc/cas/log4j2.xmlserver.context-parameters.isLog4jAutoInitializationDisabled=true### CAS AspectJ Configuration#spring.aop.auto=truespring.aop.proxy-target-class=true### CAS Authentication Credentials##cas.authn.accept.users=casuser::Mellon#SELECT id, name, value FROM CAS_SETTINGS_TABLE#SELECT username,password,enabled FROM users WHERE username=?cas.authn.jdbc.query[0].sql=SELECT * FROM yellowcong_users WHERE user_name =? #select * from cms_auth_user where user_name=?cas.authn.jdbc.query[0].healthQuery=cas.authn.jdbc.query[0].isolateInternalQueries=falsecas.authn.jdbc.query[0].url=jdbc:mysql://127.0.0.1:3306/yellowcong?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=falsecas.authn.jdbc.query[0].failFast=truecas.authn.jdbc.query[0].isolationLevelName=ISOLATION_READ_COMMITTEDcas.authn.jdbc.query[0].dialect=org.hibernate.dialect.MySQLDialectcas.authn.jdbc.query[0].leakThreshold=10cas.authn.jdbc.query[0].propagationBehaviorName=PROPAGATION_REQUIREDcas.authn.jdbc.query[0].batchSize=1cas.authn.jdbc.query[0].user=root#cas.authn.jdbc.query[0].ddlAuto=create-dropcas.authn.jdbc.query[0].maxAgeDays=180cas.authn.jdbc.query[0].password=rootcas.authn.jdbc.query[0].autocommit=falsecas.authn.jdbc.query[0].driverClass=com.mysql.jdbc.Drivercas.authn.jdbc.query[0].idleTimeout=5000# cas.authn.jdbc.query[0].credentialCriteria=# cas.authn.jdbc.query[0].name=# cas.authn.jdbc.query[0].order=0# cas.authn.jdbc.query[0].dataSourceName=# cas.authn.jdbc.query[0].dataSourceProxy=falsecas.authn.jdbc.query[0].fieldPassword=PASSWORD#多属性cas.authn.attributeRepository.jdbc[0].singleRow=truecas.authn.attributeRepository.jdbc[0].order=0cas.authn.attributeRepository.jdbc[0].url=jdbc:mysql://127.0.0.1:3306/yellowcong?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=falsecas.authn.attributeRepository.jdbc[0].username=user_namecas.authn.attributeRepository.jdbc[0].user=rootcas.authn.attributeRepository.jdbc[0].password=rootcas.authn.attributeRepository.jdbc[0].sql=select * from yellowcong_users where {0}cas.authn.attributeRepository.jdbc[0].dialect=org.hibernate.dialect.MySQLDialectcas.authn.attributeRepository.jdbc[0].ddlAuto=nonecas.authn.attributeRepository.jdbc[0].driverClass=com.mysql.jdbc.Drivercas.authn.attributeRepository.jdbc[0].leakThreshold=10cas.authn.attributeRepository.jdbc[0].propagationBehaviorName=PROPAGATION_REQUIREDcas.authn.attributeRepository.jdbc[0].batchSize=1cas.authn.attributeRepository.jdbc[0].healthQuery=SELECT 1cas.authn.attributeRepository.jdbc[0].failFast=true#默认加密策略,通过encodingAlgorithm来指定算法,默认NONE不加密#无加密的策略,默认不加密#cas.authn.jdbc.query[0].passwordEncoder.type=NONE#采用MD5加密cas.authn.jdbc.query[0].passwordEncoder.type=DEFAULTcas.authn.jdbc.query[0].passwordEncoder.characterEncoding=UTF-8#MD5加密策略cas.authn.jdbc.query[0].passwordEncoder.encodingAlgorithm=MD5#加密操作#cas.authn.jdbc.query[0].passwordEncoder.type=com.example.CustomPasswordEncoder#cas.authn.jdbc.query[0].passwordEncoder.characterEncoding=UTF-8#cas.authn.jdbc.query[0].passwordEncoder.encodingAlgorithm=MD5#cas.authn.jdbc.query[0].passwordEncoder.secret=#cas.authn.jdbc.query[0].passwordEncoder.strength=16
参考文章
http://www.cnblogs.com/flying607/p/7600947.html
http://blog.csdn.net/u010475041/article/category/7156505
阅读全文
0 0
- CAS之5.2x版本配置密码加密(MD5和SHA)-yellowcong
- CAS之5.2x版本自定义密码验证-yellowcong
- CAS之 5.2x版本配置数据库认证-yellowcong
- CAS之5.2x版本单点登录服务安装-yellowcong
- 加密之SHA,MD5
- MD5和SHA加密
- MD5和SHA加密
- Cas之5.2.x版本单点登录自定义REST认证-yellowcong
- 用户密码MD5和SHA加密
- JAVA 常用的加密算法之单向加密MD5和SHA
- md5加密和sha加密的使用
- iOS MD5加密和SHA-1加密
- CAS 之3.x版本,单点登录服务搭建(Window)-yellowcong
- Andriod之SHA-256,MD5加密字符串
- 实现MD5和SHA加密的类
- IOS md5 和 sha哈希加密
- java中MD5和SHA加密
- 使用MD5和SHA算法加密信息
- 反向解析
- 用数据跑路代替群众跑腿 “异地办” 提升幸福感
- 【OpenGL】详解第一个OpenGL程序
- leetcode_409. Longest Palindrome ? 待解决
- 多maven项目重命名
- CAS之5.2x版本配置密码加密(MD5和SHA)-yellowcong
- Python super() 函数
- Can you solve this equation
- “黑科技”餐具,让洗碗变得so easy~ | 钛空舱双十二特惠
- 第50周收录98起融资,国内低靡,国外智能硬件火热 | 潜在周报
- java 发牌洗牌 重新排序
- 这批钛媒体90后已经瞎了、秃了、腰椎间盘突出了
- 深入浅出ES6(七):箭头函数 Arrow Functions
- C6748_EMIF时钟配置