Remove superfluous comments

Remove a few comments that previously add noise but don't offer a great
deal of value.

Issue gh-8945
This commit is contained in:
Phillip Webb
2020-07-29 00:19:27 -07:00
committed by Rob Winch
parent 8d80166aaf
commit 31ec450d05
28 changed files with 7 additions and 304 deletions

View File

@@ -436,8 +436,6 @@ public class OAuth2ResourceServerConfigurerTests {
.andExpect(content().string("test-subject"));
}
// -- Method Security
@Test
public void getWhenUsingMethodSecurityWithValidBearerTokenThenAcceptsRequest() throws Exception {
@@ -494,8 +492,6 @@ public class OAuth2ResourceServerConfigurerTests {
.andExpect(insufficientScopeHeader());
}
// -- Resource Server should not engage csrf
@Test
public void postWhenUsingDefaultsWithValidBearerTokenAndNoCsrfTokenThenOk() throws Exception {
@@ -527,8 +523,6 @@ public class OAuth2ResourceServerConfigurerTests {
.andExpect(invalidTokenHeader("An error occurred while attempting to decode the Jwt"));
}
// -- Resource Server should not create sessions
@Test
public void requestWhenDefaultConfiguredThenSessionIsNotCreated() throws Exception {
@@ -576,8 +570,6 @@ public class OAuth2ResourceServerConfigurerTests {
assertThat(result.getRequest().getSession(false)).isNotNull();
}
// -- custom bearer token resolver
@Test
public void requestWhenBearerTokenResolverAllowsRequestBodyThenEitherHeaderOrRequestBodyIsAccepted()
throws Exception {
@@ -693,8 +685,6 @@ public class OAuth2ResourceServerConfigurerTests {
assertThat(oauth2.getBearerTokenResolver()).isInstanceOf(DefaultBearerTokenResolver.class);
}
// -- custom jwt decoder
@Test
public void requestWhenCustomJwtDecoderWiredOnDslThenUsed() throws Exception {
@@ -820,8 +810,6 @@ public class OAuth2ResourceServerConfigurerTests {
assertThatCode(() -> jwtConfigurer.getJwtDecoder()).isInstanceOf(NoUniqueBeanDefinitionException.class);
}
// -- exception handling
@Test
public void requestWhenRealmNameConfiguredThenUsesOnUnauthenticated() throws Exception {
@@ -861,8 +849,6 @@ public class OAuth2ResourceServerConfigurerTests {
assertThatCode(() -> configurer.accessDeniedHandler(null)).isInstanceOf(IllegalArgumentException.class);
}
// -- token validator
@Test
public void requestWhenCustomJwtValidatorFailsThenCorrespondingErrorMessage() throws Exception {
@@ -904,8 +890,6 @@ public class OAuth2ResourceServerConfigurerTests {
.andExpect(invalidTokenHeader("Jwt expired at"));
}
// -- converter
@Test
public void requestWhenJwtAuthenticationConverterConfiguredOnDslThenIsUsed() throws Exception {
@@ -937,8 +921,6 @@ public class OAuth2ResourceServerConfigurerTests {
this.mvc.perform(get("/requires-read-scope").with(bearerToken(JWT_TOKEN))).andExpect(status().isOk());
}
// -- single key
@Test
public void requestWhenUsingPublicKeyAndValidTokenThenAuthenticates() throws Exception {
@@ -991,8 +973,6 @@ public class OAuth2ResourceServerConfigurerTests {
verifyBean(AuthenticationProvider.class).authenticate(any(Authentication.class));
}
// -- opaque
@Test
public void getWhenIntrospectingThenOk() throws Exception {
this.spring.register(RestOperationsConfig.class, OpaqueTokenConfig.class, BasicController.class).autowire();
@@ -1099,8 +1079,6 @@ public class OAuth2ResourceServerConfigurerTests {
assertThat(opaqueToken.getIntrospector()).isNotNull();
}
// -- In combination with other authentication providers
@Test
public void requestWhenBasicAndResourceServerEntryPointsThenMatchedByRequest() throws Exception {
@@ -1171,8 +1149,6 @@ public class OAuth2ResourceServerConfigurerTests {
.andExpect(status().isOk()).andExpect(content().string("basic-user"));
}
// -- authentication manager
@Test
public void getAuthenticationManagerWhenConfiguredAuthenticationManagerThenTakesPrecedence() {
ApplicationContext context = mock(ApplicationContext.class);
@@ -1190,8 +1166,6 @@ public class OAuth2ResourceServerConfigurerTests {
verify(http, never()).authenticationProvider(any(AuthenticationProvider.class));
}
// -- authentication manager resolver
@Test
public void getWhenMultipleIssuersThenUsesIssuerClaimToDifferentiate() throws Exception {
this.spring.register(WebServerConfig.class, MultipleIssuersConfig.class, BasicController.class).autowire();
@@ -1226,8 +1200,6 @@ public class OAuth2ResourceServerConfigurerTests {
.andExpect(invalidTokenHeader("Invalid issuer"));
}
// -- Incorrect Configuration
@Test
public void configuredWhenMissingJwtAuthenticationProviderThenWiringException() {

View File

@@ -135,8 +135,6 @@ public class HttpHeadersConfigTests {
this.mvc.perform(get("/").secure(true)).andExpect(status().isOk()).andExpect(includes(headers));
}
// -- defaults disabled
/**
* gh-3986
*/
@@ -480,8 +478,6 @@ public class HttpHeadersConfigTests {
.andExpect(excludesDefaults());
}
// -- single-header disabled
@Test
public void requestWhenCacheControlDisabledThenExcludesHeader() throws Exception {
@@ -550,8 +546,6 @@ public class HttpHeadersConfigTests {
.andExpect(excludes(xssProtection));
}
// --- disable error handling ---
@Test
public void configureWhenHstsDisabledAndIncludeSubdomainsSpecifiedThenAutowireFails() {
assertThatThrownBy(

View File

@@ -335,8 +335,6 @@ public class OAuth2ResourceServerBeanDefinitionParserTests {
.andExpect(status().isNotFound());
}
// -- Resource Server should not engage csrf
@Test
public void postWhenValidBearerTokenAndNoCsrfTokenThenOk() throws Exception {
@@ -371,8 +369,6 @@ public class OAuth2ResourceServerBeanDefinitionParserTests {
.andExpect(invalidTokenHeader("An error occurred while attempting to decode the Jwt"));
}
// -- Resource Server should not create sessions
@Test
public void requestWhenJwtThenSessionIsNotCreated() throws Exception {
@@ -421,8 +417,6 @@ public class OAuth2ResourceServerBeanDefinitionParserTests {
assertThat(result.getRequest().getSession(false)).isNotNull();
}
// -- custom bearer token resolver
@Test
public void getWhenCustomBearerTokenResolverThenUses() throws Exception {
this.spring.configLocations(xml("MockBearerTokenResolver"), xml("MockJwtDecoder"), xml("BearerTokenResolver"))
@@ -502,8 +496,6 @@ public class OAuth2ResourceServerBeanDefinitionParserTests {
assertThat(oauth2.getBearerTokenResolver(mock(Element.class))).isInstanceOf(RootBeanDefinition.class);
}
// -- custom jwt decoder
@Test
public void requestWhenCustomJwtDecoderThenUsed() throws Exception {
@@ -525,8 +517,6 @@ public class OAuth2ResourceServerBeanDefinitionParserTests {
.isInstanceOf(BeanDefinitionParsingException.class);
}
// -- exception handling
@Test
public void requestWhenRealmNameConfiguredThenUsesOnUnauthenticated() throws Exception {
@@ -553,8 +543,6 @@ public class OAuth2ResourceServerBeanDefinitionParserTests {
.andExpect(header().string(HttpHeaders.WWW_AUTHENTICATE, startsWith("Bearer realm=\"myRealm\"")));
}
// -- token validator
@Test
public void requestWhenCustomJwtValidatorFailsThenCorrespondingErrorMessage() throws Exception {
@@ -593,8 +581,6 @@ public class OAuth2ResourceServerBeanDefinitionParserTests {
.andExpect(invalidTokenHeader("Jwt expired at"));
}
// -- converter
@Test
public void requestWhenJwtAuthenticationConverterThenUsed() throws Exception {
@@ -614,8 +600,6 @@ public class OAuth2ResourceServerBeanDefinitionParserTests {
verify(jwtAuthenticationConverter).convert(any(Jwt.class));
}
// -- single key
@Test
public void requestWhenUsingPublicKeyAndValidTokenThenAuthenticates() throws Exception {
@@ -645,8 +629,6 @@ public class OAuth2ResourceServerBeanDefinitionParserTests {
.andExpect(invalidTokenHeader("algorithm"));
}
// -- opaque
@Test
public void getWhenIntrospectingThenOk() throws Exception {
this.spring.configLocations(xml("OpaqueTokenRestOperations"), xml("OpaqueToken")).autowire();
@@ -688,8 +670,6 @@ public class OAuth2ResourceServerBeanDefinitionParserTests {
.isInstanceOf(BeanDefinitionParsingException.class);
}
// -- authentication manager resolver
@Test
public void getWhenAuthenticationManagerResolverThenUses() throws Exception {
this.spring.configLocations(xml("AuthenticationManagerResolver")).autowire();
@@ -738,12 +718,9 @@ public class OAuth2ResourceServerBeanDefinitionParserTests {
.andExpect(status().isUnauthorized()).andExpect(invalidTokenHeader("Invalid issuer"));
}
// -- In combination with other authentication providers
@Test
public void requestWhenBasicAndResourceServerEntryPointsThenBearerTokenPresides() throws Exception { // different
// from
// DSL
public void requestWhenBasicAndResourceServerEntryPointsThenBearerTokenPresides() throws Exception {
// different from DSL
this.spring.configLocations(xml("MockJwtDecoder"), xml("BasicAndResourceServer")).autowire();
@@ -762,9 +739,8 @@ public class OAuth2ResourceServerBeanDefinitionParserTests {
}
@Test
public void requestWhenFormLoginAndResourceServerEntryPointsThenSessionCreatedByRequest() throws Exception { // different
// from
// DSL
public void requestWhenFormLoginAndResourceServerEntryPointsThenSessionCreatedByRequest() throws Exception {
// different from DSL
this.spring.configLocations(xml("MockJwtDecoder"), xml("FormAndResourceServer")).autowire();
@@ -794,8 +770,6 @@ public class OAuth2ResourceServerBeanDefinitionParserTests {
this.mvc.perform(get("/authenticated").with(httpBasic("user", "password"))).andExpect(status().isNotFound());
}
// -- Incorrect Configuration
@Test
public void configuredWhenMissingJwtAuthenticationProviderThenWiringException() {
assertThatCode(() -> this.spring.configLocations(xml("Jwtless")).autowire())

View File

@@ -242,8 +242,6 @@ public class WebSocketMessageBrokerConfigTests {
assertThatThrownBy(send(message)).hasCauseInstanceOf(AccessDeniedException.class);
}
// -- invalid intercept types -- //
@Test
public void configureWhenUsingConnectMessageTypeThenAutowireFails() {
ThrowingCallable bad = () -> this.spring.configLocations(xml("ConnectInterceptTypeConfig")).autowire();