Apply updated Code Style
Closes gh-13881
This commit is contained in:
+1
-1
@@ -68,7 +68,7 @@ public class HttpNamespaceWithMultipleInterceptorsTests {
|
||||
public HttpSession createAuthenticatedSession(String... roles) {
|
||||
MockHttpSession session = new MockHttpSession();
|
||||
SecurityContextHolder.getContext()
|
||||
.setAuthentication(new TestingAuthenticationToken("bob", "bobspassword", roles));
|
||||
.setAuthentication(new TestingAuthenticationToken("bob", "bobspassword", roles));
|
||||
session.setAttribute(HttpSessionSecurityContextRepository.SPRING_SECURITY_CONTEXT_KEY,
|
||||
SecurityContextHolder.getContext());
|
||||
SecurityContextHolder.clearContext();
|
||||
|
||||
+4
-4
@@ -50,7 +50,7 @@ public class HttpPathParameterStrippingTests {
|
||||
request.setSession(createAuthenticatedSession("ROLE_USER"));
|
||||
MockHttpServletResponse response = new MockHttpServletResponse();
|
||||
assertThatExceptionOfType(RequestRejectedException.class)
|
||||
.isThrownBy(() -> this.fcp.doFilter(request, response, new MockFilterChain()));
|
||||
.isThrownBy(() -> this.fcp.doFilter(request, response, new MockFilterChain()));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -60,7 +60,7 @@ public class HttpPathParameterStrippingTests {
|
||||
request.setSession(createAuthenticatedSession("ROLE_USER"));
|
||||
MockHttpServletResponse response = new MockHttpServletResponse();
|
||||
assertThatExceptionOfType(RequestRejectedException.class)
|
||||
.isThrownBy(() -> this.fcp.doFilter(request, response, new MockFilterChain()));
|
||||
.isThrownBy(() -> this.fcp.doFilter(request, response, new MockFilterChain()));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -71,13 +71,13 @@ public class HttpPathParameterStrippingTests {
|
||||
request.setSession(createAuthenticatedSession("ROLE_USER"));
|
||||
MockHttpServletResponse response = new MockHttpServletResponse();
|
||||
assertThatExceptionOfType(RequestRejectedException.class)
|
||||
.isThrownBy(() -> this.fcp.doFilter(request, response, new MockFilterChain()));
|
||||
.isThrownBy(() -> this.fcp.doFilter(request, response, new MockFilterChain()));
|
||||
}
|
||||
|
||||
public HttpSession createAuthenticatedSession(String... roles) {
|
||||
MockHttpSession session = new MockHttpSession();
|
||||
SecurityContextHolder.getContext()
|
||||
.setAuthentication(new TestingAuthenticationToken("bob", "bobspassword", roles));
|
||||
.setAuthentication(new TestingAuthenticationToken("bob", "bobspassword", roles));
|
||||
session.setAttribute(HttpSessionSecurityContextRepository.SPRING_SECURITY_CONTEXT_KEY,
|
||||
SecurityContextHolder.getContext());
|
||||
SecurityContextHolder.clearContext();
|
||||
|
||||
+1
-1
@@ -46,7 +46,7 @@ public class SEC936ApplicationContextTests {
|
||||
@Test
|
||||
public void securityInterceptorHandlesCallWithNoTargetObject() {
|
||||
SecurityContextHolder.getContext()
|
||||
.setAuthentication(UsernamePasswordAuthenticationToken.unauthenticated("bob", "bobspassword"));
|
||||
.setAuthentication(UsernamePasswordAuthenticationToken.unauthenticated("bob", "bobspassword"));
|
||||
assertThatExceptionOfType(AccessDeniedException.class).isThrownBy(this.sessionRegistry::getAllPrincipals);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -35,7 +35,7 @@ public class PythonInterpreterBasedSecurityTests {
|
||||
@Test
|
||||
public void serviceMethod() {
|
||||
SecurityContextHolder.getContext()
|
||||
.setAuthentication(UsernamePasswordAuthenticationToken.unauthenticated("bob", "bobspassword"));
|
||||
.setAuthentication(UsernamePasswordAuthenticationToken.unauthenticated("bob", "bobspassword"));
|
||||
|
||||
// for (int i=0; i < 1000; i++) {
|
||||
this.service.someMethod();
|
||||
|
||||
+3
-2
@@ -129,8 +129,9 @@ public class FilterChainPerformanceTests {
|
||||
StopWatch sw = new StopWatch("Scaling with nAuthorities");
|
||||
for (int user = 0; user < N_AUTHORITIES / 10; user++) {
|
||||
int nAuthorities = (user != 0) ? user * 10 : 1;
|
||||
SecurityContextHolder.getContext().setAuthentication(UsernamePasswordAuthenticationToken
|
||||
.authenticated("bob", "bobspassword", createRoles(nAuthorities)));
|
||||
SecurityContextHolder.getContext()
|
||||
.setAuthentication(UsernamePasswordAuthenticationToken.authenticated("bob", "bobspassword",
|
||||
createRoles(nAuthorities)));
|
||||
this.session.setAttribute(HttpSessionSecurityContextRepository.SPRING_SECURITY_CONTEXT_KEY,
|
||||
SecurityContextHolder.getContext());
|
||||
SecurityContextHolder.clearContext();
|
||||
|
||||
+2
-2
@@ -42,8 +42,8 @@ public class LdapServerBeanDefinitionParserTests {
|
||||
@Test
|
||||
public void apacheDirectoryServerIsStartedByDefault() {
|
||||
assertThatExceptionOfType(BeanDefinitionStoreException.class)
|
||||
.isThrownBy(() -> this.context = new ClassPathXmlApplicationContext("applicationContext-security.xml"))
|
||||
.withMessageContaining("Embedded LDAP server is not provided");
|
||||
.isThrownBy(() -> this.context = new ClassPathXmlApplicationContext("applicationContext-security.xml"))
|
||||
.withMessageContaining("Embedded LDAP server is not provided");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user