public class AuthFactory extends Object
AuthProvider.className
system property. For example, if you have configured Openfire to use LDAP for user information,
you'd want to send a custom implementation of AuthFactory to make LDAP auth queries.
After changing the AuthProvider.className
system property, you must restart your
application server.Constructor and Description |
---|
AuthFactory() |
Modifier and Type | Method and Description |
---|---|
static AuthToken |
authenticate(String username,
String password)
Authenticates a user with a username and plain text password and returns and
AuthToken.
|
static String |
createDigest(String token,
String password)
Returns a digest given a token and password, according to JEP-0078.
|
static String |
decryptPassword(String encryptedPassword)
Returns a decrypted version of the encrypted password.
|
static String |
encryptPassword(String password)
Returns an encrypted version of the plain-text password.
|
static AuthProvider |
getAuthProvider()
Deprecated.
Prefer using the corresponding factory method, rather than
invoking methods on the provider directly
|
static int |
getIterations(String username) |
static String |
getPassword(String username)
Returns the user's password.
|
static String |
getSalt(String username) |
static String |
getServerKey(String username) |
static String |
getStoredKey(String username) |
static boolean |
isProviderInstanceOf(Class<?> c)
Returns whether the currently-installed AuthProvider is instance of a specific class.
|
static void |
setPassword(String username,
String password)
Sets the users's password.
|
static boolean |
supportsPasswordRetrieval()
Returns true if the currently installed
AuthProvider supports password
retrieval. |
static boolean |
supportsScram() |
public static AuthProvider getAuthProvider()
public static boolean isProviderInstanceOf(Class<?> c)
c
- the class to compare withpublic static boolean supportsPasswordRetrieval()
AuthProvider
supports password
retrieval. Certain implementation utilize password hashes and other authentication
mechanisms that do not require the original password.public static String getPassword(String username) throws UserNotFoundException, UnsupportedOperationException
username
- the username of the user.UserNotFoundException
- if the given user could not be found.UnsupportedOperationException
- if the provider does not
support the operation (this is an optional operation).public static void setPassword(String username, String password) throws UserNotFoundException, UnsupportedOperationException, ConnectionException, InternalUnauthenticatedException
username
- the username of the user.password
- the new plaintext password for the user.UserNotFoundException
- if the given user could not be loaded.UnsupportedOperationException
- if the provider does not
support the operation (this is an optional operation).ConnectionException
InternalUnauthenticatedException
public static AuthToken authenticate(String username, String password) throws UnauthorizedException, ConnectionException, InternalUnauthenticatedException
username
- the username.password
- the password.UnauthorizedException
- if the username and password do not match any existing user
or the account is locked out.ConnectionException
InternalUnauthenticatedException
public static String createDigest(String token, String password)
token
- the token used in the digest.password
- the plain-text password to be digested.public static String encryptPassword(String password)
password
- the plain-text password.UnsupportedOperationException
- if encryption/decryption is not possible;
for example, during setup mode.public static String decryptPassword(String encryptedPassword)
encryptedPassword
- the encrypted password.UnsupportedOperationException
- if encryption/decryption is not possible;
for example, during setup mode.public static boolean supportsScram()
public static String getSalt(String username) throws UnsupportedOperationException, UserNotFoundException
public static int getIterations(String username) throws UnsupportedOperationException, UserNotFoundException
public static String getServerKey(String username) throws UnsupportedOperationException, UserNotFoundException
public static String getStoredKey(String username) throws UnsupportedOperationException, UserNotFoundException
Copyright © 2003-2008 Jive Software.