Package org.jivesoftware.openfire.auth
Class AuthMultiProvider
java.lang.Object
org.jivesoftware.openfire.auth.AuthMultiProvider
- All Implemented Interfaces:
AuthProvider
- Direct Known Subclasses:
HybridAuthProvider
,MappedAuthProvider
An
AuthProvider
that delegates to one or more 'backing' AuthProviders.- Author:
- Guus der Kinderen, guus@goodbytes.nl
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
authenticate
(String username, String password) Returns if the username and password are valid; otherwise this method throws an UnauthorizedException.int
getIterations
(String username) getPassword
(String username) Returns the user's password.getServerKey
(String username) getStoredKey
(String username) static AuthProvider
instantiate
(SystemProperty<Class> implementationProperty) Instantiates a AuthProvider based on Class-based system property.static AuthProvider
instantiate
(SystemProperty<Class> implementationProperty, SystemProperty<String> configProperty) Instantiates a AuthProvider based on Class-based system property.boolean
void
setPassword
(String username, String password) Sets the user's password.boolean
Returns true if this UserProvider is able to retrieve user passwords from the backend user store.
-
Constructor Details
-
AuthMultiProvider
public AuthMultiProvider()
-
-
Method Details
-
instantiate
Instantiates a AuthProvider based on Class-based system property. When the property is not set, this method returns null. When the property is set, but an exception occurs while instantiating the class, this method logs the error and returns null. AuthProvider classes are required to have a public, no-argument constructor.- Parameters:
implementationProperty
- A property that defines the class of the instance to be returned.- Returns:
- A user provider (can be null).
-
instantiate
public static AuthProvider instantiate(@Nonnull SystemProperty<Class> implementationProperty, @Nullable SystemProperty<String> configProperty) Instantiates a AuthProvider based on Class-based system property. When the property is not set, this method returns null. When the property is set, but an exception occurs while instantiating the class, this method logs the error and returns null. AuthProvider classes are required to have a public, no-argument constructor, but can have an optional additional constructor that takes a single String argument. If such constructor is defined, then it is invoked with the value of the second argument of this method. This is typically used to (but needs not) identify a property (by name) that holds additional configuration for the to be instantiated AuthProvider. This implementation will pass on any non-empty value to the constructor. When a configuration argument is provided, but no constructor exists in the implementation that accepts a single String value, this method will log a warning and attempt to return an instance based on the no-arg constructor of the class.- Parameters:
implementationProperty
- A property that defines the class of the instance to be returned.configProperty
- A property that holds an opaque configuration string value passed to the constructor.- Returns:
- A user provider (can be null).
-
supportsPasswordRetrieval
public boolean supportsPasswordRetrieval()Description copied from interface:AuthProvider
Returns true if this UserProvider is able to retrieve user passwords from the backend user store. If this operation is not supported thenAuthProvider.getPassword(String)
will throw anUnsupportedOperationException
if invoked.- Specified by:
supportsPasswordRetrieval
in interfaceAuthProvider
- Returns:
- true if this UserProvider is able to retrieve user passwords from the backend user store.
-
isScramSupported
public boolean isScramSupported()- Specified by:
isScramSupported
in interfaceAuthProvider
-
authenticate
public void authenticate(String username, String password) throws UnauthorizedException, ConnectionException, InternalUnauthenticatedException Description copied from interface:AuthProvider
Returns if the username and password are valid; otherwise this method throws an UnauthorizedException.- Specified by:
authenticate
in interfaceAuthProvider
- Parameters:
username
- the username or full JID.password
- the password- Throws:
UnauthorizedException
- if the username and password do not match any existing user.ConnectionException
- it there is a problem connecting to user and group systemInternalUnauthenticatedException
- if there is a problem authentication Openfire itself into the user and group system
-
getPassword
public String getPassword(String username) throws UserNotFoundException, UnsupportedOperationException Description copied from interface:AuthProvider
Returns the user's password. This method should throw an UnsupportedOperationException if this operation is not supported by the backend user store.- Specified by:
getPassword
in interfaceAuthProvider
- Parameters:
username
- the username of the user.- Returns:
- the user's password.
- Throws:
UserNotFoundException
- if the given user's password could not be loaded.UnsupportedOperationException
- if the provider does not support the operation (this is an optional operation).
-
setPassword
public void setPassword(String username, String password) throws UserNotFoundException, UnsupportedOperationException Description copied from interface:AuthProvider
Sets the user's password. This method should throw an UnsupportedOperationException if this operation is not supported by the backend user store.- Specified by:
setPassword
in interfaceAuthProvider
- Parameters:
username
- the username of the user.password
- the new plaintext password for the user.- Throws:
UserNotFoundException
- if the given user could not be loaded.UnsupportedOperationException
- if the provider does not support the operation (this is an optional operation).
-
getSalt
- Specified by:
getSalt
in interfaceAuthProvider
- Throws:
UserNotFoundException
-
getIterations
- Specified by:
getIterations
in interfaceAuthProvider
- Throws:
UserNotFoundException
-
getServerKey
- Specified by:
getServerKey
in interfaceAuthProvider
- Throws:
UserNotFoundException
-
getStoredKey
- Specified by:
getStoredKey
in interfaceAuthProvider
- Throws:
UserNotFoundException
-