Skip to content

Commit

Permalink
Merge branch '2.6.x' into 2.7.x
Browse files Browse the repository at this point in the history
Closes gh-29565
  • Loading branch information
philwebb committed Jan 25, 2022
2 parents 8480abc + df9cf6b commit bb02421
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,10 @@ private WebInvocationPrivilegeEvaluator getPrivilegeEvaluatorBean() {
}
}

@Override
public void destroy() {
}

/**
* {@link WebInvocationPrivilegeEvaluator} that always allows access.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@

package org.springframework.boot.web.servlet.filter;

import java.lang.reflect.Method;

import javax.servlet.DispatcherType;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.RequestDispatcher;

Expand All @@ -32,6 +35,7 @@
import org.springframework.security.core.context.SecurityContext;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.web.access.WebInvocationPrivilegeEvaluator;
import org.springframework.util.ReflectionUtils;

import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.ArgumentMatchers.any;
Expand Down Expand Up @@ -145,4 +149,18 @@ void whenThereIsAContextPathAndServletIsMappedToWildcardPathCorrectPathIsPassedT
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);
}
}
}

}

0 comments on commit bb02421

Please sign in to comment.