java.lang.Object
java.lang.Enum<NoOpUserProvider>
io.fluxcapacitor.javaclient.tracking.handling.authentication.NoOpUserProvider
All Implemented Interfaces:
UserProvider, Serializable, Comparable<NoOpUserProvider>, Constable

public enum NoOpUserProvider extends Enum<NoOpUserProvider> implements UserProvider
  • Enum Constant Details

  • Method Details

    • values

      public static NoOpUserProvider[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static NoOpUserProvider valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • getUserById

      public User getUserById(Object userId)
      Description copied from interface: UserProvider
      Retrieves a User by their unique identifier.

      This method is primarily used in TestFixture-based access control tests, such as when using whenCommandByUser(...), to simulate requests by a specific user.

      Implementations may return null if the user cannot be found, or alternatively return a new, unprivileged User instance. The latter approach allows tests to verify authorization behavior for unknown or default users without requiring explicit user creation.

      Specified by:
      getUserById in interface UserProvider
      Parameters:
      userId - the unique identifier of the user (typically a String or number)
      Returns:
      the matching User, a default unprivileged User, or null if not found
    • getSystemUser

      public User getSystemUser()
      Description copied from interface: UserProvider
      Returns the User representing the system (non-human) identity. Typically used for scheduled messages, internal services, etc.
      Specified by:
      getSystemUser in interface UserProvider
    • fromMessage

      public User fromMessage(HasMessage message)
      Description copied from interface: UserProvider
      Extracts the User from a given HasMessage instance. Implementations may inspect message metadata or payload to resolve the user identity.
      Specified by:
      fromMessage in interface UserProvider
      Parameters:
      message - the message containing potential user-related metadata
      Returns:
      the resolved User, or null if no user info was found
    • containsUser

      public boolean containsUser(Metadata metadata)
      Description copied from interface: UserProvider
      Checks if the given metadata contains user information that can be resolved by this provider.
      Specified by:
      containsUser in interface UserProvider
      Parameters:
      metadata - the metadata to inspect
      Returns:
      true if the metadata contains recognizable user information
    • removeFromMetadata

      public Metadata removeFromMetadata(Metadata metadata)
      Description copied from interface: UserProvider
      Removes any user-related metadata entries from the given Metadata.
      Specified by:
      removeFromMetadata in interface UserProvider
      Parameters:
      metadata - the metadata to clean
      Returns:
      a new Metadata instance without any user-specific keys
    • addToMetadata

      public Metadata addToMetadata(Metadata metadata, User user, boolean ifAbsent)
      Description copied from interface: UserProvider
      Adds user-related metadata to a message.
      Specified by:
      addToMetadata in interface UserProvider
      Parameters:
      metadata - the original metadata
      user - the user to include
      ifAbsent - if true, metadata is only added if not already present
      Returns:
      updated Metadata with user info conditionally added