mirror of
https://github.com/spring-projects/spring-security.git
synced 2025-07-07 11:12:14 +00:00
Added some uses of Spring Assert class and removed one to prevent unnecessary StringBuffer creation.
This commit is contained in:
parent
84ccd89061
commit
4b4d4d3332
@ -210,30 +210,24 @@ public abstract class AbstractSecurityInterceptor implements InitializingBean,
|
|||||||
Assert.notNull(this.obtainObjectDefinitionSource(),
|
Assert.notNull(this.obtainObjectDefinitionSource(),
|
||||||
"An ObjectDefinitionSource is required");
|
"An ObjectDefinitionSource is required");
|
||||||
|
|
||||||
if (!this.obtainObjectDefinitionSource()
|
Assert.isTrue(this.obtainObjectDefinitionSource()
|
||||||
.supports(getSecureObjectClass())) {
|
.supports(getSecureObjectClass()),
|
||||||
throw new IllegalArgumentException(
|
|
||||||
"ObjectDefinitionSource does not support secure object class: "
|
"ObjectDefinitionSource does not support secure object class: "
|
||||||
+ getSecureObjectClass());
|
+ getSecureObjectClass()
|
||||||
}
|
);
|
||||||
|
|
||||||
if (!this.runAsManager.supports(getSecureObjectClass())) {
|
Assert.isTrue(this.runAsManager.supports(getSecureObjectClass()),
|
||||||
throw new IllegalArgumentException(
|
|
||||||
"RunAsManager does not support secure object class: "
|
"RunAsManager does not support secure object class: "
|
||||||
+ getSecureObjectClass());
|
+ getSecureObjectClass() );
|
||||||
}
|
|
||||||
|
|
||||||
if (!this.accessDecisionManager.supports(getSecureObjectClass())) {
|
Assert.isTrue(this.accessDecisionManager.supports(getSecureObjectClass()),
|
||||||
throw new IllegalArgumentException(
|
|
||||||
"AccessDecisionManager does not support secure object class: "
|
"AccessDecisionManager does not support secure object class: "
|
||||||
+ getSecureObjectClass());
|
+ getSecureObjectClass());
|
||||||
}
|
|
||||||
|
|
||||||
if ((this.afterInvocationManager != null)
|
if (this.afterInvocationManager != null) {
|
||||||
&& !this.afterInvocationManager.supports(getSecureObjectClass())) {
|
Assert.isTrue(this.afterInvocationManager.supports(getSecureObjectClass()),
|
||||||
throw new IllegalArgumentException(
|
"AfterInvocationManager does not support secure object class: "
|
||||||
"AfterInvocationManager does not support secure object class: "
|
+ getSecureObjectClass());
|
||||||
+ getSecureObjectClass());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.validateConfigAttributes) {
|
if (this.validateConfigAttributes) {
|
||||||
@ -281,12 +275,13 @@ public abstract class AbstractSecurityInterceptor implements InitializingBean,
|
|||||||
|
|
||||||
protected InterceptorStatusToken beforeInvocation(Object object) {
|
protected InterceptorStatusToken beforeInvocation(Object object) {
|
||||||
Assert.notNull(object, "Object was null");
|
Assert.notNull(object, "Object was null");
|
||||||
Assert.isTrue(getSecureObjectClass()
|
|
||||||
.isAssignableFrom(object.getClass()),
|
if(!getSecureObjectClass().isAssignableFrom(object.getClass())) {
|
||||||
"Security invocation attempted for object "
|
throw new IllegalArgumentException ("Security invocation attempted for object "
|
||||||
+ object.getClass().getName()
|
+ object.getClass().getName()
|
||||||
+ " but AbstractSecurityInterceptor only configured to support secure objects of type: "
|
+ " but AbstractSecurityInterceptor only configured to support secure objects of type: "
|
||||||
+ getSecureObjectClass());
|
+ getSecureObjectClass());
|
||||||
|
}
|
||||||
|
|
||||||
ConfigAttributeDefinition attr = this.obtainObjectDefinitionSource()
|
ConfigAttributeDefinition attr = this.obtainObjectDefinitionSource()
|
||||||
.getAttributes(object);
|
.getAttributes(object);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user