Reduce method visibility when possible

Reduce method visibility for package private classes when possible.

In the case of abstract classes that will eventually be made public,
the class has been made public and a package-private constructor has
been added.

Issue gh-8945
This commit is contained in:
Phillip Webb
2020-07-29 22:05:08 -07:00
committed by Rob Winch
parent ec6a4cb3f0
commit 8d3f039f76
155 changed files with 508 additions and 477 deletions

View File

@@ -51,7 +51,7 @@ public class WithMockUserParentTests extends WithMockUserParent {
static class Config {
@Autowired
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
// @formatter:off
auth
.inMemoryAuthentication()

View File

@@ -81,7 +81,7 @@ public class WithMockUserTests {
static class Config {
@Autowired
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
// @formatter:off
auth
.inMemoryAuthentication()

View File

@@ -86,15 +86,12 @@ public class WithUserDetailsTests {
static class Config {
@Autowired
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
// @formatter:off
auth
.userDetailsService(myUserDetailsService());
// @formatter:on
void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
auth.userDetailsService(myUserDetailsService());
}
@Bean
public UserDetailsService myUserDetailsService() {
UserDetailsService myUserDetailsService() {
return new CustomUserDetailsService();
}

View File

@@ -163,12 +163,11 @@ public class WithSecurityContextTestExcecutionListenerTests {
static class FakeTest {
public void testNoAnnotation() {
void testNoAnnotation() {
}
@WithMockUser
public void testWithMockUser() {
void testWithMockUser() {
}
}

View File

@@ -133,7 +133,7 @@ public class Sec2935Tests {
}
@Autowired
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
auth.inMemoryAuthentication();
}

View File

@@ -85,7 +85,7 @@ public class SecurityMockMvcRequestPostProcessorsAuthenticationStatelessTests {
}
@Autowired
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
// @formatter:off
auth
.inMemoryAuthentication();
@@ -96,7 +96,7 @@ public class SecurityMockMvcRequestPostProcessorsAuthenticationStatelessTests {
static class Controller {
@RequestMapping
public String hello() {
String hello() {
return "Hello";
}

View File

@@ -83,18 +83,15 @@ public class SecurityMockMvcRequestPostProcessorsTestSecurityContextStatelessTes
}
@Autowired
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
// @formatter:off
auth
.inMemoryAuthentication();
// @formatter:on
void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
auth.inMemoryAuthentication();
}
@RestController
static class Controller {
@RequestMapping
public String hello() {
String hello() {
return "Hello";
}

View File

@@ -113,7 +113,7 @@ public class SecurityMockMvcResultMatchersTests {
static class Controller {
@RequestMapping("/")
public String ok() {
String ok() {
return "ok";
}

View File

@@ -93,7 +93,7 @@ public class SecurityMockWithAuthoritiesMvcResultMatchersTests {
static class Controller {
@RequestMapping("/")
public String ok() {
String ok() {
return "ok";
}

View File

@@ -78,7 +78,7 @@ public class CsrfShowcaseTests {
}
@Autowired
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
// @formatter:off
auth
.inMemoryAuthentication()

View File

@@ -86,7 +86,7 @@ public class CustomCsrfShowcaseTests {
}
@Autowired
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
// @formatter:off
auth
.inMemoryAuthentication()
@@ -95,7 +95,7 @@ public class CustomCsrfShowcaseTests {
}
@Bean
public CsrfTokenRepository repo() {
CsrfTokenRepository repo() {
HttpSessionCsrfTokenRepository repo = new HttpSessionCsrfTokenRepository();
repo.setParameterName("custom_csrf");
return repo;

View File

@@ -75,7 +75,7 @@ public class DefaultCsrfShowcaseTests {
}
@Autowired
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
// @formatter:off
auth
.inMemoryAuthentication()

View File

@@ -117,7 +117,7 @@ public class CustomConfigAuthenticationTests {
// @formatter:on
@Bean
public SecurityContextRepository securityContextRepository() {
SecurityContextRepository securityContextRepository() {
HttpSessionSecurityContextRepository repo = new HttpSessionSecurityContextRepository();
repo.setSpringSecurityContextKey("CUSTOM");
return repo;

View File

@@ -101,7 +101,7 @@ public class DefaultfSecurityRequestsTests {
}
@Autowired
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
// @formatter:off
auth
.inMemoryAuthentication()

View File

@@ -118,7 +118,7 @@ public class SecurityRequestsTests {
}
@Autowired
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
// @formatter:off
auth
.inMemoryAuthentication()

View File

@@ -102,7 +102,7 @@ public class WithUserAuthenticationTests {
}
@Autowired
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
// @formatter:off
auth
.inMemoryAuthentication()

View File

@@ -102,7 +102,7 @@ public class WithUserClassLevelAuthenticationTests {
}
@Autowired
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
// @formatter:off
auth
.inMemoryAuthentication()

View File

@@ -99,7 +99,7 @@ public class WithUserDetailsAuthenticationTests {
}
@Autowired
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
// @formatter:off
auth
.inMemoryAuthentication()

View File

@@ -98,7 +98,7 @@ public class WithUserDetailsClassLevelAuthenticationTests {
}
@Autowired
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
// @formatter:off
auth
.inMemoryAuthentication()