Package com.im.df.api.capabilities
Interface IJCUserDetailsService
-
- All Superinterfaces:
DFCapability
,SchemaServiceCapability
,org.springframework.security.core.userdetails.UserDetailsService
public interface IJCUserDetailsService extends org.springframework.security.core.userdetails.UserDetailsService, SchemaServiceCapability
The service for IJC user table administration.- Author:
- Tim Dudgeon
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description org.springframework.security.core.userdetails.UserDetails
addUser(java.lang.String username, java.lang.String password, boolean enabled, org.springframework.security.core.GrantedAuthority[] authorities, com.im.commons.progress.DFEnvironmentRW env)
Add a new user to the system.void
createTables(com.im.commons.progress.DFEnvironmentRW env)
Creates the database tables, deleting any that might have been present.void
deleteTables(com.im.commons.progress.DFEnvironmentRW env)
Delete the database tablesvoid
deleteUser(java.lang.String username, com.im.commons.progress.DFEnvironmentRW env)
Delete this user Can be called only when tablesExist() is truejava.util.List<org.springframework.security.core.userdetails.UserDetails>
getAllUsers()
Get a list of all users in the system.java.util.Map<org.springframework.security.core.GrantedAuthority,java.lang.String>
getAuthorities()
Get the valid authorities that are understood by the application.com.im.commons.progress.DFLockable
getLockable()
Get special lockable for this capability.org.springframework.security.core.userdetails.UserDetails
loadUserByUsername(java.lang.String username)
Redefined from UserDetalsSevice interface so that security and transaction can be annotated.boolean
tablesExist()
Do all the database tables exist.org.springframework.security.core.userdetails.UserDetails
updateAuthorities(java.lang.String username, org.springframework.security.core.GrantedAuthority[] authorities, com.im.commons.progress.DFEnvironmentRW env)
Replaces current authorities with the specified ones.org.springframework.security.core.userdetails.UserDetails
updateEnabled(java.lang.String username, boolean enabled, com.im.commons.progress.DFEnvironmentRW env)
Change the enabled status of this user Can be called only when tablesExist() is trueorg.springframework.security.core.userdetails.UserDetails
updatePassword(java.lang.String username, java.lang.String password, com.im.commons.progress.DFEnvironmentRW env)
Update the password for this user Can be called only when tablesExist() is true
-
-
-
Method Detail
-
getLockable
com.im.commons.progress.DFLockable getLockable()
Get special lockable for this capability. It must be used when calling user management methods from this interface- Returns:
- The lockable
-
getAuthorities
java.util.Map<org.springframework.security.core.GrantedAuthority,java.lang.String> getAuthorities()
Get the valid authorities that are understood by the application. Additional authorities can be set by adding them to the IJC_AUTHORITIES table. The mandatory roles ROLE_ADMIN, ROLE_EDIT_DATA, ROLE_EDIT_SCHEMA, ROLE_USER, ROLE_EXPORT_DATA and ROLE_EDIT_SCRIPT must be present in this table. If the IJC_AUTHORITIES table is present then this table is used, otherwise the default mandatory roles are returned.- Returns:
- Map of authorities. Keys are the authorities, the values a human readable description of the authority.
-
tablesExist
@Secured("ROLE_ADMIN") @Transactional(readOnly=true) boolean tablesExist()
Do all the database tables exist. If not they can be created. If so they can be deleted. If for some reason some but not all the table are present the return value will be false.
-
createTables
@Secured("ROLE_ADMIN") @Transactional void createTables(com.im.commons.progress.DFEnvironmentRW env)
Creates the database tables, deleting any that might have been present.
-
deleteTables
@Secured("ROLE_ADMIN") @Transactional void deleteTables(com.im.commons.progress.DFEnvironmentRW env)
Delete the database tables
-
addUser
@Secured("ROLE_ADMIN") @Transactional org.springframework.security.core.userdetails.UserDetails addUser(java.lang.String username, java.lang.String password, boolean enabled, org.springframework.security.core.GrantedAuthority[] authorities, com.im.commons.progress.DFEnvironmentRW env)
Add a new user to the system. The user must be granted at least one authority to be active. Can be called only when tablesExist() is true- Parameters:
username
- The username to updatepassword
- The passwordenabled
- True to enable, false to disableauthorities
- This user's granted authorities
-
deleteUser
@Secured("ROLE_ADMIN") @Transactional void deleteUser(java.lang.String username, com.im.commons.progress.DFEnvironmentRW env)
Delete this user Can be called only when tablesExist() is true- Parameters:
username
- The username to update
-
updatePassword
@Secured("ROLE_ADMIN") @Transactional org.springframework.security.core.userdetails.UserDetails updatePassword(java.lang.String username, java.lang.String password, com.im.commons.progress.DFEnvironmentRW env)
Update the password for this user Can be called only when tablesExist() is true- Parameters:
username
- The username to updatepassword
- The new passwordenv
- The environment
-
updateEnabled
@Secured("ROLE_ADMIN") @Transactional org.springframework.security.core.userdetails.UserDetails updateEnabled(java.lang.String username, boolean enabled, com.im.commons.progress.DFEnvironmentRW env)
Change the enabled status of this user Can be called only when tablesExist() is true- Parameters:
username
- The username to updateenabled
- True to enable, false to disable
-
updateAuthorities
@Secured("ROLE_ADMIN") @Transactional org.springframework.security.core.userdetails.UserDetails updateAuthorities(java.lang.String username, org.springframework.security.core.GrantedAuthority[] authorities, com.im.commons.progress.DFEnvironmentRW env)
Replaces current authorities with the specified ones. Can be called only when tablesExist() is true- Parameters:
username
- The username to updateauthorities
- The new authorities.
-
getAllUsers
@Secured("ROLE_ADMIN") @Transactional(readOnly=true) java.util.List<org.springframework.security.core.userdetails.UserDetails> getAllUsers()
Get a list of all users in the system. Does not include password or Granted Authorities information. Retrieve the individual user if you want this information
-
loadUserByUsername
@Secured("ROLE_ADMIN") @Transactional(readOnly=true) org.springframework.security.core.userdetails.UserDetails loadUserByUsername(java.lang.String username) throws org.springframework.security.core.userdetails.UsernameNotFoundException, org.springframework.dao.DataAccessException
Redefined from UserDetalsSevice interface so that security and transaction can be annotated.- Specified by:
loadUserByUsername
in interfaceorg.springframework.security.core.userdetails.UserDetailsService
- Throws:
org.springframework.security.core.userdetails.UsernameNotFoundException
org.springframework.dao.DataAccessException
-
-