mirror of
https://github.com/spring-projects/spring-security.git
synced 2026-03-25 03:21:18 +00:00
Refactor code to remove compiler warnings
- replace setTrustResolver with setAuthorizationManagerFactory in MethodSecurityExpressionRootTests - resolve raw type warning in ExpressionBasedMessageSecurityMetadataSourceFactoryTests Closes gh-18412 Signed-off-by: Bae Jihong <dasog@naver.com>
This commit is contained in:
parent
5a694869fa
commit
bc4cc434fe
@ -27,6 +27,7 @@ import org.springframework.expression.spel.support.StandardEvaluationContext;
|
||||
import org.springframework.security.access.PermissionEvaluator;
|
||||
import org.springframework.security.access.expression.ExpressionUtils;
|
||||
import org.springframework.security.authentication.AuthenticationTrustResolver;
|
||||
import org.springframework.security.authorization.DefaultAuthorizationManagerFactory;
|
||||
import org.springframework.security.core.Authentication;
|
||||
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
@ -58,7 +59,9 @@ public class MethodSecurityExpressionRootTests {
|
||||
this.ctx = new StandardEvaluationContext();
|
||||
this.ctx.setRootObject(this.root);
|
||||
this.trustResolver = mock(AuthenticationTrustResolver.class);
|
||||
this.root.setTrustResolver(this.trustResolver);
|
||||
DefaultAuthorizationManagerFactory<MethodInvocation> authorizationManagerFactory = new DefaultAuthorizationManagerFactory<>();
|
||||
authorizationManagerFactory.setTrustResolver(this.trustResolver);
|
||||
this.root.setAuthorizationManagerFactory(authorizationManagerFactory);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@ -58,7 +58,7 @@ public class ExpressionBasedMessageSecurityMetadataSourceFactoryTests {
|
||||
|
||||
MessageSecurityMetadataSource source;
|
||||
|
||||
MessageSecurityExpressionRoot rootObject;
|
||||
MessageSecurityExpressionRoot<Object> rootObject;
|
||||
|
||||
@BeforeEach
|
||||
public void setup() {
|
||||
@ -69,7 +69,7 @@ public class ExpressionBasedMessageSecurityMetadataSourceFactoryTests {
|
||||
this.matcherToExpression.put(this.matcher2, this.expression2);
|
||||
this.source = ExpressionBasedMessageSecurityMetadataSourceFactory
|
||||
.createExpressionMessageMetadataSource(this.matcherToExpression);
|
||||
this.rootObject = new MessageSecurityExpressionRoot(this.authentication, this.message);
|
||||
this.rootObject = new MessageSecurityExpressionRoot<>(this.authentication, this.message);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user