mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-08-29 03:06:45 +08:00
Polish
This commit is contained in:
parent
551c08ebfe
commit
a6cefc5ba0
@ -39,4 +39,5 @@ public class WebEndpointPropertiesTests {
|
||||
properties.setBasePath("/");
|
||||
assertThat(properties.getBasePath()).isEqualTo("");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -46,8 +46,7 @@ class OAuth2WebSecurityConfiguration {
|
||||
|
||||
@Configuration
|
||||
@ConditionalOnMissingBean(WebSecurityConfigurerAdapter.class)
|
||||
static class OAuth2WebSecurityConfigurerAdapter
|
||||
extends WebSecurityConfigurerAdapter {
|
||||
static class OAuth2WebSecurityConfigurerAdapter extends WebSecurityConfigurerAdapter {
|
||||
|
||||
@Override
|
||||
protected void configure(HttpSecurity http) throws Exception {
|
||||
|
@ -78,7 +78,8 @@ public class OAuth2ClientPropertiesRegistrationAdapterTests {
|
||||
org.springframework.security.oauth2.core.ClientAuthenticationMethod.POST);
|
||||
assertThat(adapted.getAuthorizationGrantType()).isEqualTo(
|
||||
org.springframework.security.oauth2.core.AuthorizationGrantType.AUTHORIZATION_CODE);
|
||||
assertThat(adapted.getRedirectUriTemplate()).isEqualTo("http://example.com/redirect");
|
||||
assertThat(adapted.getRedirectUriTemplate())
|
||||
.isEqualTo("http://example.com/redirect");
|
||||
assertThat(adapted.getScopes()).containsExactly("scope");
|
||||
assertThat(adapted.getClientName()).isEqualTo("clientName");
|
||||
}
|
||||
@ -111,8 +112,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.getRedirectUriTemplate()).isEqualTo(
|
||||
"{baseUrl}/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");
|
||||
@ -151,7 +152,8 @@ public class OAuth2ClientPropertiesRegistrationAdapterTests {
|
||||
org.springframework.security.oauth2.core.ClientAuthenticationMethod.POST);
|
||||
assertThat(adapted.getAuthorizationGrantType()).isEqualTo(
|
||||
org.springframework.security.oauth2.core.AuthorizationGrantType.AUTHORIZATION_CODE);
|
||||
assertThat(adapted.getRedirectUriTemplate()).isEqualTo("http://example.com/redirect");
|
||||
assertThat(adapted.getRedirectUriTemplate())
|
||||
.isEqualTo("http://example.com/redirect");
|
||||
assertThat(adapted.getScopes()).containsExactly("scope");
|
||||
assertThat(adapted.getClientName()).isEqualTo("clientName");
|
||||
}
|
||||
@ -195,7 +197,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.getRedirectUriTemplate()).isEqualTo("{baseUrl}/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");
|
||||
|
@ -97,12 +97,11 @@ public class OAuth2WebSecurityConfigurationTests {
|
||||
@Test
|
||||
public void securityConfigurerBacksOffWhenOtherWebSecurityAdapterPresent()
|
||||
throws Exception {
|
||||
this.contextRunner
|
||||
.withUserConfiguration(TestWebSecurityConfigurerConfig.class,
|
||||
OAuth2WebSecurityConfiguration.class)
|
||||
.run((context) -> {
|
||||
this.contextRunner.withUserConfiguration(TestWebSecurityConfigurerConfig.class,
|
||||
OAuth2WebSecurityConfiguration.class).run((context) -> {
|
||||
assertThat(getAuthCodeFilters(context)).isEmpty();
|
||||
assertThat(context).getBean(OAuth2AuthorizedClientService.class).isNotNull();
|
||||
assertThat(context).getBean(OAuth2AuthorizedClientService.class)
|
||||
.isNotNull();
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -241,10 +241,10 @@
|
||||
<configuration>
|
||||
<target>
|
||||
<replaceregexp match="\$\{revision\}" replace="${project.version}"
|
||||
flags="g" byline="true">
|
||||
flags="g" byline="true">
|
||||
<fileset
|
||||
dir="${project.build.directory}/local-repo/org/springframework/boot/"
|
||||
includes="**/*.pom" />
|
||||
dir="${project.build.directory}/local-repo/org/springframework/boot/"
|
||||
includes="**/*.pom" />
|
||||
</replaceregexp>
|
||||
</target>
|
||||
</configuration>
|
||||
|
@ -26,8 +26,7 @@ import org.springframework.core.NestedExceptionUtils;
|
||||
*/
|
||||
class ConfigurationPropertiesBindingException extends RuntimeException {
|
||||
|
||||
ConfigurationPropertiesBindingException(String message,
|
||||
Throwable cause) {
|
||||
ConfigurationPropertiesBindingException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
|
@ -123,7 +123,7 @@ public class ConfigurationPropertiesBinderBuilderTests {
|
||||
.withEnvironment(this.environment).build();
|
||||
assertThat(
|
||||
bindWithValidationErrors(binder, new PropertyWithJSR303()).getAllErrors())
|
||||
.hasSize(2);
|
||||
.hasSize(2);
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -152,8 +152,8 @@ public class ConfigurationPropertiesBinderBuilderTests {
|
||||
}
|
||||
|
||||
private void bind(ConfigurationPropertiesBinder binder, Object target) {
|
||||
binder.bind(target, AnnotationUtils
|
||||
.findAnnotation(target.getClass(), ConfigurationProperties.class));
|
||||
binder.bind(target, AnnotationUtils.findAnnotation(target.getClass(),
|
||||
ConfigurationProperties.class));
|
||||
}
|
||||
|
||||
@ConfigurationProperties(prefix = "test")
|
||||
|
@ -268,8 +268,8 @@ public class ConfigurationPropertiesBinderTests {
|
||||
}
|
||||
|
||||
private void bind(ConfigurationPropertiesBinder binder, Object target) {
|
||||
binder.bind(target, AnnotationUtils
|
||||
.findAnnotation(target.getClass(), ConfigurationProperties.class));
|
||||
binder.bind(target, AnnotationUtils.findAnnotation(target.getClass(),
|
||||
ConfigurationProperties.class));
|
||||
}
|
||||
|
||||
@ConfigurationProperties(value = "person", ignoreUnknownFields = false)
|
||||
|
Loading…
Reference in New Issue
Block a user