org.springframework.security.access.PermissionEvaluator Java Examples

The following examples show how to use org.springframework.security.access.PermissionEvaluator. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: OAuth2AutoConfigurationTests.java    From spring-security-oauth2-boot with Apache License 2.0 5 votes vote down vote up
@Test
public void methodSecurityExpressionHandlerIsConfiguredWithPermissionEvaluatorFromTheContext() {
	this.context = new AnnotationConfigServletWebServerApplicationContext();
	this.context.register(PermissionEvaluatorConfiguration.class, AuthorizationAndResourceServerConfiguration.class,
			MinimalSecureWebApplication.class);
	this.context.refresh();
	PreInvocationAuthorizationAdvice advice = this.context.getBean(PreInvocationAuthorizationAdvice.class);
	MethodSecurityExpressionHandler expressionHandler = (MethodSecurityExpressionHandler) ReflectionTestUtils
			.getField(advice, "expressionHandler");
	PermissionEvaluator permissionEvaluator = (PermissionEvaluator) ReflectionTestUtils.getField(expressionHandler,
			"permissionEvaluator");
	assertThat(permissionEvaluator).isSameAs(this.context.getBean(PermissionEvaluator.class));
}
 
Example #2
Source File: OAuth2AutoConfigurationTests.java    From spring-security-oauth2-boot with Apache License 2.0 4 votes vote down vote up
@Bean
public PermissionEvaluator permissionEvaluator() {
	return mock(PermissionEvaluator.class);
}
 
Example #3
Source File: UserPermissionEvaluatorImpl.java    From molgenis with GNU Lesser General Public License v3.0 4 votes vote down vote up
UserPermissionEvaluatorImpl(
    PermissionEvaluator permissionEvaluator, PermissionRegistry permissionRegistry) {
  this.permissionEvaluator = requireNonNull(permissionEvaluator);
  this.permissionRegistry = requireNonNull(permissionRegistry);
}
 
Example #4
Source File: MySecurityExpressionRoot.java    From tutorials with MIT License 4 votes vote down vote up
public void setPermissionEvaluator(PermissionEvaluator permissionEvaluator) {
    this.permissionEvaluator = permissionEvaluator;
}