mirror of
https://github.com/spring-projects/spring-security.git
synced 2025-06-25 21:42:17 +00:00
Clarify in Javadoc that expressionHandler should not be null
Fixes: gh-2665
This commit is contained in:
parent
b9f122230b
commit
de7cbc82b5
@ -204,8 +204,8 @@ public final class WebSecurity extends
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the {@link WebInvocationPrivilegeEvaluator} to be used. If this is null, then a
|
* Set the {@link WebInvocationPrivilegeEvaluator} to be used. If this is not specified,
|
||||||
* {@link DefaultWebInvocationPrivilegeEvaluator} will be created when
|
* then a {@link DefaultWebInvocationPrivilegeEvaluator} will be created when
|
||||||
* {@link #securityInterceptor(FilterSecurityInterceptor)} is non null.
|
* {@link #securityInterceptor(FilterSecurityInterceptor)} is non null.
|
||||||
*
|
*
|
||||||
* @param privilegeEvaluator the {@link WebInvocationPrivilegeEvaluator} to use
|
* @param privilegeEvaluator the {@link WebInvocationPrivilegeEvaluator} to use
|
||||||
@ -218,8 +218,8 @@ public final class WebSecurity extends
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the {@link SecurityExpressionHandler} to be used. If this is null, then a
|
* Set the {@link SecurityExpressionHandler} to be used. If this is not specified,
|
||||||
* {@link DefaultWebSecurityExpressionHandler} will be used.
|
* then a {@link DefaultWebSecurityExpressionHandler} will be used.
|
||||||
*
|
*
|
||||||
* @param expressionHandler the {@link SecurityExpressionHandler} to use
|
* @param expressionHandler the {@link SecurityExpressionHandler} to use
|
||||||
* @return the {@link WebSecurity} for further customizations
|
* @return the {@link WebSecurity} for further customizations
|
||||||
|
@ -253,6 +253,25 @@ public class WebSecurityConfigurationTests {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void loadConfigWhenSecurityExpressionHandlerIsNullThenException() {
|
||||||
|
Throwable thrown = catchThrowable(() ->
|
||||||
|
this.spring.register(NullWebSecurityExpressionHandlerConfig.class).autowire()
|
||||||
|
);
|
||||||
|
|
||||||
|
assertThat(thrown).isInstanceOf(BeanCreationException.class);
|
||||||
|
assertThat(thrown).hasRootCauseExactlyInstanceOf(IllegalArgumentException.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EnableWebSecurity
|
||||||
|
static class NullWebSecurityExpressionHandlerConfig extends WebSecurityConfigurerAdapter {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void configure(WebSecurity web) {
|
||||||
|
web.expressionHandler(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void loadConfigWhenDefaultSecurityExpressionHandlerThenDefaultIsRegistered() {
|
public void loadConfigWhenDefaultSecurityExpressionHandlerThenDefaultIsRegistered() {
|
||||||
this.spring.register(WebSecurityExpressionHandlerDefaultsConfig.class).autowire();
|
this.spring.register(WebSecurityExpressionHandlerDefaultsConfig.class).autowire();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user