Class MigrationAuthenticator
java.lang.Object
org.deltava.security.SQLAuthenticator
org.deltava.security.MultiAuthenticator
org.deltava.security.MigrationAuthenticator
- All Implemented Interfaces:
Closeable
,AutoCloseable
,Authenticator
An Authenticator used to migrate user data from one Directory to another. When a user is sucessfully authenticated by the first ("source")
authenticator, the directory name and password are written into the second ("destination") authenticator and deleted from the source.
- Since:
- 1.0
- Version:
- 11.1
- Author:
- Luke
-
Field Summary
Fields inherited from class org.deltava.security.MultiAuthenticator
_dst, _src, log
Fields inherited from class org.deltava.security.SQLAuthenticator
_props
Fields inherited from interface org.deltava.security.Authenticator
DEFAULT_PROPS_FILE
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
Returns whether the destination Authenticator will accept a user.void
Adds a User to the Destination Directory.void
authenticate
(Person usr, String pwd) Authenticates the user.boolean
Checks if a particular name exists in either Directory.void
Disables a user in the source and/or destination authenticators.void
Initializes the Authenticator.void
Removes a User from the Directory.void
Renames a user in the Destination Directory.void
updatePassword
(Person usr, String pwd) Updates a user's password.Methods inherited from class org.deltava.security.MultiAuthenticator
clearConnection, getDestination, getSource, init, removeDestination, setConnection, sync
Methods inherited from class org.deltava.security.SQLAuthenticator
close, getConnection, setConnection
-
Constructor Details
-
MigrationAuthenticator
public MigrationAuthenticator()Loads the Authenticator.
-
-
Method Details
-
init
Initializes the Authenticator.- Specified by:
init
in interfaceAuthenticator
- Overrides:
init
in classSQLAuthenticator
- Parameters:
propsFile
- the name of the proeprties file to load- Throws:
SecurityException
- if an error occurs
-
authenticate
Authenticates the user. This authenticator will check the destination Directory to see if it contains an entry for the user. If it does, then authentication proceeds normally. If not, then the credentials are authenticated against the source Directory. If authentication succeeds, they are used to add credentials to the destnation Directory.- Parameters:
usr
- the User beanpwd
- the user's password- Throws:
SecurityException
- if authentication fails for any reason, contained within the cause of the exception.- See Also:
-
accepts
Returns whether the destination Authenticator will accept a user.- Specified by:
accepts
in interfaceAuthenticator
- Overrides:
accepts
in classMultiAuthenticator
- Parameters:
usr
- the user bean- Returns:
- whether the destination Authenticator will accept the person
-
contains
Checks if a particular name exists in either Directory.- Parameters:
usr
- the user bean- Returns:
- TRUE if the user exists in either Authenticator, otherwise FALSE
- Throws:
SecurityException
- if an error occurs
-
updatePassword
Updates a user's password. This user must be present in the destination directory.- Parameters:
usr
- the User beanpwd
- the new password- Throws:
SecurityException
- if an error occurs, or the user is not in the Destination directory
-
add
Adds a User to the Destination Directory.- Parameters:
usr
- the User beanpwd
- the User's password- Throws:
SecurityException
- if an error occurs
-
remove
Removes a User from the Directory. This will remove from the first directory containing the user, first the Destination, then the Source.- Parameters:
usr
- the user bean- Throws:
SecurityException
- if an error occurs or the user does not exist
-
rename
Renames a user in the Destination Directory.- Parameters:
usr
- the user beannewName
- the new fully-qualified directory- Throws:
SecurityException
- if an error occurs
-
disable
Disables a user in the source and/or destination authenticators.- Parameters:
usr
- the user bean- Throws:
SecurityException
- if an error occurs
-