Make MethodSecurityEvaluationContext Delegate to MethodBasedEvaluationContext
Spring Security's MethodSecurityEvaluationContext should delegate to Spring Framework's MethodBasedEvaluationContext Fixes: gh-6224
This commit is contained in:
committed by
Eleftheria Stein
parent
96d82ecbf2
commit
150b66824d
+9
-4
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
* Copyright 2002-2020 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -35,9 +35,7 @@ import org.springframework.security.core.context.SecurityContextHolder;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.Mockito.doReturn;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.*;
|
||||
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
public class DefaultMethodSecurityExpressionHandlerTests {
|
||||
@@ -53,6 +51,8 @@ public class DefaultMethodSecurityExpressionHandlerTests {
|
||||
@Before
|
||||
public void setup() {
|
||||
handler = new DefaultMethodSecurityExpressionHandler();
|
||||
when(methodInvocation.getThis()).thenReturn(new Foo());
|
||||
when(methodInvocation.getMethod()).thenReturn(Foo.class.getMethods()[0]);
|
||||
}
|
||||
|
||||
@After
|
||||
@@ -108,4 +108,9 @@ public class DefaultMethodSecurityExpressionHandlerTests {
|
||||
((Stream) handler.filter(upstream, expression, context)).close();
|
||||
verify(upstream).close();
|
||||
}
|
||||
|
||||
private static class Foo {
|
||||
public void bar(){
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user