Class DittoAuthenticationProvider

java.lang.Object
com.ditto.java.DittoAuthenticationProvider

public class DittoAuthenticationProvider extends Object

Represents a string-based authentication provider identifier used for login with Ditto.

Important: This API is in preview and provides a type-safe struct for specifying authentication providers, using the extensible-enum pattern. Supports both built-in and custom providers in a consistent and ergonomic way in v5.

This class defines built-in providers such as development(), and also allows defining custom providers by passing an arbitrary string to custom(String).

Custom providers can be defined as follows:

`DittoAuthenticationProvider provider = DittoAuthenticationProvider.custom("my-custom-provider");ditto.auth().login(token, provider);`
  • Method Details

    • development

      public static @NonNull DittoAuthenticationProvider development()

      Returns the built-in development authentication provider.

      This provider is used for development and testing purposes. It should not be used in production environments as it provides unrestricted access.

      Returns:
      the development authentication provider.
    • custom

      public static @NonNull DittoAuthenticationProvider custom(@NonNull String rawValue)

      Creates a custom authentication provider with the specified identifier.

      This allows you to use custom authentication providers beyond the built-in ones. The raw value should match the provider identifier configured in your Ditto Big Peer or authentication system.

      Parameters:
      rawValue - the custom provider identifier string.
      Returns:
      a custom authentication provider with the specified identifier.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public final boolean equals(Object o)
      Overrides:
      equals in class Object