mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-08-29 03:06:45 +08:00
Rename clientReg redirectUri to redirectUriTemplate
To keep it consistent with changes made in Spring Security Closes gh-11038
This commit is contained in:
parent
3e46b5c5c7
commit
d1766509f1
@ -102,7 +102,7 @@ public class OAuth2ClientProperties {
|
||||
/**
|
||||
* Redirect URI. May be left blank then using a pre-defined provider.
|
||||
*/
|
||||
private String redirectUri;
|
||||
private String redirectUriTemplate;
|
||||
|
||||
/**
|
||||
* Authorization scopes. May be left blank then using a pre-defined provider.
|
||||
@ -154,12 +154,12 @@ public class OAuth2ClientProperties {
|
||||
this.authorizationGrantType = authorizationGrantType;
|
||||
}
|
||||
|
||||
public String getRedirectUri() {
|
||||
return this.redirectUri;
|
||||
public String getRedirectUriTemplate() {
|
||||
return this.redirectUriTemplate;
|
||||
}
|
||||
|
||||
public void setRedirectUri(String redirectUri) {
|
||||
this.redirectUri = redirectUri;
|
||||
public void setRedirectUriTemplate(String redirectUriTemplate) {
|
||||
this.redirectUriTemplate = redirectUriTemplate;
|
||||
}
|
||||
|
||||
public Set<String> getScope() {
|
||||
|
@ -61,7 +61,7 @@ final class OAuth2ClientPropertiesRegistrationAdapter {
|
||||
builder::clientAuthenticationMethod, ClientAuthenticationMethod::new);
|
||||
copyIfNotNull(properties::getAuthorizationGrantType,
|
||||
builder::authorizationGrantType, AuthorizationGrantType::new);
|
||||
copyIfNotNull(properties::getRedirectUri, builder::redirectUri);
|
||||
copyIfNotNull(properties::getRedirectUriTemplate, builder::redirectUriTemplate);
|
||||
copyIfNotNull(properties::getScope, builder::scope,
|
||||
(scope) -> scope.toArray(new String[scope.size()]));
|
||||
copyIfNotNull(properties::getClientName, builder::clientName);
|
||||
|
@ -34,6 +34,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
* Tests for {@link OAuth2ClientPropertiesRegistrationAdapter}.
|
||||
*
|
||||
* @author Phillip Webb
|
||||
* @author Madhura Bhave
|
||||
*/
|
||||
public class OAuth2ClientPropertiesRegistrationAdapterTests {
|
||||
|
||||
@ -55,7 +56,7 @@ public class OAuth2ClientPropertiesRegistrationAdapterTests {
|
||||
registration.setClientSecret("clientSecret");
|
||||
registration.setClientAuthenticationMethod("post");
|
||||
registration.setAuthorizationGrantType("authorization_code");
|
||||
registration.setRedirectUri("http://example.com/redirect");
|
||||
registration.setRedirectUriTemplate("http://example.com/redirect");
|
||||
registration.setScope(Collections.singleton("scope"));
|
||||
registration.setClientName("clientName");
|
||||
properties.getProvider().put("provider", provider);
|
||||
@ -77,7 +78,7 @@ public class OAuth2ClientPropertiesRegistrationAdapterTests {
|
||||
org.springframework.security.oauth2.core.ClientAuthenticationMethod.POST);
|
||||
assertThat(adapted.getAuthorizationGrantType()).isEqualTo(
|
||||
org.springframework.security.oauth2.core.AuthorizationGrantType.AUTHORIZATION_CODE);
|
||||
assertThat(adapted.getRedirectUri()).isEqualTo("http://example.com/redirect");
|
||||
assertThat(adapted.getRedirectUriTemplate()).isEqualTo("http://example.com/redirect");
|
||||
assertThat(adapted.getScopes()).containsExactly("scope");
|
||||
assertThat(adapted.getClientName()).isEqualTo("clientName");
|
||||
}
|
||||
@ -110,8 +111,8 @@ public class OAuth2ClientPropertiesRegistrationAdapterTests {
|
||||
org.springframework.security.oauth2.core.ClientAuthenticationMethod.BASIC);
|
||||
assertThat(adapted.getAuthorizationGrantType()).isEqualTo(
|
||||
org.springframework.security.oauth2.core.AuthorizationGrantType.AUTHORIZATION_CODE);
|
||||
assertThat(adapted.getRedirectUri()).isEqualTo(
|
||||
"{scheme}://{serverName}:{serverPort}{contextPath}/login/oauth2/code/{registrationId}");
|
||||
assertThat(adapted.getRedirectUriTemplate()).isEqualTo(
|
||||
"{baseUrl}/login/oauth2/code/{registrationId}");
|
||||
assertThat(adapted.getScopes()).containsExactly("openid", "profile", "email",
|
||||
"address", "phone");
|
||||
assertThat(adapted.getClientName()).isEqualTo("Google");
|
||||
@ -127,7 +128,7 @@ public class OAuth2ClientPropertiesRegistrationAdapterTests {
|
||||
registration.setClientSecret("clientSecret");
|
||||
registration.setClientAuthenticationMethod("post");
|
||||
registration.setAuthorizationGrantType("authorization_code");
|
||||
registration.setRedirectUri("http://example.com/redirect");
|
||||
registration.setRedirectUriTemplate("http://example.com/redirect");
|
||||
registration.setScope(Collections.singleton("scope"));
|
||||
registration.setClientName("clientName");
|
||||
properties.getRegistration().put("registration", registration);
|
||||
@ -150,7 +151,7 @@ public class OAuth2ClientPropertiesRegistrationAdapterTests {
|
||||
org.springframework.security.oauth2.core.ClientAuthenticationMethod.POST);
|
||||
assertThat(adapted.getAuthorizationGrantType()).isEqualTo(
|
||||
org.springframework.security.oauth2.core.AuthorizationGrantType.AUTHORIZATION_CODE);
|
||||
assertThat(adapted.getRedirectUri()).isEqualTo("http://example.com/redirect");
|
||||
assertThat(adapted.getRedirectUriTemplate()).isEqualTo("http://example.com/redirect");
|
||||
assertThat(adapted.getScopes()).containsExactly("scope");
|
||||
assertThat(adapted.getClientName()).isEqualTo("clientName");
|
||||
}
|
||||
@ -194,8 +195,7 @@ public class OAuth2ClientPropertiesRegistrationAdapterTests {
|
||||
org.springframework.security.oauth2.core.ClientAuthenticationMethod.BASIC);
|
||||
assertThat(adapted.getAuthorizationGrantType()).isEqualTo(
|
||||
org.springframework.security.oauth2.core.AuthorizationGrantType.AUTHORIZATION_CODE);
|
||||
assertThat(adapted.getRedirectUri()).isEqualTo(
|
||||
"{scheme}://{serverName}:{serverPort}{contextPath}/login/oauth2/code/{registrationId}");
|
||||
assertThat(adapted.getRedirectUriTemplate()).isEqualTo("{baseUrl}/login/oauth2/code/{registrationId}");
|
||||
assertThat(adapted.getScopes()).containsExactly("openid", "profile", "email",
|
||||
"address", "phone");
|
||||
assertThat(adapted.getClientName()).isEqualTo("Google");
|
||||
|
@ -142,8 +142,8 @@ public class OAuth2WebSecurityConfigurationTests {
|
||||
result = result && ObjectUtils.nullSafeEquals(reg1.getClientSecret(),
|
||||
reg2.getClientSecret());
|
||||
result = result && ObjectUtils.nullSafeEquals(reg1.getScopes(), reg2.getScopes());
|
||||
result = result && ObjectUtils.nullSafeEquals(reg1.getRedirectUri(),
|
||||
reg2.getRedirectUri());
|
||||
result = result && ObjectUtils.nullSafeEquals(reg1.getRedirectUriTemplate(),
|
||||
reg2.getRedirectUriTemplate());
|
||||
result = result && ObjectUtils.nullSafeEquals(reg1.getRegistrationId(),
|
||||
reg2.getRegistrationId());
|
||||
result = result && ObjectUtils.nullSafeEquals(reg1.getAuthorizationGrantType(),
|
||||
@ -191,7 +191,7 @@ public class OAuth2WebSecurityConfigurationTests {
|
||||
org.springframework.security.oauth2.core.ClientAuthenticationMethod.BASIC)
|
||||
.authorizationGrantType(AuthorizationGrantType.AUTHORIZATION_CODE)
|
||||
.scope("read").clientSecret("secret")
|
||||
.redirectUri("http://redirect-uri.com")
|
||||
.redirectUriTemplate("http://redirect-uri.com")
|
||||
.authorizationUri("http://authorization-uri.com")
|
||||
.tokenUri("http://token-uri.com").userInfoUri(userInfoUri)
|
||||
.userNameAttributeName("login");
|
||||
|
@ -153,7 +153,7 @@
|
||||
<spring-plugin.version>1.2.0.RELEASE</spring-plugin.version>
|
||||
<spring-restdocs.version>2.0.0.BUILD-SNAPSHOT</spring-restdocs.version>
|
||||
<spring-retry.version>1.2.1.RELEASE</spring-retry.version>
|
||||
<spring-security.version>5.0.0.RC1</spring-security.version>
|
||||
<spring-security.version>5.0.0.BUILD-SNAPSHOT</spring-security.version>
|
||||
<spring-session.version>2.0.0.RC1</spring-session.version>
|
||||
<spring-session-data-mongodb.version>2.0.0.RC1</spring-session-data-mongodb.version>
|
||||
<spring-social.version>2.0.0.M4</spring-social.version>
|
||||
|
Loading…
Reference in New Issue
Block a user