Package com.gigaspaces.security.spring
Class SpringSecurityManager
java.lang.Object
com.gigaspaces.security.spring.SpringSecurityManager
- All Implemented Interfaces:
SecurityManager
A Spring security bridge over the GigaSpaces
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
- Since:
- 7.1.1
- Author:
- Moran Avigdor
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe security-config xml file location to create a newFileSystemXmlApplicationContextfromFields inherited from interface com.gigaspaces.security.SecurityManager
SECURITY_MANAGER_CLASS_PROPERTY_KEY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionauthenticate(UserDetails userDetails) Attempts to authenticate the passedUserDetailsobject, returning a fully populatedAuthenticationobject (including granted authorities) if successful.voidclose()Closes the Spring application context usingConfigurableApplicationContext.close().protected org.springframework.security.core.AuthenticationcreateAuthenticationRequest(UserDetails userDetails) Creates anAuthenticationrequest object to be passed to theAuthenticationManager.authenticate(org.springframework.security.core.Authentication)method on each call toauthenticate(UserDetails).createDirectoryManager(UserDetails userDetails) Throws aDirectoryAccessDeniedExceptionon any attempt to manage the users/roles using this API.voidinit(Properties properties) Initialize the security manager using the spring security configuration.
-
Field Details
-
SPRING_SECURITY_CONFIG_LOCATION
The security-config xml file location to create a newFileSystemXmlApplicationContextfrom- See Also:
-
-
Constructor Details
-
SpringSecurityManager
public SpringSecurityManager()
-
-
Method Details
-
init
Initialize the security manager using the spring security configuration.- Specified by:
initin interfaceSecurityManager- Parameters:
properties- properties to use configure this instance.- Throws:
SecurityException
-
authenticate
Attempts to authenticate the passedUserDetailsobject, returning a fully populatedAuthenticationobject (including granted authorities) if successful.The API call is delegated to the configured
AuthenticationManager, using aUsernamePasswordAuthenticationToken, converting the returnedAuthenticationobject (including fully populated granted authorities) to the GigaSpacesAuthenticationobject.- Specified by:
authenticatein interfaceSecurityManager- Parameters:
userDetails- The GigaSpaces user details request object- Returns:
- a fully authenticated object including authorities
- Throws:
AuthenticationException- if authentication fails
-
createAuthenticationRequest
protected org.springframework.security.core.Authentication createAuthenticationRequest(UserDetails userDetails) Creates anAuthenticationrequest object to be passed to theAuthenticationManager.authenticate(org.springframework.security.core.Authentication)method on each call toauthenticate(UserDetails).This method can be overridden by subclasses which require authentication request other than the default
UsernamePasswordAuthenticationToken.- Parameters:
userDetails- The GigaSpaces user details request object- Returns:
- an authentication request object
-
close
public void close()Closes the Spring application context usingConfigurableApplicationContext.close().- Specified by:
closein interfaceSecurityManager
-
createDirectoryManager
public DirectoryManager createDirectoryManager(UserDetails userDetails) throws AuthenticationException, AccessDeniedException Throws aDirectoryAccessDeniedExceptionon any attempt to manage the users/roles using this API.- Specified by:
createDirectoryManagerin interfaceSecurityManager- Parameters:
userDetails- the user request object- Returns:
- a directory manager instance
- Throws:
AuthenticationException- 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.
-