Apply Checkstyle WhitespaceAfterCheck module
This commit is contained in:
+2
-2
@@ -62,7 +62,7 @@ public class DefaultLoginPageGeneratingFilter extends GenericFilterBean {
|
||||
private String openIDusernameParameter;
|
||||
private String openIDrememberMeParameter;
|
||||
private Map<String, String> oauth2AuthenticationUrlToClientName;
|
||||
private Function<HttpServletRequest,Map<String,String>> resolveHiddenInputs = request -> Collections
|
||||
private Function<HttpServletRequest, Map<String, String>> resolveHiddenInputs = request -> Collections
|
||||
.emptyMap();
|
||||
|
||||
|
||||
@@ -298,7 +298,7 @@ public class DefaultLoginPageGeneratingFilter extends GenericFilterBean {
|
||||
}
|
||||
|
||||
private void renderHiddenInputs(StringBuilder sb, HttpServletRequest request) {
|
||||
for(Map.Entry<String,String> input : this.resolveHiddenInputs.apply(request).entrySet()) {
|
||||
for(Map.Entry<String, String> input : this.resolveHiddenInputs.apply(request).entrySet()) {
|
||||
sb.append(" <input name=\"" + input.getKey()
|
||||
+ "\" type=\"hidden\" value=\"" + input.getValue() + "\" />\n");
|
||||
}
|
||||
|
||||
+1
-1
@@ -32,7 +32,7 @@ import org.springframework.web.server.ServerWebExchange;
|
||||
* @author Rob Winch
|
||||
* @since 5.0
|
||||
*/
|
||||
public class ServerFormLoginAuthenticationConverter implements Function<ServerWebExchange,Mono<Authentication>> {
|
||||
public class ServerFormLoginAuthenticationConverter implements Function<ServerWebExchange, Mono<Authentication>> {
|
||||
|
||||
private String usernameParameter = "username";
|
||||
|
||||
|
||||
+1
-1
@@ -31,7 +31,7 @@ import reactor.core.publisher.Mono;
|
||||
* @author Rob Winch
|
||||
* @since 5.0
|
||||
*/
|
||||
public class ServerHttpBasicAuthenticationConverter implements Function<ServerWebExchange,Mono<Authentication>> {
|
||||
public class ServerHttpBasicAuthenticationConverter implements Function<ServerWebExchange, Mono<Authentication>> {
|
||||
|
||||
public static final String BASIC = "Basic ";
|
||||
|
||||
|
||||
+2
-2
@@ -46,7 +46,7 @@ public class AuthenticationWebFilter implements WebFilter {
|
||||
|
||||
private ServerAuthenticationSuccessHandler authenticationSuccessHandler = new WebFilterChainServerAuthenticationSuccessHandler();
|
||||
|
||||
private Function<ServerWebExchange,Mono<Authentication>> authenticationConverter = new ServerHttpBasicAuthenticationConverter();
|
||||
private Function<ServerWebExchange, Mono<Authentication>> authenticationConverter = new ServerHttpBasicAuthenticationConverter();
|
||||
|
||||
private ServerAuthenticationFailureHandler authenticationFailureHandler = new ServerAuthenticationEntryPointFailureHandler(new HttpBasicServerAuthenticationEntryPoint());
|
||||
|
||||
@@ -97,7 +97,7 @@ public class AuthenticationWebFilter implements WebFilter {
|
||||
this.authenticationSuccessHandler = authenticationSuccessHandler;
|
||||
}
|
||||
|
||||
public void setAuthenticationConverter(Function<ServerWebExchange,Mono<Authentication>> authenticationConverter) {
|
||||
public void setAuthenticationConverter(Function<ServerWebExchange, Mono<Authentication>> authenticationConverter) {
|
||||
this.authenticationConverter = authenticationConverter;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -57,7 +57,7 @@ public class LogoutWebFilter implements WebFilter {
|
||||
.map(result -> exchange)
|
||||
.flatMap(this::flatMapAuthentication)
|
||||
.flatMap( authentication -> {
|
||||
WebFilterExchange webFilterExchange = new WebFilterExchange(exchange,chain);
|
||||
WebFilterExchange webFilterExchange = new WebFilterExchange(exchange, chain);
|
||||
return logout(webFilterExchange, authentication);
|
||||
});
|
||||
}
|
||||
|
||||
+3
-3
@@ -27,13 +27,13 @@ import java.util.Map;
|
||||
*/
|
||||
public class AuthorizationContext {
|
||||
private final ServerWebExchange exchange;
|
||||
private final Map<String,Object> variables;
|
||||
private final Map<String, Object> variables;
|
||||
|
||||
public AuthorizationContext(ServerWebExchange exchange) {
|
||||
this(exchange, Collections.emptyMap());
|
||||
}
|
||||
|
||||
public AuthorizationContext(ServerWebExchange exchange, Map<String,Object> variables) {
|
||||
public AuthorizationContext(ServerWebExchange exchange, Map<String, Object> variables) {
|
||||
this.exchange = exchange;
|
||||
this.variables = variables;
|
||||
}
|
||||
@@ -42,7 +42,7 @@ public class AuthorizationContext {
|
||||
return exchange;
|
||||
}
|
||||
|
||||
public Map<String,Object> getVariables() {
|
||||
public Map<String, Object> getVariables() {
|
||||
return Collections.unmodifiableMap(variables);
|
||||
}
|
||||
}
|
||||
|
||||
+4
-4
@@ -64,14 +64,14 @@ public class WebSessionServerCsrfTokenRepository
|
||||
.flatMap( attrs -> save(attrs, token));
|
||||
}
|
||||
|
||||
private Mono<CsrfToken> save(Map<String,Object> attributes, CsrfToken token) {
|
||||
private Mono<CsrfToken> save(Map<String, Object> attributes, CsrfToken token) {
|
||||
return Mono.defer(() -> {
|
||||
putToken(attributes, token);
|
||||
return Mono.justOrEmpty(token);
|
||||
});
|
||||
}
|
||||
|
||||
private void putToken(Map<String,Object> attributes, CsrfToken token) {
|
||||
private void putToken(Map<String, Object> attributes, CsrfToken token) {
|
||||
if(token == null) {
|
||||
attributes.remove(this.sessionAttributeName);
|
||||
} else {
|
||||
@@ -118,7 +118,7 @@ public class WebSessionServerCsrfTokenRepository
|
||||
}
|
||||
|
||||
|
||||
private CsrfToken createCsrfToken(Map<String,Object> attributes) {
|
||||
private CsrfToken createCsrfToken(Map<String, Object> attributes) {
|
||||
return new LazyCsrfToken(attributes, createCsrfToken());
|
||||
}
|
||||
|
||||
@@ -131,7 +131,7 @@ public class WebSessionServerCsrfTokenRepository
|
||||
}
|
||||
|
||||
private class LazyCsrfToken implements CsrfToken {
|
||||
private final Map<String,Object> attributes;
|
||||
private final Map<String, Object> attributes;
|
||||
private final CsrfToken delegate;
|
||||
|
||||
private LazyCsrfToken(Map<String, Object> attributes, CsrfToken delegate) {
|
||||
|
||||
+2
-2
@@ -68,8 +68,8 @@ public final class PathPatternParserServerWebExchangeMatcher implements ServerWe
|
||||
if(!match) {
|
||||
return MatchResult.notMatch();
|
||||
}
|
||||
Map<String,String> pathVariables = this.pattern.matchAndExtract(path).getUriVariables();
|
||||
Map<String,Object> variables = new HashMap<>(pathVariables);
|
||||
Map<String, String> pathVariables = this.pattern.matchAndExtract(path).getUriVariables();
|
||||
Map<String, Object> variables = new HashMap<>(pathVariables);
|
||||
return MatchResult.match(variables);
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -32,7 +32,7 @@ public interface ServerWebExchangeMatcher {
|
||||
|
||||
class MatchResult {
|
||||
private final boolean match;
|
||||
private final Map<String,Object> variables;
|
||||
private final Map<String, Object> variables;
|
||||
|
||||
private MatchResult(boolean match, Map<String, Object> variables) {
|
||||
this.match = match;
|
||||
@@ -43,7 +43,7 @@ public interface ServerWebExchangeMatcher {
|
||||
return match;
|
||||
}
|
||||
|
||||
public Map<String,Object> getVariables() {
|
||||
public Map<String, Object> getVariables() {
|
||||
return variables;
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ public interface ServerWebExchangeMatcher {
|
||||
return match(Collections.emptyMap());
|
||||
}
|
||||
|
||||
public static Mono<MatchResult> match(Map<String,Object> variables) {
|
||||
public static Mono<MatchResult> match(Map<String, Object> variables) {
|
||||
return Mono.just(new MatchResult(true, variables));
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -90,7 +90,7 @@ public class DigestAuthUtilsTests {
|
||||
public void testSplitNormalOperation() {
|
||||
String unsplit = "username=\"rod==\"";
|
||||
assertThat(DigestAuthUtils.split(unsplit, "=")[0]).isEqualTo("username");
|
||||
assertThat(DigestAuthUtils.split(unsplit, "=")[1]).isEqualTo("\"rod==\"");// should
|
||||
assertThat(DigestAuthUtils.split(unsplit, "=")[1]).isEqualTo("\"rod==\""); // should
|
||||
// not
|
||||
// remove
|
||||
// quotes
|
||||
|
||||
+1
-1
@@ -84,7 +84,7 @@ public class SavedCookieMixinTests extends AbstractMixinTests {
|
||||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
public void deserializeSavedCookieWithList() throws IOException, JSONException {
|
||||
List<SavedCookie> savedCookies = (List<SavedCookie>)mapper.readValue(COOKIES_JSON, Object.class);
|
||||
List<SavedCookie> savedCookies = (List<SavedCookie>) mapper.readValue(COOKIES_JSON, Object.class);
|
||||
assertThat(savedCookies).isNotNull().hasSize(1);
|
||||
assertThat(savedCookies.get(0).getName()).isEqualTo("SESSION");
|
||||
assertThat(savedCookies.get(0).getValue()).isEqualTo("123456789");
|
||||
|
||||
+1
-1
@@ -39,7 +39,7 @@ public class ServerFormLoginAuthenticationConverterTests {
|
||||
@Mock
|
||||
private ServerWebExchange exchange;
|
||||
|
||||
private MultiValueMap<String,String> data = new LinkedMultiValueMap<>();
|
||||
private MultiValueMap<String, String> data = new LinkedMultiValueMap<>();
|
||||
|
||||
private ServerFormLoginAuthenticationConverter converter = new ServerFormLoginAuthenticationConverter();
|
||||
|
||||
|
||||
+5
-5
@@ -56,7 +56,7 @@ public class AuthenticationWebFilterTests {
|
||||
@Mock
|
||||
private ServerAuthenticationSuccessHandler successHandler;
|
||||
@Mock
|
||||
private Function<ServerWebExchange,Mono<Authentication>> authenticationConverter;
|
||||
private Function<ServerWebExchange, Mono<Authentication>> authenticationConverter;
|
||||
@Mock
|
||||
private ReactiveAuthenticationManager authenticationManager;
|
||||
@Mock
|
||||
@@ -96,7 +96,7 @@ public class AuthenticationWebFilterTests {
|
||||
|
||||
@Test
|
||||
public void filterWhenDefaultsAndAuthenticationSuccessThenContinues() {
|
||||
when(this.authenticationManager.authenticate(any())).thenReturn(Mono.just(new TestingAuthenticationToken("test","this", "ROLE")));
|
||||
when(this.authenticationManager.authenticate(any())).thenReturn(Mono.just(new TestingAuthenticationToken("test", "this", "ROLE")));
|
||||
this.filter = new AuthenticationWebFilter(this.authenticationManager);
|
||||
|
||||
WebTestClient client = WebTestClientBuilder
|
||||
@@ -185,7 +185,7 @@ public class AuthenticationWebFilterTests {
|
||||
when(this.authenticationConverter.apply(any())).thenReturn(authentication);
|
||||
when(this.authenticationManager.authenticate(any())).thenReturn(authentication);
|
||||
when(this.successHandler.onAuthenticationSuccess(any(), any())).thenReturn(Mono.empty());
|
||||
when(this.securityContextRepository.save(any(),any())).thenAnswer( a -> Mono.just(a.getArguments()[0]));
|
||||
when(this.securityContextRepository.save(any(), any())).thenAnswer( a -> Mono.just(a.getArguments()[0]));
|
||||
|
||||
WebTestClient client = WebTestClientBuilder
|
||||
.bindToWebFilters(this.filter)
|
||||
@@ -231,7 +231,7 @@ public class AuthenticationWebFilterTests {
|
||||
Mono<Authentication> authentication = Mono.just(new TestingAuthenticationToken("test", "this", "ROLE_USER"));
|
||||
when(this.authenticationConverter.apply(any())).thenReturn(authentication);
|
||||
when(this.authenticationManager.authenticate(any())).thenReturn(Mono.error(new BadCredentialsException("Failed")));
|
||||
when(this.failureHandler.onAuthenticationFailure(any(),any())).thenReturn(Mono.empty());
|
||||
when(this.failureHandler.onAuthenticationFailure(any(), any())).thenReturn(Mono.empty());
|
||||
|
||||
WebTestClient client = WebTestClientBuilder
|
||||
.bindToWebFilters(this.filter)
|
||||
@@ -244,7 +244,7 @@ public class AuthenticationWebFilterTests {
|
||||
.expectStatus().isOk()
|
||||
.expectBody().isEmpty();
|
||||
|
||||
verify(this.failureHandler).onAuthenticationFailure(any(),any());
|
||||
verify(this.failureHandler).onAuthenticationFailure(any(), any());
|
||||
verify(this.securityContextRepository, never()).save(any(), any());
|
||||
verifyZeroInteractions(this.successHandler);
|
||||
}
|
||||
|
||||
+7
-7
@@ -50,7 +50,7 @@ public class AuthorizationWebFilterTests {
|
||||
@Test
|
||||
public void filterWhenNoSecurityContextThenThrowsAccessDenied() {
|
||||
when(this.chain.filter(this.exchange)).thenReturn(this.chainResult.mono());
|
||||
AuthorizationWebFilter filter = new AuthorizationWebFilter((a,e) -> Mono.error(new AccessDeniedException("Denied")));
|
||||
AuthorizationWebFilter filter = new AuthorizationWebFilter((a, e) -> Mono.error(new AccessDeniedException("Denied")));
|
||||
|
||||
Mono<Void> result = filter.filter(this.exchange, this.chain);
|
||||
|
||||
@@ -63,7 +63,7 @@ public class AuthorizationWebFilterTests {
|
||||
@Test
|
||||
public void filterWhenNoAuthenticationThenThrowsAccessDenied() {
|
||||
when(this.chain.filter(this.exchange)).thenReturn(this.chainResult.mono());
|
||||
AuthorizationWebFilter filter = new AuthorizationWebFilter((a,e) -> Mono.error(new AccessDeniedException("Denied")));
|
||||
AuthorizationWebFilter filter = new AuthorizationWebFilter((a, e) -> Mono.error(new AccessDeniedException("Denied")));
|
||||
|
||||
Mono<Void> result = filter
|
||||
.filter(this.exchange, this.chain)
|
||||
@@ -78,11 +78,11 @@ public class AuthorizationWebFilterTests {
|
||||
@Test
|
||||
public void filterWhenAuthenticationThenThrowsAccessDenied() {
|
||||
when(this.chain.filter(this.exchange)).thenReturn(this.chainResult.mono());
|
||||
AuthorizationWebFilter filter = new AuthorizationWebFilter((a,e) -> Mono.error(new AccessDeniedException("Denied")));
|
||||
AuthorizationWebFilter filter = new AuthorizationWebFilter((a, e) -> Mono.error(new AccessDeniedException("Denied")));
|
||||
|
||||
Mono<Void> result = filter
|
||||
.filter(this.exchange, this.chain)
|
||||
.subscriberContext(ReactiveSecurityContextHolder.withAuthentication(new TestingAuthenticationToken("a","b", "R")));
|
||||
.subscriberContext(ReactiveSecurityContextHolder.withAuthentication(new TestingAuthenticationToken("a", "b", "R")));
|
||||
|
||||
StepVerifier.create(result)
|
||||
.expectError(AccessDeniedException.class)
|
||||
@@ -94,7 +94,7 @@ public class AuthorizationWebFilterTests {
|
||||
public void filterWhenDoesNotAccessAuthenticationThenSecurityContextNotSubscribed() {
|
||||
PublisherProbe<SecurityContext> context = PublisherProbe.empty();
|
||||
when(this.chain.filter(this.exchange)).thenReturn(this.chainResult.mono());
|
||||
AuthorizationWebFilter filter = new AuthorizationWebFilter((a,e) -> Mono.error(new AccessDeniedException("Denied")));
|
||||
AuthorizationWebFilter filter = new AuthorizationWebFilter((a, e) -> Mono.error(new AccessDeniedException("Denied")));
|
||||
|
||||
Mono<Void> result = filter
|
||||
.filter(this.exchange, this.chain)
|
||||
@@ -111,7 +111,7 @@ public class AuthorizationWebFilterTests {
|
||||
public void filterWhenGrantedAndDoesNotAccessAuthenticationThenChainSubscribedAndSecurityContextNotSubscribed() {
|
||||
PublisherProbe<SecurityContext> context = PublisherProbe.empty();
|
||||
when(this.chain.filter(this.exchange)).thenReturn(this.chainResult.mono());
|
||||
AuthorizationWebFilter filter = new AuthorizationWebFilter((a,e) -> Mono.just(new AuthorizationDecision(true)));
|
||||
AuthorizationWebFilter filter = new AuthorizationWebFilter((a, e) -> Mono.just(new AuthorizationDecision(true)));
|
||||
|
||||
Mono<Void> result = filter
|
||||
.filter(this.exchange, this.chain)
|
||||
@@ -127,7 +127,7 @@ public class AuthorizationWebFilterTests {
|
||||
public void filterWhenGrantedAndDoeAccessAuthenticationThenChainSubscribedAndSecurityContextSubscribed() {
|
||||
PublisherProbe<SecurityContext> context = PublisherProbe.empty();
|
||||
when(this.chain.filter(this.exchange)).thenReturn(this.chainResult.mono());
|
||||
AuthorizationWebFilter filter = new AuthorizationWebFilter((a,e) -> a
|
||||
AuthorizationWebFilter filter = new AuthorizationWebFilter((a, e) -> a
|
||||
.map( auth -> new AuthorizationDecision(true))
|
||||
.defaultIfEmpty(new AuthorizationDecision(true))
|
||||
);
|
||||
|
||||
+2
-2
@@ -74,7 +74,7 @@ public class ReactorContextWebFilterTests {
|
||||
|
||||
@Test
|
||||
public void filterWhenGetPrincipalMonoThenNoInteractions() {
|
||||
this.handler = WebTestHandler.bindToWebFilters(this.filter, (e,c) -> {
|
||||
this.handler = WebTestHandler.bindToWebFilters(this.filter, (e, c) -> {
|
||||
ReactiveSecurityContextHolder.getContext();
|
||||
return c.filter(e);
|
||||
});
|
||||
@@ -88,7 +88,7 @@ public class ReactorContextWebFilterTests {
|
||||
public void filterWhenPrincipalAndGetPrincipalThenInteractAndUseOriginalPrincipal() {
|
||||
SecurityContextImpl context = new SecurityContextImpl(this.principal);
|
||||
when(this.repository.load(any())).thenReturn(Mono.just(context));
|
||||
this.handler = WebTestHandler.bindToWebFilters(this.filter, (e,c) ->
|
||||
this.handler = WebTestHandler.bindToWebFilters(this.filter, (e, c) ->
|
||||
ReactiveSecurityContextHolder.getContext()
|
||||
.map(SecurityContext::getAuthentication)
|
||||
.doOnSuccess( p -> assertThat(p).isSameAs(this.principal))
|
||||
|
||||
+2
-2
@@ -36,7 +36,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
public class SecurityContextServerWebExchangeWebFilterTests {
|
||||
SecurityContextServerWebExchangeWebFilter filter = new SecurityContextServerWebExchangeWebFilter();
|
||||
|
||||
Authentication principal = new TestingAuthenticationToken("user","password", "ROLE_USER");
|
||||
Authentication principal = new TestingAuthenticationToken("user", "password", "ROLE_USER");
|
||||
|
||||
ServerWebExchange exchange = MockServerWebExchange.from(MockServerHttpRequest.get("/").build());
|
||||
|
||||
@@ -73,7 +73,7 @@ public class SecurityContextServerWebExchangeWebFilterTests {
|
||||
|
||||
@Test
|
||||
public void filterWhenPrincipalNullThenContextEmpty() {
|
||||
Authentication defaultAuthentication = new TestingAuthenticationToken("anonymouse","anonymous", "TEST");
|
||||
Authentication defaultAuthentication = new TestingAuthenticationToken("anonymouse", "anonymous", "TEST");
|
||||
Mono<Void> result = this.filter.filter(this.exchange, new DefaultWebFilterChain( e ->
|
||||
e.getPrincipal()
|
||||
.defaultIfEmpty(defaultAuthentication)
|
||||
|
||||
+7
-7
@@ -94,9 +94,9 @@ public class OnCommittedResponseWrapperTests {
|
||||
int off = 2;
|
||||
int len = 3;
|
||||
|
||||
response.getWriter().write(buff,off,len);
|
||||
response.getWriter().write(buff, off, len);
|
||||
|
||||
verify(writer).write(buff,off,len);
|
||||
verify(writer).write(buff, off, len);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -114,9 +114,9 @@ public class OnCommittedResponseWrapperTests {
|
||||
int off = 2;
|
||||
int len = 3;
|
||||
|
||||
response.getWriter().write(s,off,len);
|
||||
response.getWriter().write(s, off, len);
|
||||
|
||||
verify(writer).write(s,off,len);
|
||||
verify(writer).write(s, off, len);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -602,7 +602,7 @@ public class OnCommittedResponseWrapperTests {
|
||||
int len = 3;
|
||||
response.setContentLength(3);
|
||||
|
||||
response.getWriter().write(buff,off,len);
|
||||
response.getWriter().write(buff, off, len);
|
||||
|
||||
assertThat(committed).isTrue();
|
||||
}
|
||||
@@ -624,7 +624,7 @@ public class OnCommittedResponseWrapperTests {
|
||||
int len = 3;
|
||||
response.setContentLength(3);
|
||||
|
||||
response.getWriter().write(s,off,len);
|
||||
response.getWriter().write(s, off, len);
|
||||
|
||||
assertThat(committed).isTrue();
|
||||
}
|
||||
@@ -1104,7 +1104,7 @@ public class OnCommittedResponseWrapperTests {
|
||||
@Test
|
||||
public void addHeaderContentLengthPrintWriterWriteStringCommits() throws Exception {
|
||||
int expected = 1234;
|
||||
response.addHeader("Content-Length",String.valueOf(String.valueOf(expected).length()));
|
||||
response.addHeader("Content-Length", String.valueOf(String.valueOf(expected).length()));
|
||||
|
||||
response.getWriter().write(expected);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user