Package org.jivesoftware.openfire.auth
Interface AuthProvider
- All Known Implementing Classes:
AuthMultiProvider,CrowdAuthProvider,DefaultAuthProvider,HybridAuthProvider,JDBCAuthProvider,LdapAuthProvider,MappedAuthProvider,NativeAuthProvider,POP3AuthProvider
public interface AuthProvider
Provider interface for authentication. Users that wish to integrate with
their own authentication system must implement this class and then register
the implementation with Openfire in the
openfire.xml
file. An entry in that file would look like the following:
<provider>
<auth>
<className>com.foo.auth.CustomAuthProvider</className>
</auth>
</provider>- Author:
- Matt Tucker
-
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.Use getIterations(String, String) with the mechanism name.default 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.Use getSalt(String, String) with the mechanism name.default StringReturns a SCRAM salt for a user and mechanism.default ScramCredentialDatagetScramCredential(String username, String mechanism) Returns SCRAM credentials for a user and mechanism.getServerKey(String username) Deprecated, for removal: This API element is subject to removal in a future version.Use getServerKey(String, String) with the mechanism name.default StringgetServerKey(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.Use getStoredKey(String, String) with the mechanism name.default StringgetStoredKey(String username, String mechanism) Returns a SCRAM stored key for a user and mechanism.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.
-
Method Details
-
authenticate
void authenticate(String username, String password) throws UnauthorizedException, ConnectionException, InternalUnauthenticatedException Returns if the username and password are valid; otherwise this method throws an UnauthorizedException.- 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
Returns the user's password. This method should throw an UnsupportedOperationException if this operation is not supported by the backend user store.- 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
void setPassword(String username, String password) throws UserNotFoundException, UnsupportedOperationException Sets the user's password. This method should throw an UnsupportedOperationException if this operation is not supported by the backend user store.- 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).
-
supportsPasswordRetrieval
boolean supportsPasswordRetrieval()Returns true if this UserProvider is able to retrieve user passwords from the backend user store. If this operation is not supported thengetPassword(String)will throw anUnsupportedOperationExceptionif invoked.- Returns:
- true if this UserProvider is able to retrieve user passwords from the backend user store.
-
isScramSupported
boolean isScramSupported() -
getScramCredential
default ScramCredentialData getScramCredential(String username, String mechanism) throws UnsupportedOperationException, UserNotFoundException Returns SCRAM credentials for a user and mechanism. This default implementation is backed by the deprecated single-argument accessors, which can only supplySCRAM-SHA-1material. It therefore supports only theSCRAM-SHA-1mechanism (with or without the-PLUSsuffix). Providers that add support for other SCRAM mechanisms must override this method.- 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
default String getSalt(String username, String mechanism) throws UnsupportedOperationException, UserNotFoundException Returns a SCRAM salt for a user and mechanism. -
getIterations
default int getIterations(String username, String mechanism) throws UnsupportedOperationException, UserNotFoundException Returns a SCRAM iteration count for a user and mechanism. -
getServerKey
default String getServerKey(String username, String mechanism) throws UnsupportedOperationException, UserNotFoundException Returns a SCRAM server key for a user and mechanism. -
getStoredKey
default String getStoredKey(String username, String mechanism) throws UnsupportedOperationException, UserNotFoundException Returns a SCRAM stored key for a user and mechanism. -
getSalt
@Deprecated(forRemoval=true) String getSalt(String username) throws UnsupportedOperationException, UserNotFoundException Deprecated, for removal: This API element is subject to removal in a future version.Use getSalt(String, String) with the mechanism name.Returns a SCRAM-SHA-1 salt for a user. -
getIterations
@Deprecated(forRemoval=true) int getIterations(String username) throws UnsupportedOperationException, UserNotFoundException Deprecated, for removal: This API element is subject to removal in a future version.Use getIterations(String, String) with the mechanism name.Returns a SCRAM-SHA-1 iteration count for a user. -
getServerKey
@Deprecated(forRemoval=true) String getServerKey(String username) throws UnsupportedOperationException, UserNotFoundException Deprecated, for removal: This API element is subject to removal in a future version.Use getServerKey(String, String) with the mechanism name.Returns a SCRAM-SHA-1 server key for a user. -
getStoredKey
@Deprecated(forRemoval=true) String getStoredKey(String username) throws UnsupportedOperationException, UserNotFoundException Deprecated, for removal: This API element is subject to removal in a future version.Use getStoredKey(String, String) with the mechanism name.Returns a SCRAM-SHA-1 stored key for a user.
-