|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.springframework.richclient.security.support.DefaultApplicationSecurityManager
public class DefaultApplicationSecurityManager
Default implementation of ApplicationSecurityManager. It provides basic processing for login and logout actions and the event lifecycle.
Instances of this class should be configured with an instance of
AuthenticationManager
to be used to handle authentication
(login) requests. This would be done like this:
<bean id="securityManager" class="org.springframework.richclient.security.support.DefaultApplicationSecurityManager"> <property name="authenticationManager" ref="authenticationManager"/> </bean> <bean id="authenticationManager" class="org.acegisecurity.providers.ProviderManager"> <property name="providers"> <list> <ref bean="remoteAuthenticationProvider" /> </list> </property> </bean> <bean id="remoteAuthenticationProvider" class="org.acegisecurity.providers.rcp.RemoteAuthenticationProvider"> <property name="remoteAuthenticationManager" ref="remoteAuthenticationManager" /> </bean> <bean id="remoteAuthenticationManager" class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean"> <property name="serviceUrl"> <value>http://localhost:8080/myserver/rootContext/RemoteAuthenticationManager</value> </property> <property name="serviceInterface"> <value>org.acegisecurity.providers.rcp.RemoteAuthenticationManager</value> </property> </bean>If this is not done, then an attempt will be made to "auto-configure" by locating an appropriate authentication manager in the application context. In order, a search will be made for a bean that implements one of these classes:
Constructor Summary | |
---|---|
DefaultApplicationSecurityManager()
Default constructor. |
|
DefaultApplicationSecurityManager(boolean autoConfigure)
Constructor invoked when we are created as the default implementation by ApplicationServices. |
Method Summary | |
---|---|
void |
afterPropertiesSet()
Ensure that we have an authentication manager to work with. |
org.acegisecurity.Authentication |
doLogin(org.acegisecurity.Authentication authentication)
Process a login attempt and fire all related events. |
org.acegisecurity.Authentication |
doLogout()
Perform a logout. |
org.acegisecurity.Authentication |
getAuthentication()
Get the authentication token for the currently logged in user. |
org.acegisecurity.AuthenticationManager |
getAuthenticationManager()
Get the authentication manager in use. |
boolean |
isUserInRole(String role)
Determine if the currently authenticated user has the role provided. |
boolean |
isUserLoggedIn()
Return if a user is currently logged in, meaning that a previous call to doLogin resulted in a valid authentication request. |
protected void |
setAuthentication(org.acegisecurity.Authentication authentication)
Set the authenticaiton token. |
void |
setAuthenticationManager(org.acegisecurity.AuthenticationManager authenticationManager)
Set the authentication manager to use. |
protected boolean |
tryToWire(Class type)
Try to locate and "wire in" a suitable authentication manager. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DefaultApplicationSecurityManager()
public DefaultApplicationSecurityManager(boolean autoConfigure)
Auto-configuration consists of trying to locate an AuthenticationManager (in one of
several classes) in the application context. This auto-configuration is also
attempted after the bean is constructed by the context if the authenticationManager
property has not been set. See afterPropertiesSet()
.
autoConfigure
- pass true to perform auto-configuration
IllegalArgumentException
- If the auto-configuration failsafterPropertiesSet()
Method Detail |
---|
public void setAuthenticationManager(org.acegisecurity.AuthenticationManager authenticationManager)
setAuthenticationManager
in interface ApplicationSecurityManager
authenticationManager
- instance to use for authentication requestspublic org.acegisecurity.AuthenticationManager getAuthenticationManager()
getAuthenticationManager
in interface ApplicationSecurityManager
public org.acegisecurity.Authentication doLogin(org.acegisecurity.Authentication authentication)
AuthenticationFailedEvent
is published and the exception is
rethrown. If the authentication succeeds, then an AuthenticationEvent
is
published, followed by a LoginEvent
.
doLogin
in interface ApplicationSecurityManager
authentication
- token to use for the login attempt
AuthenticationManager.authenticate(org.acegisecurity.Authentication)
.
org.acegisecurity.AcegiSecurityException
- If the authentication attempt failsApplicationSecurityManager.doLogin(org.acegisecurity.Authentication)
public boolean isUserLoggedIn()
isUserLoggedIn
in interface ApplicationSecurityManager
public org.acegisecurity.Authentication getAuthentication()
getAuthentication
in interface ApplicationSecurityManager
protected void setAuthentication(org.acegisecurity.Authentication authentication)
authentication
- token to install as current.public boolean isUserInRole(String role)
isUserInRole
in interface ApplicationSecurityManager
role
- to check
public org.acegisecurity.Authentication doLogout()
AuthenticationEvent
followed by a LogoutEvent
.
doLogout
in interface ApplicationSecurityManager
ApplicationSecurityManager.doLogout()
public void afterPropertiesSet()
ProviderManager
,
AuthenticationProvider
, and AuthenticationManager
.
afterPropertiesSet
in interface InitializingBean
InitializingBean.afterPropertiesSet()
protected boolean tryToWire(Class type)
type
- The type of bean to look for
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |