|
|||||||||
| Home >> All >> org >> acegisecurity >> [ intercept overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.acegisecurity.intercept
Class AbstractSecurityInterceptor

java.lang.Objectorg.acegisecurity.intercept.AbstractSecurityInterceptor
- All Implemented Interfaces:
- org.springframework.context.ApplicationEventPublisherAware, org.springframework.beans.factory.InitializingBean, org.springframework.context.MessageSourceAware
- public abstract class AbstractSecurityInterceptor
- extends java.lang.Object
- implements org.springframework.beans.factory.InitializingBean, org.springframework.context.ApplicationEventPublisherAware, org.springframework.context.MessageSourceAware
- extends java.lang.Object
Abstract class that implements security interception for secure objects.
The AbstractSecurityInterceptor will ensure the proper startup
configuration of the security interceptor. It will also implement the
proper handling of secure object invocations, being:
-
Obtain the org.acegisecurity.Authentication object from the
SecurityContextHolder. - Determine if the request relates to a secured or public invocation by looking up the secure object request against the ObjectDefinitionSource.
-
For an invocation that is secured (there is a
ConfigAttributeDefinitionfor the secure object invocation):-
If either the Authentication.isAuthenticated()>
Authentication.isAuthenticated()55 returnsfalse, or thealwaysReauthenticate55 istrue, authenticate the request against the configured org.acegisecurity.AuthenticationManager. When authenticated, replace theAuthenticationobject on theSecurityContextHolderwith the returned value. - Authorize the request against the configured org.acegisecurity.AccessDecisionManager.
- Perform any run-as replacement via the configured org.acegisecurity.RunAsManager.
-
Pass control back to the concrete subclass, which will actually proceed with
executing the object. A InterceptorStatusToken is returned so that
after the subclass has finished proceeding with execution of the object,
its finally clause can ensure the
AbstractSecurityInterceptoris re-called and tidies up correctly. -
The concrete subclass will re-call the
AbstractSecurityInterceptorvia theafterInvocation(InterceptorStatusToken, Object)55 method. -
If the
RunAsManagerreplaced theAuthenticationobject, return theSecurityContextHolderto the object that existed after the call toAuthenticationManager. -
If an
AfterInvocationManageris defined, invoke the invocation manager and allow it to replace the object due to be returned to the caller.
-
If either the Authentication.isAuthenticated()>
-
For an invocation that is public (there is no
ConfigAttributeDefinitionfor the secure object invocation):-
As described above, the concrete subclass will be returned an
InterceptorStatusTokenwhich is subsequently re-presented to theAbstractSecurityInterceptorafter the secure object has been executed. TheAbstractSecurityInterceptorwill take no further action when itsafterInvocation(InterceptorStatusToken, Object)55 is called.
-
As described above, the concrete subclass will be returned an
-
Control again returns to the concrete subclass, along with the
Objectthat should be returned to the caller. The subclass will then return that result or exception to the original caller.
| Field Summary | |
private org.acegisecurity.AccessDecisionManager |
accessDecisionManager
|
private org.acegisecurity.AfterInvocationManager |
afterInvocationManager
|
private boolean |
alwaysReauthenticate
|
private org.acegisecurity.AuthenticationManager |
authenticationManager
|
private org.springframework.context.ApplicationEventPublisher |
eventPublisher
|
protected static org.apache.commons.logging.Log |
logger
|
protected org.springframework.context.support.MessageSourceAccessor |
messages
|
private boolean |
rejectPublicInvocations
|
private org.acegisecurity.RunAsManager |
runAsManager
|
private boolean |
validateConfigAttributes
|
| Constructor Summary | |
AbstractSecurityInterceptor()
|
|
| Method Summary | |
protected java.lang.Object |
afterInvocation(InterceptorStatusToken token,
java.lang.Object returnedObject)
Completes the work of the AbstractSecurityInterceptor after
the secure object invocation has been complete |
void |
afterPropertiesSet()
Invoked by a BeanFactory after it has set all bean properties supplied (and satisfied BeanFactoryAware and ApplicationContextAware). |
protected InterceptorStatusToken |
beforeInvocation(java.lang.Object object)
|
private void |
credentialsNotFound(java.lang.String reason,
java.lang.Object secureObject,
ConfigAttributeDefinition configAttribs)
Helper method which generates an exception containing the passed reason, and publishes an event to the application context. |
org.acegisecurity.AccessDecisionManager |
getAccessDecisionManager()
|
org.acegisecurity.AfterInvocationManager |
getAfterInvocationManager()
|
org.acegisecurity.AuthenticationManager |
getAuthenticationManager()
|
org.acegisecurity.RunAsManager |
getRunAsManager()
|
abstract java.lang.Class |
getSecureObjectClass()
Indicates the type of secure objects the subclass will be presenting to the abstract parent for processing. |
boolean |
isAlwaysReauthenticate()
|
boolean |
isRejectPublicInvocations()
|
boolean |
isValidateConfigAttributes()
|
abstract ObjectDefinitionSource |
obtainObjectDefinitionSource()
|
void |
setAccessDecisionManager(org.acegisecurity.AccessDecisionManager accessDecisionManager)
|
void |
setAfterInvocationManager(org.acegisecurity.AfterInvocationManager afterInvocationManager)
|
void |
setAlwaysReauthenticate(boolean alwaysReauthenticate)
Indicates whether the AbstractSecurityInterceptor
should ignore the Authentication.isAuthenticated()>Authentication.isAuthenticated() 55
property. |
void |
setApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher eventPublisher)
Set the ApplicationEventPublisher that this object runs in. |
void |
setAuthenticationManager(org.acegisecurity.AuthenticationManager newManager)
|
void |
setMessageSource(org.springframework.context.MessageSource messageSource)
Set the MessageSource that this object runs in. |
void |
setRejectPublicInvocations(boolean rejectPublicInvocations)
By rejecting public invocations (and setting this property to true), essentially you are ensuring that every secure
object invocation advised by
AbstractSecurityInterceptor has a configuration
attribute defined. |
void |
setRunAsManager(org.acegisecurity.RunAsManager runAsManager)
|
void |
setValidateConfigAttributes(boolean validateConfigAttributes)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
logger
protected static final org.apache.commons.logging.Log logger
accessDecisionManager
private org.acegisecurity.AccessDecisionManager accessDecisionManager
afterInvocationManager
private org.acegisecurity.AfterInvocationManager afterInvocationManager
eventPublisher
private org.springframework.context.ApplicationEventPublisher eventPublisher
authenticationManager
private org.acegisecurity.AuthenticationManager authenticationManager
messages
protected org.springframework.context.support.MessageSourceAccessor messages
runAsManager
private org.acegisecurity.RunAsManager runAsManager
alwaysReauthenticate
private boolean alwaysReauthenticate
rejectPublicInvocations
private boolean rejectPublicInvocations
validateConfigAttributes
private boolean validateConfigAttributes
| Constructor Detail |
AbstractSecurityInterceptor
public AbstractSecurityInterceptor()
| Method Detail |
afterInvocation
protected java.lang.Object afterInvocation(InterceptorStatusToken token, java.lang.Object returnedObject)
- Completes the work of the
AbstractSecurityInterceptorafter the secure object invocation has been complete
afterPropertiesSet
public void afterPropertiesSet()
throws java.lang.Exception
- Description copied from interface:
org.springframework.beans.factory.InitializingBean - Invoked by a BeanFactory after it has set all bean properties supplied
(and satisfied BeanFactoryAware and ApplicationContextAware).
This method allows the bean instance to perform initialization only possible when all bean properties have been set and to throw an exception in the event of misconfiguration.
- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean
beforeInvocation
protected InterceptorStatusToken beforeInvocation(java.lang.Object object)
credentialsNotFound
private void credentialsNotFound(java.lang.String reason, java.lang.Object secureObject, ConfigAttributeDefinition configAttribs)
- Helper method which generates an exception containing the passed
reason, and publishes an event to the application context.
Always throws an exception.
getAccessDecisionManager
public org.acegisecurity.AccessDecisionManager getAccessDecisionManager()
getAfterInvocationManager
public org.acegisecurity.AfterInvocationManager getAfterInvocationManager()
getAuthenticationManager
public org.acegisecurity.AuthenticationManager getAuthenticationManager()
getRunAsManager
public org.acegisecurity.RunAsManager getRunAsManager()
getSecureObjectClass
public abstract java.lang.Class getSecureObjectClass()
- Indicates the type of secure objects the subclass will be presenting
to the abstract parent for processing. This is used to ensure
collaborators wired to the
AbstractSecurityInterceptorall support the indicated secure object class.
isAlwaysReauthenticate
public boolean isAlwaysReauthenticate()
isRejectPublicInvocations
public boolean isRejectPublicInvocations()
isValidateConfigAttributes
public boolean isValidateConfigAttributes()
obtainObjectDefinitionSource
public abstract ObjectDefinitionSource obtainObjectDefinitionSource()
setAccessDecisionManager
public void setAccessDecisionManager(org.acegisecurity.AccessDecisionManager accessDecisionManager)
setAfterInvocationManager
public void setAfterInvocationManager(org.acegisecurity.AfterInvocationManager afterInvocationManager)
setAlwaysReauthenticate
public void setAlwaysReauthenticate(boolean alwaysReauthenticate)
- Indicates whether the
AbstractSecurityInterceptorshould ignore the Authentication.isAuthenticated()>Authentication.isAuthenticated()55 property. Defaults tofalse, meaning by default theAuthentication.isAuthenticated()property is trusted and re-authentication will not occur if the principal has already been authenticated.
setApplicationEventPublisher
public void setApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher eventPublisher)
- Description copied from interface:
org.springframework.context.ApplicationEventPublisherAware - Set the ApplicationEventPublisher that this object runs in.
Invoked after population of normal bean properties but before an init callback like InitializingBean's afterPropertiesSet or a custom init-method. Invoked before ApplicationContextAware's setApplicationContext.
- Specified by:
setApplicationEventPublisherin interfaceorg.springframework.context.ApplicationEventPublisherAware
setAuthenticationManager
public void setAuthenticationManager(org.acegisecurity.AuthenticationManager newManager)
setMessageSource
public void setMessageSource(org.springframework.context.MessageSource messageSource)
- Description copied from interface:
org.springframework.context.MessageSourceAware - Set the MessageSource that this object runs in.
Invoked after population of normal bean properties but before an init callback like InitializingBean's afterPropertiesSet or a custom init-method. Invoked before ApplicationContextAware's setApplicationContext.
- Specified by:
setMessageSourcein interfaceorg.springframework.context.MessageSourceAware
setRejectPublicInvocations
public void setRejectPublicInvocations(boolean rejectPublicInvocations)
- By rejecting public invocations (and setting this property to
true), essentially you are ensuring that every secure object invocation advised byAbstractSecurityInterceptorhas a configuration attribute defined. This is useful to ensure a "fail safe" mode where undeclared secure objects will be rejected and configuration omissions detected early. AnIllegalArgumentExceptionwill be thrown by theAbstractSecurityInterceptorif you set this property totrueand an attempt is made to invoke a secure object that has no configuration attributes.
setRunAsManager
public void setRunAsManager(org.acegisecurity.RunAsManager runAsManager)
setValidateConfigAttributes
public void setValidateConfigAttributes(boolean validateConfigAttributes)
|
|||||||||
| Home >> All >> org >> acegisecurity >> [ intercept overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
org.acegisecurity.intercept.AbstractSecurityInterceptor