Spring boot 2.0.0.M6 OAuth2 web应用程序客户端。不再有@enableAuth2sso;如何更换?
我已经在Spring5和SpringBoot2.0.0.M3中构建了一个身份验证服务和Web应用程序,现在我正在尝试将其移植到SpringBoot2.0.0.M6 我注意到Spring boot 2.0.0.M6 OAuth2 web应用程序客户端。不再有@enableAuth2sso;如何更换?,spring,spring-boot,spring-security-oauth2,Spring,Spring Boot,Spring Security Oauth2,我已经在Spring5和SpringBoot2.0.0.M3中构建了一个身份验证服务和Web应用程序,现在我正在尝试将其移植到SpringBoot2.0.0.M6 我注意到@enableAuth2sso在spring boot autoconfigure中不再可用;我使用此注释以springboot2.0.0.M3的方式配置我的web应用程序。我已经研究了Spring上使用@enableAuth2Client配置Oauth2客户机的示例,但是示例中使用的配置对象,如UserInfoTokenSe
@enableAuth2sso
在spring boot autoconfigure
中不再可用;我使用此注释以springboot2.0.0.M3
的方式配置我的web应用程序。我已经研究了Spring
上使用@enableAuth2Client
配置Oauth2客户机的示例,但是示例中使用的配置对象,如UserInfoTokenServices
似乎也不再存在
如何在spring boot versions>=2.0.0.M6中为OAuth2配置客户端Web应用程序?此问题现在在GitHub中跟踪,在2.0.0快照中提供,并针对RC1版本
这里的视图问题:,已经详细阐述过了,我最终在2.0.0版本中找到了注释的位置。它已被移动到2.0.0版本工件的全新项目中
要解决此问题并迁移项目,请将工件添加到依赖项管理配置中:
<dependency>
<groupId>org.springframework.security.oauth.boot</groupId>
<artifactId>spring-security-oauth2-autoconfigure</artifactId>
<version>2.0.0.RELEASE</version>
</dependency>
org.springframework.security.oauth.boot
spring-security-oauth2-autoconfigure
2.0.0.1版本
看起来@enableAuth2sso
注释已移到此处:
编译组:'org.springframework.security.oauth.boot',名称:'spring-security-oauth2-autoconfigure',版本:2.0.0.RELEASE
我现在将我的spring boot 2.0.0.M6应用程序配置为具有spring.security.oauth2.client.registration.[client id]和spring.security.oauth2.client.provider.[provider id]在it应用程序中,yaml和delared使用@EnableOAuth2Client。webapplication现在重定向到授权服务,用户可以在授权服务器上进行身份验证,并再次重定向到webapplication。但是,由于未拾取客户端提供程序配置中的userNameAttribute,因此客户端上的授权仍然失败。在ClientRegistration中操作提供程序的userNameAttribute时,授权似乎超过了权限,但在返回时再次通过筛选链时,我仍然会遇到失败。在OAuth2Client Properties RegistrationAdapter#getBuilder(Builder Builder,Provider Provider)我没有看到userNameAttributeName属性集<代码>私有静态生成器getBuilder(生成器生成器,提供程序){copyIfNotNull(提供程序::getAuthorizationUri,生成器::authorizationUri);copyIfNotNull(提供程序::getTokenUri,生成器::tokenUri);copyIfNotNull(提供程序::getJwkSetUri,生成器::jwkSetUri);return builder;}
在建议之前,我无法在最初的GitHub讨论位置澄清这一点或提供此答案,因为项目维护人员选择在回答问题后立即锁定对话