kawhii / sso Goto Github PK
View Code? Open in Web Editor NEWcas单点登录系统,其中包括cas认证服务,配置中心,监控平台,服务管理的高可用项目
Home Page: https://kawhii.github.io/sso
License: MIT License
cas单点登录系统,其中包括cas认证服务,配置中心,监控平台,服务管理的高可用项目
Home Page: https://kawhii.github.io/sso
License: MIT License
当您有需求或者遇到棘手的问题甚至项目无法启动时,请打开博客看是否能找到解决方案
提出需求时请囊括以下要素:
请教一个问题,测试了下自定义认证UsernamePasswordSystemAuthenticationHandler会在QueryDatabaseAuthenticationHandler 之后,这样的话如果QueryDatabaseAuthenticationHandler 验证通过,就不会到UsernamePasswordSystemAuthenticationHandler 这个有办法处理吗?
对cas提供的cas-management进行对持久化的数据进行集成
Audit Events https://apereo.github.io/cas/5.1.x/installation/Audits.html
#记住我功能
cas.ticket.tgt.rememberMe.enabled = true
cas.ticket.tgt.rememberMe.timeToKillInSeconds = 28800
记住我功能开启,但是不生效问题
5.1.5如何集成google的kaptcha 期待更新
密码找回功能
HDSQL集成验证,数据初始化用sql文件,并且存在内存
第一次启动时,shiro.ini找不到,在系统临时目录中
对ticket,tgt的进行mongodb的持久化
支撑验证码
当您有需求或者遇到棘手的问题甚至项目无法启动时,请打开博客看是否能找到解决方案
提出需求时请囊括以下要素:
若是bug问题,请包括以下要素:
如何加入验证码验证?
按照博客上的配置配置好后,无法接收到邮件。
把发送邮箱改成我自己的邮箱后也不行。
请您看到后,帮我解决下可以吗?
麻烦问下,我直接调用单点的注销地址(https://*****/cas/logout),能否有办法注销掉业务系统的session?我发现如果业务系统的session不注销,仍然会进入业务系统。
java.lang.NullPointerException: null
at org.apereo.cas.web.flow.AbstractCasWebflowConfigurer.initialize(AbstractCasWebflowConfigurer.java:116) ~[cas-server-core-webflow-5.1.5.jar!/:5.1.5]
at com.carl.sso.support.captcha.config.ValidateWebflowConfiguation.validateWebflowConfigurer(ValidateWebflowConfiguation.java:60) ~[sso-support-captcha-1.6.0-RC4-SNAPSHOT.jar!/:1.6.0-RC4-SNAPSHOT]
at com.carl.sso.support.captcha.config.ValidateWebflowConfiguation$$EnhancerBySpringCGLIB$$bf33f3ec.CGLIB$validateWebflowConfigurer$2(<generated>) ~[sso-support-captcha-1.6.0-RC4-SNAPSHOT.jar!/:1.6.0-RC4-SNAPSHOT]
at com.carl.sso.support.captcha.config.ValidateWebflowConfiguation$$EnhancerBySpringCGLIB$$bf33f3ec$$FastClassBySpringCGLIB$$ae0bdbcb.invoke(<generated>) ~[sso-support-captcha-1.6.0-RC4-SNAPSHOT.jar!/:1.6.0-RC4-SNAPSHOT]
at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228) ~[spring-core-4.3.11.RELEASE.jar!/:4.3.11.RELEASE]
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:358) ~[spring-context-4.3.11.RELEASE.jar!/:4.3.11.RELEASE]
at com.carl.sso.support.captcha.config.ValidateWebflowConfiguation$$EnhancerBySpringCGLIB$$bf33f3ec.validateWebflowConfigurer(<generated>) ~[sso-support-captcha-1.6.0-RC4-SNAPSHOT.jar!/:1.6.0-RC4-SNAPSHOT]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_144]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_144]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_144]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_144]
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162) ~[spring-beans-4.3.11.RELEASE.jar!/:4.3.11.RELEASE]
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588) ~[spring-beans-4.3.11.RELEASE.jar!/:4.3.11.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1173) ~[spring-beans-4.3.11.RELEASE.jar!/:4.3.11.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1067) ~[spring-beans-4.3.11.RELEASE.jar!/:4.3.11.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:513) ~[spring-beans-4.3.11.RELEASE.jar!/:4.3.11.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483) ~[spring-beans-4.3.11.RELEASE.jar!/:4.3.11.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory$2.getObject(AbstractBeanFactory.java:345) ~[spring-beans-4.3.11.RELEASE.jar!/:4.3.11.RELEASE]
at org.springframework.cloud.context.scope.GenericScope$BeanLifecycleWrapper.getBean(GenericScope.java:359) ~[spring-cloud-context-1.2.0.RELEASE.jar!/:1.2.0.RELEASE]
at org.springframework.cloud.context.scope.GenericScope.get(GenericScope.java:176) ~[spring-cloud-context-1.2.0.RELEASE.jar!/:1.2.0.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:340) ~[spring-beans-4.3.11.RELEASE.jar!/:4.3.11.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.3.11.RELEASE.jar!/:4.3.11.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1078) ~[spring-context-4.3.11.RELEASE.jar!/:4.3.11.RELEASE]
at org.springframework.cloud.context.scope.refresh.RefreshScope.start(RefreshScope.java:121) ~[spring-cloud-context-1.2.0.RELEASE.jar!/:1.2.0.RELEASE]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_144]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_144]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_144]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_144]
at org.springframework.context.event.ApplicationListenerMethodAdapter.doInvoke(ApplicationListenerMethodAdapter.java:256) ~[spring-context-4.3.11.RELEASE.jar!/:4.3.11.RELEASE]
at org.springframework.context.event.ApplicationListenerMethodAdapter.processEvent(ApplicationListenerMethodAdapter.java:177) ~[spring-context-4.3.11.RELEASE.jar!/:4.3.11.RELEASE]
at org.springframework.context.event.ApplicationListenerMethodAdapter.onApplicationEvent(ApplicationListenerMethodAdapter.java:140) ~[spring-context-4.3.11.RELEASE.jar!/:4.3.11.RELEASE]
at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172) ~[spring-context-4.3.11.RELEASE.jar!/:4.3.11.RELEASE]
at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165) ~[spring-context-4.3.11.RELEASE.jar!/:4.3.11.RELEASE]
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139) ~[spring-context-4.3.11.RELEASE.jar!/:4.3.11.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:393) ~[spring-context-4.3.11.RELEASE.jar!/:4.3.11.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:347) ~[spring-context-4.3.11.RELEASE.jar!/:4.3.11.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:883) ~[spring-context-4.3.11.RELEASE.jar!/:4.3.11.RELEASE]
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.finishRefresh(EmbeddedWebApplicationContext.java:144) ~[spring-boot-1.5.3.RELEASE.jar!/:1.5.3.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:546) ~[spring-context-4.3.11.RELEASE.jar!/:4.3.11.RELEASE]
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) ~[spring-boot-1.5.3.RELEASE.jar!/:1.5.3.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:737) ~[spring-boot-1.5.3.RELEASE.jar!/:1.5.3.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:370) ~[spring-boot-1.5.3.RELEASE.jar!/:1.5.3.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:314) ~[spring-boot-1.5.3.RELEASE.jar!/:1.5.3.RELEASE]
at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:134) ~[spring-boot-1.5.3.RELEASE.jar!/:1.5.3.RELEASE]
at org.apereo.cas.web.CasWebApplication.main(CasWebApplication.java:77) ~[cas-server-webapp-init-5.1.5.jar!/:5.1.5]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_144]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_144]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_144]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_144]
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48) ~[cas.war:5.1.5]
at org.springframework.boot.loader.Launcher.launch(Launcher.java:87) ~[cas.war:5.1.5]
at org.springframework.boot.loader.Launcher.launch(Launcher.java:50) ~[cas.war:5.1.5]
at org.springframework.boot.loader.WarLauncher.main(WarLauncher.java:59) ~[cas.war:5.1.5]
2017-11-06 13:28:05,430 ERROR [org.apereo.cas.web.flow.AbstractCasWebflowConfigurer] - <null>
java.lang.NullPointerException: null
登录A系统后,如果A系统页面中访问B系统的接口,接着展示B系统的图片,地址会变成类似于下面的连接
https://****/cas/login?service=https://*****/bas/attach/download/download.do?id=1246
只有浏览器访问过B系统一次之后,才能正常访问,麻烦问下这是怎么回事?
新增博客教程,包括
对cas提供的客户端方式进行对接cas
集成pac4fj认证
测试环境需要增加以下安全
http://wiki.connect.qq.com/%E5%BC%80%E5%8F%91%E6%94%BB%E7%95%A5_server-side
ISender
(主导发送信息对象,例如发送校验码到手机,发送到邮箱)IStore
(负责存储发送者发出的信息)InformativeGenerator
(负责生成发送者需要发送的信息)IValidator
(负责对数据进行校验)#验证码发送邮箱
sso.validate.mail.enable=true
sso.validate.mail.from=${spring.mail.username}
sso.validate.mail.content=统一门户注册验证码为:%s
sso.validate.mail.subject=统一门户注册
@Autowired
private DefaultValidateService validateService;
//验证
@PostMapping
public String registry(Model model, HttpServletRequest request, @Valid RegistryInfoVo registryInfoVo) {
ValidateResult result = validateService.validate(
new MailValidateCredential(request.getSession().getId(), registryInfoVo.getEmail(),
"registry", registryInfoVo.getValidateCode()));
if (result == ValidateResult.FAIL) {
model.addAttribute("validateError", "验证码错误");
} else if (result == ValidateResult.EXPIRED) {
model.addAttribute("validateError", "验证码已过期");
}
return "registryView";
}
//发送
validateService.send(new MailCredential(request.getSession().getId(), mail, "registry"));
service-management服务无效
所谓“单用户单账户登录”是指:在同一系统中,一个用户名不能在两个地方同时登录
按照博客文章 http://blog.csdn.net/u010475041/article/details/78028658 所描述,直接利用工程里面的代码,编译后启动,弹出浏览器后访问报错,一直没法正常使用sso-management
启动顺序
sso-config
sso-server
sso-management
启动完最后一个模块,弹出浏览器,直接定向到地址 http://passport.sso.com:8443/cas/login?service=http%3A%2F%2Flocalhost%3A8081%2Fmanage.html
返回的是404页面
直接访问 http://localhost:8081/cas-management 也是返回此404页面
求助博主
采用 spring-admin进行搭建监控模块,并且让各服务连接监控系统
当时第三方登录是,查找用户未登录是,先调整到绑定页,绑定完成才调整到业务系统
cas 5.1.4 使用自定义登录认证和和自定义credential的时候怎么做到,当用户连续三次登录失败的时候出现图形校验码或者短信验证码?
集成客户端shiro认证方式,采用spring bean进行集成
我在配置中增加了jwt的client,SecurityFilter执行完成client后,是在哪里进行登陆shiro的,我计划改造shiro为stateless,无法下手.希望能提供具体的位置,万分感谢
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
[INFO] 1 error
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] sso-spring-dependencies ............................ SUCCESS [ 0.402 s]
[INFO] sso-support ........................................ SUCCESS [ 0.035 s]
[INFO] sso-support-custom-auth ............................ FAILURE [ 1.914 s]
[INFO] sso-support-single-login ........................... SKIPPED
[INFO] sso-support-captcha ................................ SKIPPED
[INFO] sso ................................................ SKIPPED
[INFO] sso-server ......................................... SKIPPED
[INFO] sso-config ......................................... SKIPPED
[INFO] sso-management ..................................... SKIPPED
[INFO] sso-client-demo .................................... SKIPPED
[INFO] sso-cas-client-demo ................................ SKIPPED
[INFO] sso-client-shiro-demo .............................. SKIPPED
[INFO] sso-client-proxy-demo .............................. SKIPPED
[INFO] sso-support-validate ............................... SKIPPED
[INFO] sso-monitor ........................................ SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.245 s
[INFO] Finished at: 2017-12-18T17:57:15+08:00
[INFO] Final Memory: 41M/452M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project sso-support-custom-auth: Compilation failure
[ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
[ERROR]
[ERROR] -> [Help 1]
主题名称为:light
我这里只是改了下数据库为mysql,测试时发现先到QueryDatabaseAuthenticationHandler去验证,通过了就没有到UsernamePasswordSystemAuthenticationHandler,这是正常的吗?
对service的配置在博客文档中落实
加入自定义认证后,任一用户名可登陆
我去掉了改判断
if ("admin".equals(sysCredential.getUsername())){// && "sso".equals(sysCredential.getSystem())) {
采用pac4j以及spring boot方式集成
将验证码添加到loginform,会显示图片,但是不会验证,空或者错误,正确。均不会拦截。
项目支持Docker构建,上传到docker hub
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.