1. 程式人生 > >spring Security4 和 oauth2整合 註解+xml混合使用(注意事項篇)

spring Security4 和 oauth2整合 註解+xml混合使用(注意事項篇)

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要一致。