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:
+2
-2
@@ -186,11 +186,11 @@ public class WithSecurityContextTestExecutionListener extends AbstractTestExecut
|
||||
this.testExecutionEvent = testExecutionEvent;
|
||||
}
|
||||
|
||||
public Supplier<SecurityContext> getSecurityContextSupplier() {
|
||||
Supplier<SecurityContext> getSecurityContextSupplier() {
|
||||
return this.securityContextSupplier;
|
||||
}
|
||||
|
||||
public TestExecutionEvent getTestExecutionEvent() {
|
||||
TestExecutionEvent getTestExecutionEvent() {
|
||||
return this.testExecutionEvent;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -77,7 +77,7 @@ final class WithUserDetailsSecurityContextFactory implements WithSecurityContext
|
||||
: this.beans.getBean(UserDetailsService.class);
|
||||
}
|
||||
|
||||
public UserDetailsService findAndAdaptReactiveUserDetailsService(String beanName) {
|
||||
UserDetailsService findAndAdaptReactiveUserDetailsService(String beanName) {
|
||||
try {
|
||||
ReactiveUserDetailsService reactiveUserDetailsService = StringUtils.hasLength(beanName)
|
||||
? this.beans.getBean(beanName, ReactiveUserDetailsService.class)
|
||||
|
||||
+4
-5
@@ -1178,11 +1178,11 @@ public final class SecurityMockServerConfigurers {
|
||||
}
|
||||
}
|
||||
|
||||
public static void enable(ServerWebExchange exchange) {
|
||||
static void enable(ServerWebExchange exchange) {
|
||||
exchange.getAttributes().put(ENABLED_ATTR_NAME, Boolean.TRUE);
|
||||
}
|
||||
|
||||
public boolean isEnabled(ServerWebExchange exchange) {
|
||||
boolean isEnabled(ServerWebExchange exchange) {
|
||||
return Boolean.TRUE.equals(exchange.getAttribute(ENABLED_ATTR_NAME));
|
||||
}
|
||||
|
||||
@@ -1204,8 +1204,7 @@ public final class SecurityMockServerConfigurers {
|
||||
* @return the {@link ReactiveOAuth2AuthorizedClientManager} for the specified
|
||||
* {@link ServerWebExchange}
|
||||
*/
|
||||
public static ReactiveOAuth2AuthorizedClientManager getOAuth2AuthorizedClientManager(
|
||||
ServerWebExchange exchange) {
|
||||
static ReactiveOAuth2AuthorizedClientManager getOAuth2AuthorizedClientManager(ServerWebExchange exchange) {
|
||||
OAuth2AuthorizedClientArgumentResolver resolver = findResolver(exchange,
|
||||
OAuth2AuthorizedClientArgumentResolver.class);
|
||||
if (resolver == null) {
|
||||
@@ -1223,7 +1222,7 @@ public final class SecurityMockServerConfigurers {
|
||||
* {@link ReactiveOAuth2AuthorizedClientManager}
|
||||
* @param manager the {@link ReactiveOAuth2AuthorizedClientManager} to set
|
||||
*/
|
||||
public static void setOAuth2AuthorizedClientManager(ServerWebExchange exchange,
|
||||
static void setOAuth2AuthorizedClientManager(ServerWebExchange exchange,
|
||||
ReactiveOAuth2AuthorizedClientManager manager) {
|
||||
OAuth2AuthorizedClientArgumentResolver resolver = findResolver(exchange,
|
||||
OAuth2AuthorizedClientArgumentResolver.class);
|
||||
|
||||
+9
-9
@@ -568,11 +568,11 @@ public final class SecurityMockMvcRequestPostProcessors {
|
||||
}
|
||||
}
|
||||
|
||||
public static void enable(HttpServletRequest request) {
|
||||
static void enable(HttpServletRequest request) {
|
||||
request.setAttribute(ENABLED_ATTR_NAME, Boolean.TRUE);
|
||||
}
|
||||
|
||||
public boolean isEnabled(HttpServletRequest request) {
|
||||
boolean isEnabled(HttpServletRequest request) {
|
||||
return Boolean.TRUE.equals(request.getAttribute(ENABLED_ATTR_NAME));
|
||||
}
|
||||
|
||||
@@ -1659,11 +1659,11 @@ public final class SecurityMockMvcRequestPostProcessors {
|
||||
}
|
||||
}
|
||||
|
||||
public static void enable(HttpServletRequest request) {
|
||||
static void enable(HttpServletRequest request) {
|
||||
request.setAttribute(ENABLED_ATTR_NAME, Boolean.TRUE);
|
||||
}
|
||||
|
||||
public boolean isEnabled(HttpServletRequest request) {
|
||||
boolean isEnabled(HttpServletRequest request) {
|
||||
return Boolean.TRUE.equals(request.getAttribute(ENABLED_ATTR_NAME));
|
||||
}
|
||||
|
||||
@@ -1673,6 +1673,9 @@ public final class SecurityMockMvcRequestPostProcessors {
|
||||
|
||||
private static final OAuth2AuthorizedClientRepository DEFAULT_CLIENT_REPO = new HttpSessionOAuth2AuthorizedClientRepository();
|
||||
|
||||
private OAuth2ClientServletTestUtils() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the {@link OAuth2AuthorizedClientManager} for the specified
|
||||
* {@link HttpServletRequest}. If one is not found, one based off of
|
||||
@@ -1682,7 +1685,7 @@ public final class SecurityMockMvcRequestPostProcessors {
|
||||
* @return the {@link OAuth2AuthorizedClientManager} for the specified
|
||||
* {@link HttpServletRequest}
|
||||
*/
|
||||
public static OAuth2AuthorizedClientManager getOAuth2AuthorizedClientManager(HttpServletRequest request) {
|
||||
static OAuth2AuthorizedClientManager getOAuth2AuthorizedClientManager(HttpServletRequest request) {
|
||||
OAuth2AuthorizedClientArgumentResolver resolver = findResolver(request,
|
||||
OAuth2AuthorizedClientArgumentResolver.class);
|
||||
if (resolver == null) {
|
||||
@@ -1700,7 +1703,7 @@ public final class SecurityMockMvcRequestPostProcessors {
|
||||
* {@link OAuth2AuthorizedClientManager}
|
||||
* @param manager the {@link OAuth2AuthorizedClientManager} to set
|
||||
*/
|
||||
public static void setOAuth2AuthorizedClientManager(HttpServletRequest request,
|
||||
static void setOAuth2AuthorizedClientManager(HttpServletRequest request,
|
||||
OAuth2AuthorizedClientManager manager) {
|
||||
OAuth2AuthorizedClientArgumentResolver resolver = findResolver(request,
|
||||
OAuth2AuthorizedClientArgumentResolver.class);
|
||||
@@ -1755,9 +1758,6 @@ public final class SecurityMockMvcRequestPostProcessors {
|
||||
|
||||
}
|
||||
|
||||
private OAuth2ClientServletTestUtils() {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+1
-1
@@ -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()
|
||||
|
||||
+1
-1
@@ -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()
|
||||
|
||||
+3
-6
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
+2
-3
@@ -163,12 +163,11 @@ public class WithSecurityContextTestExcecutionListenerTests {
|
||||
|
||||
static class FakeTest {
|
||||
|
||||
public void testNoAnnotation() {
|
||||
void testNoAnnotation() {
|
||||
}
|
||||
|
||||
@WithMockUser
|
||||
public void testWithMockUser() {
|
||||
|
||||
void testWithMockUser() {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+1
-1
@@ -133,7 +133,7 @@ public class Sec2935Tests {
|
||||
}
|
||||
|
||||
@Autowired
|
||||
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
|
||||
void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
|
||||
auth.inMemoryAuthentication();
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -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";
|
||||
}
|
||||
|
||||
|
||||
+3
-6
@@ -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";
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -113,7 +113,7 @@ public class SecurityMockMvcResultMatchersTests {
|
||||
static class Controller {
|
||||
|
||||
@RequestMapping("/")
|
||||
public String ok() {
|
||||
String ok() {
|
||||
return "ok";
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -93,7 +93,7 @@ public class SecurityMockWithAuthoritiesMvcResultMatchersTests {
|
||||
static class Controller {
|
||||
|
||||
@RequestMapping("/")
|
||||
public String ok() {
|
||||
String ok() {
|
||||
return "ok";
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -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()
|
||||
|
||||
+2
-2
@@ -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;
|
||||
|
||||
+1
-1
@@ -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()
|
||||
|
||||
+1
-1
@@ -117,7 +117,7 @@ public class CustomConfigAuthenticationTests {
|
||||
// @formatter:on
|
||||
|
||||
@Bean
|
||||
public SecurityContextRepository securityContextRepository() {
|
||||
SecurityContextRepository securityContextRepository() {
|
||||
HttpSessionSecurityContextRepository repo = new HttpSessionSecurityContextRepository();
|
||||
repo.setSpringSecurityContextKey("CUSTOM");
|
||||
return repo;
|
||||
|
||||
+1
-1
@@ -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()
|
||||
|
||||
+1
-1
@@ -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()
|
||||
|
||||
+1
-1
@@ -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()
|
||||
|
||||
+1
-1
@@ -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()
|
||||
|
||||
+1
-1
@@ -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()
|
||||
|
||||
+1
-1
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user