org.ikasan.framework.security.service
Class UserServiceImpl

java.lang.Object
  extended by org.ikasan.framework.security.service.UserServiceImpl
All Implemented Interfaces:
UserService, org.springframework.security.userdetails.UserDetailsManager, org.springframework.security.userdetails.UserDetailsService

public class UserServiceImpl
extends Object
implements UserService

Default implementation of the UserService

Author:
Ikasan Development Team

Constructor Summary
UserServiceImpl(UserDao userDao, AuthorityDao authorityDao, org.springframework.security.providers.encoding.PasswordEncoder passwordEncoder)
          Constructor
 
Method Summary
 void changePassword(String oldPassword, String newPassword)
           
 void changeUsersEmail(String username, String newEmail)
          Allows a specified user's email address.
 void changeUsersPassword(String username, String newPassword, String confirmNewPassword)
          Allows a specified user's password.
 void createAuthority(Authority newAuthority)
          Creates a new Authority on the system
 void createUser(org.springframework.security.userdetails.UserDetails userDetails)
           
 void deleteUser(String username)
           
 void disableUser(String username)
          Disables the specified user
 void enableUser(String username)
          Enables the specified user
 List<Authority> getAuthorities()
          Gets all Authorities in the system
 List<User> getUsers()
          Gets all Users in the system
 void grantAuthority(String username, String authority)
          Attempts to grant an authority to a user
 User loadUserByUsername(String username)
           
 void revokeAuthority(String username, String authority)
          Attempts to revoke an authority from a user
 void updateUser(org.springframework.security.userdetails.UserDetails userDetails)
           
 boolean userExists(String username)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UserServiceImpl

public UserServiceImpl(UserDao userDao,
                       AuthorityDao authorityDao,
                       org.springframework.security.providers.encoding.PasswordEncoder passwordEncoder)
Constructor

Parameters:
userDao -
authorityDao -
passwordEncoder -
Method Detail

getUsers

public List<User> getUsers()
Description copied from interface: UserService
Gets all Users in the system

Specified by:
getUsers in interface UserService
Returns:
all Users

changePassword

public void changePassword(String oldPassword,
                           String newPassword)
Specified by:
changePassword in interface org.springframework.security.userdetails.UserDetailsManager

createUser

public void createUser(org.springframework.security.userdetails.UserDetails userDetails)
Specified by:
createUser in interface org.springframework.security.userdetails.UserDetailsManager

deleteUser

public void deleteUser(String username)
Specified by:
deleteUser in interface org.springframework.security.userdetails.UserDetailsManager

disableUser

public void disableUser(String username)
Description copied from interface: UserService
Disables the specified user

Specified by:
disableUser in interface UserService

enableUser

public void enableUser(String username)
Description copied from interface: UserService
Enables the specified user

Specified by:
enableUser in interface UserService

updateUser

public void updateUser(org.springframework.security.userdetails.UserDetails userDetails)
Specified by:
updateUser in interface org.springframework.security.userdetails.UserDetailsManager

userExists

public boolean userExists(String username)
Specified by:
userExists in interface org.springframework.security.userdetails.UserDetailsManager

loadUserByUsername

public User loadUserByUsername(String username)
                        throws org.springframework.security.userdetails.UsernameNotFoundException,
                               org.springframework.dao.DataAccessException
Specified by:
loadUserByUsername in interface UserService
Specified by:
loadUserByUsername in interface org.springframework.security.userdetails.UserDetailsService
Throws:
org.springframework.security.userdetails.UsernameNotFoundException
org.springframework.dao.DataAccessException

getAuthorities

public List<Authority> getAuthorities()
Description copied from interface: UserService
Gets all Authorities in the system

Specified by:
getAuthorities in interface UserService
Returns:
all Authorities

grantAuthority

public void grantAuthority(String username,
                           String authority)
Description copied from interface: UserService
Attempts to grant an authority to a user

Specified by:
grantAuthority in interface UserService

revokeAuthority

public void revokeAuthority(String username,
                            String authority)
Description copied from interface: UserService
Attempts to revoke an authority from a user

Specified by:
revokeAuthority in interface UserService

changeUsersPassword

public void changeUsersPassword(String username,
                                String newPassword,
                                String confirmNewPassword)
                         throws IllegalArgumentException
Description copied from interface: UserService
Allows a specified user's password. Note that this should be an administrator function or a function of that particular user

Specified by:
changeUsersPassword in interface UserService
newPassword - as plain text
confirmNewPassword - as plain text
Throws:
IllegalArgumentException - If the passwords don't match

changeUsersEmail

public void changeUsersEmail(String username,
                             String newEmail)
                      throws IllegalArgumentException
Description copied from interface: UserService
Allows a specified user's email address. Note that this should be an administrator function or a function of that particular user

Specified by:
changeUsersEmail in interface UserService
newEmail - as plain text
Throws:
IllegalArgumentException - If the user is not valid

createAuthority

public void createAuthority(Authority newAuthority)
Description copied from interface: UserService
Creates a new Authority on the system

Specified by:
createAuthority in interface UserService


Copyright © 2007-2012 Ikasan. All Rights Reserved.