Class AuthMultiProvider

java.lang.Object
org.jivesoftware.openfire.auth.AuthMultiProvider
All Implemented Interfaces:
AuthProvider
Direct Known Subclasses:
HybridAuthProvider, MappedAuthProvider

public abstract class AuthMultiProvider extends Object implements AuthProvider
An AuthProvider that delegates to one or more 'backing' AuthProviders.
Author:
Guus der Kinderen, guus@goodbytes.nl
  • Constructor Details

    • AuthMultiProvider

      public AuthMultiProvider()
  • Method Details

    • instantiate

      public static AuthProvider instantiate(@Nonnull SystemProperty<Class> implementationProperty)
      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: AuthProvider
      Returns true if this UserProvider is able to retrieve user passwords from the backend user store. If this operation is not supported then AuthProvider.getPassword(String) will throw an UnsupportedOperationException if invoked.
      Specified by:
      supportsPasswordRetrieval in interface AuthProvider
      Returns:
      true if this UserProvider is able to retrieve user passwords from the backend user store.
    • isScramSupported

      public boolean isScramSupported()
      Specified by:
      isScramSupported in interface AuthProvider
    • authenticate

      public void authenticate(String username, String password) throws UnauthorizedException, ConnectionException, InternalUnauthenticatedException
      Description copied from interface: AuthProvider
      Returns if the username and password are valid; otherwise this method throws an UnauthorizedException.

      Specified by:
      authenticate in interface AuthProvider
      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 system
      InternalUnauthenticatedException - 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: AuthProvider
      Returns the user's password. This method should throw an UnsupportedOperationException if this operation is not supported by the backend user store.
      Specified by:
      getPassword in interface AuthProvider
      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: AuthProvider
      Sets the user's password. This method should throw an UnsupportedOperationException if this operation is not supported by the backend user store.
      Specified by:
      setPassword in interface AuthProvider
      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

      public String getSalt(String username) throws UserNotFoundException
      Specified by:
      getSalt in interface AuthProvider
      Throws:
      UserNotFoundException
    • getIterations

      public int getIterations(String username) throws UserNotFoundException
      Specified by:
      getIterations in interface AuthProvider
      Throws:
      UserNotFoundException
    • getServerKey

      public String getServerKey(String username) throws UserNotFoundException
      Specified by:
      getServerKey in interface AuthProvider
      Throws:
      UserNotFoundException
    • getStoredKey

      public String getStoredKey(String username) throws UserNotFoundException
      Specified by:
      getStoredKey in interface AuthProvider
      Throws:
      UserNotFoundException