Class SimpleLoginService
java.lang.Object
org.jdesktop.beans.AbstractBean
org.jdesktop.swingx.auth.LoginService
org.jdesktop.swingx.auth.SimpleLoginService
An implementation of LoginService that simply matches
the username/password against a list of known users and their passwords.
This is useful for demos or prototypes where a proper login server is not available.
This Implementation is NOT secure. DO NOT USE this in a real application
To make this implementation more secure, the passwords should be passed in and
stored as the result of a one way hash algorithm. That way an attacker cannot
simply read the password in memory to crack into the system.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionSimpleLoginService(Map<String, char[]> passwordMap) Creates a new SimpleLoginService based on the given password map. -
Method Summary
Modifier and TypeMethodDescriptionbooleanauthenticate(String name, char[] password, String server) Attempts to authenticate the given username and password against the password mapMethods inherited from class LoginService
addLoginListener, cancelAuthentication, fireLoginCanceled, fireLoginFailed, fireLoginStarted, fireLoginSucceeded, getServer, getSynchronous, getUserRoles, removeLoginListener, setServer, setSynchronous, startAuthenticationMethods inherited from class AbstractBean
addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, addVetoableChangeListener, clone, fireIndexedPropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, fireVetoableChange, getPropertyChangeListeners, getPropertyChangeListeners, getVetoableChangeListeners, getVetoableChangeListeners, hasPropertyChangeListeners, hasVetoableChangeListeners, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, removeVetoableChangeListener
-
Field Details
-
passwordMap
-
-
Constructor Details
-
SimpleLoginService
-
-
Method Details
-
authenticate
Attempts to authenticate the given username and password against the password map- Specified by:
authenticatein classLoginService- Parameters:
name- usernamepassword- passwordserver- server (optional)- Returns:
trueon authentication success- Throws:
Exception
-