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 TypeMethodDescriptionvoidauthenticate(String username, String password) Returns if the username and password are valid; otherwise this method throws an UnauthorizedException.intgetIterations(String username) getPassword(String username) Returns the user's password.getServerKey(String username) getStoredKey(String username) static AuthProviderinstantiate(SystemProperty<Class> implementationProperty) Instantiates a AuthProvider based on Class-based system property.static AuthProviderinstantiate(SystemProperty<Class> implementationProperty, SystemProperty<String> configProperty) Instantiates a AuthProvider based on Class-based system property.booleanvoidsetPassword(String username, String password) Sets the user's password.booleanReturns 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:AuthProviderReturns 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 anUnsupportedOperationExceptionif invoked.- Specified by:
supportsPasswordRetrievalin interfaceAuthProvider- Returns:
- true if this UserProvider is able to retrieve user passwords from the backend user store.
-
isScramSupported
public boolean isScramSupported()- Specified by:
isScramSupportedin interfaceAuthProvider
-
authenticate
public void authenticate(String username, String password) throws UnauthorizedException, ConnectionException, InternalUnauthenticatedException Description copied from interface:AuthProviderReturns if the username and password are valid; otherwise this method throws an UnauthorizedException.- Specified by:
authenticatein 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:AuthProviderReturns the user's password. This method should throw an UnsupportedOperationException if this operation is not supported by the backend user store.- Specified by:
getPasswordin 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:AuthProviderSets the user's password. This method should throw an UnsupportedOperationException if this operation is not supported by the backend user store.- Specified by:
setPasswordin 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:
getSaltin interfaceAuthProvider- Throws:
UserNotFoundException
-
getIterations
- Specified by:
getIterationsin interfaceAuthProvider- Throws:
UserNotFoundException
-
getServerKey
- Specified by:
getServerKeyin interfaceAuthProvider- Throws:
UserNotFoundException
-
getStoredKey
- Specified by:
getStoredKeyin interfaceAuthProvider- Throws:
UserNotFoundException
-