public class

InMemoryUserDetailsManager

extends Object
implements UserDetailsManager
java.lang.Object
   ↳ org.springframework.security.provisioning.InMemoryUserDetailsManager

Class Overview

Non-persistent implementation of UserDetailsManager which is backed by an in-memory map.

Mainly intended for testing and demonstration purposes, where a full blown persistent system isn't required.

Summary

Fields
protected final Log logger
Public Constructors
InMemoryUserDetailsManager(Collection<UserDetails> users)
InMemoryUserDetailsManager(Properties users)
Public Methods
void changePassword(String oldPassword, String newPassword)
Modify the current user's password.
void createUser(UserDetails user)
Create a new user with the supplied details.
void deleteUser(String username)
Remove the user with the given login name from the system.
UserDetails loadUserByUsername(String username)
Locates the user based on the username.
void setAuthenticationManager(AuthenticationManager authenticationManager)
void updateUser(UserDetails user)
Update the specified user.
boolean userExists(String username)
Check if a user with the supplied login name exists in the system.
[Expand]
Inherited Methods
From class java.lang.Object
From interface org.springframework.security.core.userdetails.UserDetailsService
From interface org.springframework.security.provisioning.UserDetailsManager

Fields

protected final Log logger

Public Constructors

public InMemoryUserDetailsManager (Collection<UserDetails> users)

public InMemoryUserDetailsManager (Properties users)

Public Methods

public void changePassword (String oldPassword, String newPassword)

Modify the current user's password. This should change the user's password in the persistent user repository (datbase, LDAP etc).

Parameters
oldPassword current password (for re-authentication if required)
newPassword the password to change to

public void createUser (UserDetails user)

Create a new user with the supplied details.

public void deleteUser (String username)

Remove the user with the given login name from the system.

public UserDetails loadUserByUsername (String username)

Locates the user based on the username. In the actual implementation, the search may possibly be case insensitive, or case insensitive depending on how the implementation instance is configured. In this case, the UserDetails object that comes back may have a username that is of a different case than what was actually requested..

Parameters
username the username identifying the user whose data is required.
Returns
  • a fully populated user record (never null)

public void setAuthenticationManager (AuthenticationManager authenticationManager)

public void updateUser (UserDetails user)

Update the specified user.

public boolean userExists (String username)

Check if a user with the supplied login name exists in the system.