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) Deprecated, for removal: This API element is subject to removal in a future version.intgetIterations(String username, String mechanism) Returns a SCRAM iteration count for a user and mechanism.getPassword(String username) Returns the user's password.Deprecated, for removal: This API element is subject to removal in a future version.Returns a SCRAM salt for a user and mechanism.getScramCredential(String username, String mechanism) Returns SCRAM credentials for a user and mechanism from the mapped provider.getServerKey(String username) Deprecated, for removal: This API element is subject to removal in a future version.getServerKey(String username, String mechanism) Returns a SCRAM server key for a user and mechanism.getStoredKey(String username) Deprecated, for removal: This API element is subject to removal in a future version.getStoredKey(String username, String mechanism) Returns a SCRAM stored key for a user and mechanism.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
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:AuthProviderReturns a SCRAM-SHA-1 salt for a user.- Specified by:
getSaltin interfaceAuthProvider- Throws:
UserNotFoundException
-
getIterations
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:AuthProviderReturns a SCRAM-SHA-1 iteration count for a user.- Specified by:
getIterationsin interfaceAuthProvider- Throws:
UserNotFoundException
-
getServerKey
@Deprecated(forRemoval=true) public String getServerKey(String username) throws UserNotFoundException Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:AuthProviderReturns a SCRAM-SHA-1 server key for a user.- Specified by:
getServerKeyin interfaceAuthProvider- Throws:
UserNotFoundException
-
getStoredKey
@Deprecated(forRemoval=true) public String getStoredKey(String username) throws UserNotFoundException Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:AuthProviderReturns a SCRAM-SHA-1 stored key for a user.- Specified by:
getStoredKeyin interfaceAuthProvider- Throws:
UserNotFoundException
-
getScramCredential
public ScramCredentialData getScramCredential(String username, String mechanism) throws UnsupportedOperationException, UserNotFoundException Returns SCRAM credentials for a user and mechanism from the mapped provider.- Specified by:
getScramCredentialin interfaceAuthProvider- Parameters:
username- the username of the user.mechanism- the SCRAM mechanism name.- Returns:
- the SCRAM credentials for the user under the (normalized) mechanism.
- Throws:
UnsupportedOperationException- if the mechanism is notSCRAM-SHA-1.UserNotFoundException- if the user's credentials could not be loaded.
-
getSalt
public String getSalt(String username, String mechanism) throws UnsupportedOperationException, UserNotFoundException Returns a SCRAM salt for a user and mechanism.- Specified by:
getSaltin interfaceAuthProvider- Throws:
UnsupportedOperationExceptionUserNotFoundException
-
getIterations
public int getIterations(String username, String mechanism) throws UnsupportedOperationException, UserNotFoundException Returns a SCRAM iteration count for a user and mechanism.- Specified by:
getIterationsin interfaceAuthProvider- Throws:
UnsupportedOperationExceptionUserNotFoundException
-
getServerKey
public String getServerKey(String username, String mechanism) throws UnsupportedOperationException, UserNotFoundException Returns a SCRAM server key for a user and mechanism.- Specified by:
getServerKeyin interfaceAuthProvider- Throws:
UnsupportedOperationExceptionUserNotFoundException
-
getStoredKey
public String getStoredKey(String username, String mechanism) throws UnsupportedOperationException, UserNotFoundException Returns a SCRAM stored key for a user and mechanism.- Specified by:
getStoredKeyin interfaceAuthProvider- Throws:
UnsupportedOperationExceptionUserNotFoundException
-