Apply code cleanup rules to projects
Apply automated cleanup rules to add `@Override` and `@Deprecated` annotations and to fix class references used with static methods. Issue gh-8945
This commit is contained in:
+1
@@ -55,6 +55,7 @@ class MessageExpressionConfigAttribute implements ConfigAttribute, EvaluationCon
|
||||
return this.authorizeExpression;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAttribute() {
|
||||
return null;
|
||||
}
|
||||
|
||||
+3
@@ -41,6 +41,7 @@ public class MessageExpressionVoter<T> implements AccessDecisionVoter<Message<T>
|
||||
|
||||
private SecurityExpressionHandler<Message<T>> expressionHandler = new DefaultMessageSecurityExpressionHandler<>();
|
||||
|
||||
@Override
|
||||
public int vote(Authentication authentication, Message<T> message, Collection<ConfigAttribute> attributes) {
|
||||
assert authentication != null;
|
||||
assert message != null;
|
||||
@@ -67,10 +68,12 @@ public class MessageExpressionVoter<T> implements AccessDecisionVoter<Message<T>
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supports(ConfigAttribute attribute) {
|
||||
return attribute instanceof MessageExpressionConfigAttribute;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supports(Class<?> clazz) {
|
||||
return Message.class.isAssignableFrom(clazz);
|
||||
}
|
||||
|
||||
+6
@@ -64,6 +64,7 @@ public final class ChannelSecurityInterceptor extends AbstractSecurityIntercepto
|
||||
return this.metadataSource;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Message<?> preSend(Message<?> message, MessageChannel channel) {
|
||||
InterceptorStatusToken token = beforeInvocation(message);
|
||||
if (token != null) {
|
||||
@@ -72,24 +73,29 @@ public final class ChannelSecurityInterceptor extends AbstractSecurityIntercepto
|
||||
return message;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postSend(Message<?> message, MessageChannel channel, boolean sent) {
|
||||
InterceptorStatusToken token = clearToken();
|
||||
afterInvocation(token, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterSendCompletion(Message<?> message, MessageChannel channel, boolean sent, Exception ex) {
|
||||
InterceptorStatusToken token = clearToken();
|
||||
finallyInvocation(token);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean preReceive(MessageChannel channel) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Message<?> postReceive(Message<?> message, MessageChannel channel) {
|
||||
return message;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterReceiveCompletion(Message<?> message, MessageChannel channel, Exception ex) {
|
||||
}
|
||||
|
||||
|
||||
+3
@@ -49,6 +49,7 @@ public final class DefaultMessageSecurityMetadataSource implements MessageSecuri
|
||||
this.messageMap = messageMap;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
public Collection<ConfigAttribute> getAttributes(Object object) throws IllegalArgumentException {
|
||||
final Message message = (Message) object;
|
||||
@@ -60,6 +61,7 @@ public final class DefaultMessageSecurityMetadataSource implements MessageSecuri
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<ConfigAttribute> getAllConfigAttributes() {
|
||||
Set<ConfigAttribute> allAttributes = new HashSet<>();
|
||||
|
||||
@@ -70,6 +72,7 @@ public final class DefaultMessageSecurityMetadataSource implements MessageSecuri
|
||||
return allAttributes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supports(Class<?> clazz) {
|
||||
return Message.class.isAssignableFrom(clazz);
|
||||
}
|
||||
|
||||
+2
@@ -92,6 +92,7 @@ public final class AuthenticationPrincipalArgumentResolver implements HandlerMet
|
||||
* org.springframework.messaging.handler.invocation.HandlerMethodArgumentResolver#
|
||||
* supportsParameter(org.springframework.core.MethodParameter)
|
||||
*/
|
||||
@Override
|
||||
public boolean supportsParameter(MethodParameter parameter) {
|
||||
return findMethodAnnotation(AuthenticationPrincipal.class, parameter) != null;
|
||||
}
|
||||
@@ -104,6 +105,7 @@ public final class AuthenticationPrincipalArgumentResolver implements HandlerMet
|
||||
* resolveArgument(org.springframework.core.MethodParameter,
|
||||
* org.springframework.messaging.Message)
|
||||
*/
|
||||
@Override
|
||||
public Object resolveArgument(MethodParameter parameter, Message<?> message) {
|
||||
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
|
||||
if (authentication == null) {
|
||||
|
||||
+2
@@ -96,11 +96,13 @@ public final class SecurityContextChannelInterceptor extends ChannelInterceptorA
|
||||
cleanup();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Message<?> beforeHandle(Message<?> message, MessageChannel channel, MessageHandler handler) {
|
||||
setup(message);
|
||||
return message;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterMessageHandled(Message<?> message, MessageChannel channel, MessageHandler handler, Exception ex) {
|
||||
cleanup();
|
||||
}
|
||||
|
||||
+1
@@ -122,6 +122,7 @@ public class AuthenticationPrincipalArgumentResolver implements HandlerMethodArg
|
||||
return findMethodAnnotation(AuthenticationPrincipal.class, parameter) != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mono<Object> resolveArgument(MethodParameter parameter, Message<?> message) {
|
||||
ReactiveAdapter adapter = this.adapterRegistry.getAdapter(parameter.getParameterType());
|
||||
return ReactiveSecurityContextHolder.getContext().map(SecurityContext::getAuthentication).flatMap(a -> {
|
||||
|
||||
+1
@@ -121,6 +121,7 @@ public class CurrentSecurityContextArgumentResolver implements HandlerMethodArgu
|
||||
return findMethodAnnotation(CurrentSecurityContext.class, parameter) != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mono<Object> resolveArgument(MethodParameter parameter, Message<?> message) {
|
||||
ReactiveAdapter adapter = this.adapterRegistry.getAdapter(parameter.getParameterType());
|
||||
return ReactiveSecurityContextHolder.getContext().flatMap(securityContext -> {
|
||||
|
||||
+1
@@ -45,6 +45,7 @@ public final class AndMessageMatcher<T> extends AbstractMessageMatcherComposite<
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(Message<? extends T> message) {
|
||||
for (MessageMatcher<T> matcher : getMessageMatchers()) {
|
||||
if (this.LOGGER.isDebugEnabled()) {
|
||||
|
||||
+1
@@ -45,6 +45,7 @@ public final class OrMessageMatcher<T> extends AbstractMessageMatcherComposite<T
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(Message<? extends T> message) {
|
||||
for (MessageMatcher<T> matcher : getMessageMatchers()) {
|
||||
if (this.LOGGER.isDebugEnabled()) {
|
||||
|
||||
+1
@@ -116,6 +116,7 @@ public final class SimpDestinationMessageMatcher implements MessageMatcher<Objec
|
||||
this.pattern = pattern;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(Message<?> message) {
|
||||
if (!this.messageTypeMatcher.matches(message)) {
|
||||
return false;
|
||||
|
||||
+2
@@ -36,6 +36,7 @@ import org.springframework.web.socket.server.HandshakeInterceptor;
|
||||
*/
|
||||
public final class CsrfTokenHandshakeInterceptor implements HandshakeInterceptor {
|
||||
|
||||
@Override
|
||||
public boolean beforeHandshake(ServerHttpRequest request, ServerHttpResponse response, WebSocketHandler wsHandler,
|
||||
Map<String, Object> attributes) {
|
||||
HttpServletRequest httpRequest = ((ServletServerHttpRequest) request).getServletRequest();
|
||||
@@ -47,6 +48,7 @@ public final class CsrfTokenHandshakeInterceptor implements HandshakeInterceptor
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterHandshake(ServerHttpRequest request, ServerHttpResponse response, WebSocketHandler wsHandler,
|
||||
Exception exception) {
|
||||
}
|
||||
|
||||
+1
-1
@@ -56,7 +56,7 @@ public class AndMessageMatcherTests {
|
||||
@SuppressWarnings("unchecked")
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void constructorEmptyArray() {
|
||||
new AndMessageMatcher<>((MessageMatcher<Object>[]) new MessageMatcher[0]);
|
||||
new AndMessageMatcher<>(new MessageMatcher[0]);
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
|
||||
+1
-1
@@ -56,7 +56,7 @@ public class OrMessageMatcherTests {
|
||||
@SuppressWarnings("unchecked")
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void constructorEmptyArray() {
|
||||
new OrMessageMatcher<>((MessageMatcher<Object>[]) new MessageMatcher[0]);
|
||||
new OrMessageMatcher<>(new MessageMatcher[0]);
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
|
||||
Reference in New Issue
Block a user