Spring Security4 和 oauth2整合注意事项
git地址:https://gitee.com/xiaoyaofeiyang/OauthUmp
spring Security4 和 oauth2整合 注解+xml混合使用(基础运行篇)
spring Security4 和 oauth2整合 注解+xml混合使用(进阶篇)
spring Security4 和 oauth2整合 注解+xml混合使用(授权码篇)
spring Security4 和 oauth2整合 注解+xml混合使用(注意事项篇)
spring Security4 和 oauth2整合 注解+xml混合使用(替换6位的授权码)
spring Security4 和 oauth2整合 注解+xml混合使用(替换用户名密码认证)
spring Security4 和 oauth2整合 注解+xml混合使用(验证码等额外数据验证)
注意事项
1.在springmvc中使用注解的oauth2,需要加上spring_security的filter。
2.tokenstore要写在配置文件中,@Bean注解无效。
3.授权码模式才是正道,微博就用的它,但是它配置更多,需要配置HttpSecurity
4.spring-oauth2的授权码模式的授权码只有6位,而且改不了,除非换个方式,我也懒得研究了。只有6位的原因看下org.springframework.security.oauth2.provider.endpoint.AuthorizationEndpoint的RandomValueStringGenerator就知道了。
(已经改掉了,使用endpoints.authorizationCodeServices(authorizationCodeServices);)
5.不想获取授权码的时候还有用base Auth的话,加上oauthServer.allowFormAuthenticationForClients();即可。
6.授权码模式,两次的redirect_url要一致。