|
|
@ -16,19 +16,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
package org.springframework.boot.web.servlet.filter;
|
|
|
|
package org.springframework.boot.web.servlet.filter;
|
|
|
|
|
|
|
|
|
|
|
|
<<<<<<< HEAD
|
|
|
|
|
|
|
|
import jakarta.servlet.DispatcherType;
|
|
|
|
import jakarta.servlet.DispatcherType;
|
|
|
|
import jakarta.servlet.FilterChain;
|
|
|
|
import jakarta.servlet.FilterChain;
|
|
|
|
import jakarta.servlet.RequestDispatcher;
|
|
|
|
import jakarta.servlet.RequestDispatcher;
|
|
|
|
=======
|
|
|
|
|
|
|
|
import java.lang.reflect.Method;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import javax.servlet.DispatcherType;
|
|
|
|
|
|
|
|
import javax.servlet.Filter;
|
|
|
|
|
|
|
|
import javax.servlet.FilterChain;
|
|
|
|
|
|
|
|
import javax.servlet.RequestDispatcher;
|
|
|
|
|
|
|
|
>>>>>>> local27x/2.7.x
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import org.junit.jupiter.api.AfterEach;
|
|
|
|
import org.junit.jupiter.api.AfterEach;
|
|
|
|
import org.junit.jupiter.api.BeforeEach;
|
|
|
|
import org.junit.jupiter.api.BeforeEach;
|
|
|
|
import org.junit.jupiter.api.Test;
|
|
|
|
import org.junit.jupiter.api.Test;
|
|
|
@ -41,7 +31,6 @@ import org.springframework.security.core.Authentication;
|
|
|
|
import org.springframework.security.core.context.SecurityContext;
|
|
|
|
import org.springframework.security.core.context.SecurityContext;
|
|
|
|
import org.springframework.security.core.context.SecurityContextHolder;
|
|
|
|
import org.springframework.security.core.context.SecurityContextHolder;
|
|
|
|
import org.springframework.security.web.access.WebInvocationPrivilegeEvaluator;
|
|
|
|
import org.springframework.security.web.access.WebInvocationPrivilegeEvaluator;
|
|
|
|
import org.springframework.util.ReflectionUtils;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import static org.assertj.core.api.Assertions.assertThat;
|
|
|
|
import static org.assertj.core.api.Assertions.assertThat;
|
|
|
|
import static org.mockito.ArgumentMatchers.any;
|
|
|
|
import static org.mockito.ArgumentMatchers.any;
|
|
|
@ -155,18 +144,4 @@ class ErrorPageSecurityFilterTests {
|
|
|
|
verify(this.privilegeEvaluator).isAllowed(eq("/dispatcher/path/error"), any());
|
|
|
|
verify(this.privilegeEvaluator).isAllowed(eq("/dispatcher/path/error"), any());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
|
|
|
void filterIsCompatibleWithServlet31() {
|
|
|
|
|
|
|
|
Method[] methods = Filter.class.getDeclaredMethods();
|
|
|
|
|
|
|
|
for (Method method : methods) {
|
|
|
|
|
|
|
|
if (method.isDefault()) {
|
|
|
|
|
|
|
|
Method securityFilterMethod = ReflectionUtils.findMethod(ErrorPageSecurityFilter.class,
|
|
|
|
|
|
|
|
method.getName(), method.getParameterTypes());
|
|
|
|
|
|
|
|
assertThat(securityFilterMethod).isNotNull();
|
|
|
|
|
|
|
|
assertThat(securityFilterMethod.getDeclaringClass()).as(method.getName())
|
|
|
|
|
|
|
|
.isEqualTo(ErrorPageSecurityFilter.class);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|