public class SpringSecurityManager extends Object implements SecurityManager
SecurityManager
interface. The Spring
security configurations are loaded using the FileSystemXmlApplicationContext
taking the
context definition files from the file system or from URLs. The location of the configuration
file is set using the spring-security-config-location
property; if not set, a
default security-config.xml
is considered (if present). A common GigaSpaces
security configuration: ([Gigaspaces root]/config/security/security.properties)
com.gs.security.security-manager.class = com.gigaspaces.security.spring.SpringSecurityManager
spring-security-config-location = ../config/security/security-config.xml
Modifier and Type | Field and Description |
---|---|
static String |
SPRING_SECURITY_CONFIG_LOCATION
The security-config xml file location to create a new
FileSystemXmlApplicationContext
from |
SECURITY_MANAGER_CLASS_PROPERTY_KEY
Constructor and Description |
---|
SpringSecurityManager() |
Modifier and Type | Method and Description |
---|---|
Authentication |
authenticate(UserDetails userDetails)
Attempts to authenticate the passed
UserDetails object, returning a fully populated
Authentication object (including granted authorities) if successful. |
void |
close()
Closes the Spring application context using
ConfigurableApplicationContext.close() . |
protected org.springframework.security.core.Authentication |
createAuthenticationRequest(UserDetails userDetails)
Creates an
Authentication request object to be
passed to the AuthenticationManager.authenticate(org.springframework.security.core.Authentication)
method on each call to authenticate(UserDetails) . |
DirectoryManager |
createDirectoryManager(UserDetails userDetails)
Throws a
DirectoryAccessDeniedException on any attempt to manage the users/roles
using this API. |
void |
init(Properties properties)
Initialize the security manager using the spring security configuration.
|
public static final String SPRING_SECURITY_CONFIG_LOCATION
FileSystemXmlApplicationContext
frompublic void init(Properties properties) throws SecurityException
init
in interface SecurityManager
properties
- properties to use configure this instance.SecurityException
public Authentication authenticate(UserDetails userDetails) throws AuthenticationException
UserDetails
object, returning a fully populated
Authentication
object (including granted authorities) if successful. The API call
is delegated to the configured AuthenticationManager
,
using a UsernamePasswordAuthenticationToken
, converting the returned Authentication
object
(including fully populated granted authorities) to the GigaSpaces Authentication
object.
authenticate
in interface SecurityManager
userDetails
- The GigaSpaces user details request objectAuthenticationException
- if authentication failsprotected org.springframework.security.core.Authentication createAuthenticationRequest(UserDetails userDetails)
Authentication
request object to be
passed to the AuthenticationManager.authenticate(org.springframework.security.core.Authentication)
method on each call to authenticate(UserDetails)
. This method can be overridden
by subclasses which require authentication request other than the default UsernamePasswordAuthenticationToken
.
userDetails
- The GigaSpaces user details request objectpublic void close()
ConfigurableApplicationContext.close()
.close
in interface SecurityManager
public DirectoryManager createDirectoryManager(UserDetails userDetails) throws AuthenticationException, AccessDeniedException
DirectoryAccessDeniedException
on any attempt to manage the users/roles
using this API.createDirectoryManager
in interface SecurityManager
userDetails
- the user request objectAuthenticationException
- if authentication fails for the specified userAccessDeniedException
- if not granted sufficient access required to manage
role detailsDirectoryAccessDeniedException
- if the directory should not be managed by API.Copyright © GigaSpaces.