项目作者: zhongchengxcr

项目描述 :
security
高级语言: Java
项目地址: git://github.com/zhongchengxcr/security.git
创建时间: 2017-09-20T11:39:16Z
项目社区:https://github.com/zhongchengxcr/security

开源协议:

下载


Security

security 安全校验SDK


Security是一个web安全校验SDK,配置简单、功能完善、开箱即用!security使用SpringBoot、SpringSecurity、SpringSocial编写,
能与springboot的web项目完美兼容。

欢迎fork、试用。目前还处于开发阶段,括号内有 “complete” 的已经完成开发完成(没有在正式环境跑过)。
Security的所提供所有功能,只需要进行简单的配置即可在自己的工程中使用,Security也提供了丰富接口供使用者定义个性化的业务逻辑。

  • 表单登录(complete)
  • 短信验证码登录(complete)
  • 图形验证码校验(complete)
  • 短信验证码校验(complete)
  • 注册(complete)
  • 微信登录(浏览器)(complete)
  • 微信登录(app)(complete)
  • qq登录(浏览器)(complete)
  • qq登录(app)(complete)
  • 集群Session管理(complete)
  • 单点登录、登出(complete)
  • 权限的管理与控制(plan)

安装

  1. git clone git@github.com:meolu/zhongchengxcr/security.git
  2. cd security
  3. mvn clean compile -e -U install

在自己的工程的pom.xml中添加

  1. <!-- 浏览器部分相关 -->
  2. <dependency>
  3. <groupId>com.zc.security</groupId>
  4. <artifactId>ecurity-browser</artifactId>
  5. <version>${zc.security.version}</version>
  6. </dependency>
  7. <!-- JWT部分 -->
  8. <dependency>
  9. <groupId>com.zc.security</groupId>
  10. <artifactId>ecurity-browser</artifactId>
  11. <version>${zc.security.version}</version>
  12. </dependency>

安装

在springboot项目的application.yml 或 application.properties 中添加配置启用功能

  1. #登录页面url
  2. zc.security.browser.loginPage=/src/login_t.html
  3. #登录完成是跳转页面还是返回JSON
  4. zc.security.browser.loginType=JSON
  5. #需要校验图片验证码的url,支持通配, 以","分割
  6. zc.security.code.image.url=/user/1,/user/*
  7. #需要校验短信验证码的url,支持通配, 以","分割
  8. zc.security.code.sms.url=/user/3,/user/4
  9. zc.security.code.image.width=200
  10. zc.security.code.image.height=70
  11. zc.security.code.image.length=6
  12. zc.security.code.image.border=no
  13. zc.security.code.image.fontColor=black
  14. zc.security.code.image.textproducer=0123456789abcdefghijklmnopqrstuvwxyz
  15. #图片验证码过期时间,单位秒
  16. zc.security.code.image.expireIn=60
  17. #短信验证码过期时间,单位秒
  18. zc.security.code.sms.expireIn=60
  19. zc.security.code.sms.length=6
  20. #未完待续

Beans

  1. //使用者必须实现的接口, 实现后 加入到spring的容器中,每个接口的注释在代码中可见,非常简单易懂
  2. UserDetailsService
  3. SmsCodeUserDetailsService
  4. //使用者可以自定义接口
  5. SimpleUrlAuthenticationFailureHandler
  6. SimpleAuthenticationSuccessHandler
  7. ValidateCodeProcessor
  8. SmsValidateCodeSender
  9. ValidateCodeGenerator
  10. //未完待续2017.10.09