Class HybridAuthProvider
- All Implemented Interfaces:
AuthProvider
- Attempt authentication using the primary provider. If that fails:
- If the secondary provider is defined, attempt authentication (otherwise return). If that fails:
- If the tertiary provider is defined, attempt authentication.
MappedAuthProvider. The Hybrid variant of the provider iterates
over providers, operating on the first applicable instance. The Mapped variant, however, maps each user to exactly
one provider.
To enable this provider, set the provider.auth.className system property to
org.jivesoftware.openfire.auth.HybridAuthProvider.
The primary, secondary, and tertiary providers are configured be setting system properties similar to
the following:
hybridAuthProvider.primaryProvider = org.jivesoftware.openfire.auth.DefaultAuthProviderhybridAuthProvider.secondaryProvider = org.jivesoftware.openfire.auth.NativeAuthProvider
The primary provider is required, but all other properties are optional. Each provider should be configured as it is normally, using whatever XML configuration options it specifies. When using multiple providers of the same type, it typically is desirable to have distinct configuration for each provider. To do so, a property with the name 'config' can be used. If used, the value of this property is passed as a string to the constructor of the provider (for this to work, the provider must have a constructor that takes exactly one argument: a string). Typically, this value is used to reference another property name that the provider can use to obtain its information for, but the value is treated as an opaque string by this implementation. The full list of properties:
hybridAuthProvider.primaryProvider.className(required) -- the class name of the auth provider.hybridAuthProvider.primaryProvider.config-- A value used by the auth provider for configuration (typically the name of another property).hybridAuthProvider.primaryProvider.overrideList-- a comma-delimited list of usernames for which authentication will only be tried with this provider.hybridAuthProvider.secondaryProvider.className-- the class name of the auth provider.hybridAuthProvider.secondaryProvider.config-- A value used by the auth provider for configuration (typically the name of another property).hybridAuthProvider.secondaryProvider.overrideList-- a comma-delimited list of usernames for which authentication will only be tried with this provider.hybridAuthProvider.tertiaryProvider.className-- the class name of the auth provider.hybridAuthProvider.tertiaryProvider.config-- A value used by the auth provider for configuration (typically the name of another property).hybridAuthProvider.tertiaryProvider.overrideList-- a comma-delimited list of usernames for which authentication will only be tried with this provider.
- Author:
- Matt Tucker
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final SystemProperty<Class>static final SystemProperty<String>static final SystemProperty<Class>static final SystemProperty<String>static final SystemProperty<Class>static final SystemProperty<String> -
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) voidsetPassword(String username, String password) Sets the user's password.Methods inherited from class org.jivesoftware.openfire.auth.AuthMultiProvider
instantiate, instantiate, isScramSupported, supportsPasswordRetrieval
-
Field Details
-
PRIMARY_PROVIDER
-
PRIMARY_PROVIDER_CONFIG
-
SECONDARY_PROVIDER
-
SECONDARY_PROVIDER_CONFIG
-
TERTIARY_PROVIDER
-
TERTIARY_PROVIDER_CONFIG
-
-
Constructor Details
-
HybridAuthProvider
public HybridAuthProvider()
-
-
Method Details
-
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- Overrides:
authenticatein classAuthMultiProvider- 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- Overrides:
getPasswordin classAuthMultiProvider- 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- Overrides:
setPasswordin classAuthMultiProvider- 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- Overrides:
getSaltin classAuthMultiProvider- Throws:
UnsupportedOperationExceptionUserNotFoundException
-
getIterations
public int getIterations(String username) throws UnsupportedOperationException, UserNotFoundException - Specified by:
getIterationsin interfaceAuthProvider- Overrides:
getIterationsin classAuthMultiProvider- Throws:
UnsupportedOperationExceptionUserNotFoundException
-
getServerKey
public String getServerKey(String username) throws UnsupportedOperationException, UserNotFoundException - Specified by:
getServerKeyin interfaceAuthProvider- Overrides:
getServerKeyin classAuthMultiProvider- Throws:
UnsupportedOperationExceptionUserNotFoundException
-
getStoredKey
public String getStoredKey(String username) throws UnsupportedOperationException, UserNotFoundException - Specified by:
getStoredKeyin interfaceAuthProvider- Overrides:
getStoredKeyin classAuthMultiProvider- Throws:
UnsupportedOperationExceptionUserNotFoundException
-