# Oauth2授权 **Repository Path**: sine/OauthUmp ## Basic Information - **Project Name**: Oauth2授权 - **Description**: spring Security4 和 oauth2整合 注解+xml混合使用,以及自定义登录页面,自定义授权、自定义验证、验证码验证等功能 - **Primary Language**: Java - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 4 - **Created**: 2018-01-19 - **Last Updated**: 2022-05-24 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README Spring Security4 和 oauth2整合注意事项 注意事项 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要一致。 http://blog.csdn.net/feiyangtianyao/article/details/78687161 http://blog.csdn.net/feiyangtianyao/article/details/78687403 http://blog.csdn.net/feiyangtianyao/article/details/78687569