Class MultiAuthenticator
java.lang.Object
org.deltava.security.SQLAuthenticator
org.deltava.security.MultiAuthenticator
- All Implemented Interfaces:
Closeable
,AutoCloseable
,Authenticator
- Direct Known Subclasses:
MigrationAuthenticator
,MirrorAuthenticator
An abstract Authenticator that supports multiple authenticators.
- Since:
- 1.0
- Version:
- 11.1
- Author:
- Luke
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final SequencedCollection
<Authenticator> The "destination" authenticators.protected Authenticator
The "source" authenticator.protected final Logger
The log4j logger.Fields inherited from class org.deltava.security.SQLAuthenticator
_props
Fields inherited from interface org.deltava.security.Authenticator
DEFAULT_PROPS_FILE
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
MultiAuthenticator
(Class<?> logClass) Initializes the Authentiactor. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Returns whether this Authenticator will accept a new User.protected static void
clearConnection
(Authenticator... auths) Checks if authenticators are aSQLAuthenticator
and if so clears the an explicit Connection to use.final Collection
<Authenticator> Returns the Destination Authenticators.final Authenticator
Returns the Source Authenticator.protected void
Initializes the authenticator.void
removeDestination
(Person usr) Removes the specified user from any destination Authenticators, while retaining the user in the source directory.protected void
setConnection
(Authenticator... auths) Checks if authenticators are aSQLAuthenticator
and if so passes in an explicit Connection to use.protected void
Synchronizes user information between the source and destination authenticators.Methods inherited from class org.deltava.security.SQLAuthenticator
close, getConnection, init, setConnection
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.deltava.security.Authenticator
add, authenticate, contains, disable, remove, rename, updatePassword
-
Field Details
-
_src
The "source" authenticator. -
_dst
The "destination" authenticators. -
log
The log4j logger.
-
-
Constructor Details
-
MultiAuthenticator
Initializes the Authentiactor.- Parameters:
logClass
- the log4j log class name
-
-
Method Details
-
init
Initializes the authenticator.- Parameters:
propsFile
- the properties file to useauthPrefix
- the property prefix- Throws:
SecurityException
- if an error occurs
-
getSource
Returns the Source Authenticator.- Returns:
- the Source Authenticator
-
getDestination
Returns the Destination Authenticators.- Returns:
- the destination Authenticator
-
setConnection
Checks if authenticators are aSQLAuthenticator
and if so passes in an explicit Connection to use.- Parameters:
auths
- the Authenticators to check and update
-
clearConnection
Checks if authenticators are aSQLAuthenticator
and if so clears the an explicit Connection to use.- Parameters:
auths
- the Authenticators to check and update
-
sync
Synchronizes user information between the source and destination authenticators. If the supplied credentials cannot be used to authenticate against the destination authenticator, then they are called via anAuthenticator.add(org.deltava.beans.Person, java.lang.String)
orAuthenticator.updatePassword(org.deltava.beans.Person, java.lang.String)
call to syncrhonize the two authenticators. This should only be called from a subclass'Authenticator.authenticate(org.deltava.beans.Person, java.lang.String)
method since the credentials are presumed to be valid in the source authenticator.- Parameters:
usr
- the Person beanpwd
- the user's password- Throws:
SecurityException
- if an error occurs
-
removeDestination
Removes the specified user from any destination Authenticators, while retaining the user in the source directory.- Parameters:
usr
- the user bean- Throws:
SecurityException
- if the user does not exist
-
accepts
Returns whether this Authenticator will accept a new User. This defaults to TRUE, although subclasses may override this default.- Parameters:
usr
- the user bean- Returns:
- TRUE always
-