use of org.springframework.security.authentication.TestAuthentication in project spring-security by spring-projects.
the class SecuredAuthorizationManagerTests method checkSecuredUserOrAdminWhenRoleUserThenGrantedDecision.
@Test
public void checkSecuredUserOrAdminWhenRoleUserThenGrantedDecision() throws Exception {
MockMethodInvocation methodInvocation = new MockMethodInvocation(new TestClass(), TestClass.class, "securedUserOrAdmin");
SecuredAuthorizationManager manager = new SecuredAuthorizationManager();
AuthorizationDecision decision = manager.check(TestAuthentication::authenticatedUser, methodInvocation);
assertThat(decision).isNotNull();
assertThat(decision.isGranted()).isTrue();
}
Aggregations