Enum Class NoOpUserProvider
java.lang.Object
java.lang.Enum<NoOpUserProvider>
io.fluxcapacitor.javaclient.tracking.handling.authentication.NoOpUserProvider
- All Implemented Interfaces:
UserProvider
,Serializable
,Comparable<NoOpUserProvider>
,Constable
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum Constants -
Field Summary
Fields inherited from interface io.fluxcapacitor.javaclient.tracking.handling.authentication.UserProvider
defaultUserProvider
-
Method Summary
Modifier and TypeMethodDescriptionaddToMetadata
(Metadata metadata, User user, boolean ifAbsent) Adds user-related metadata to a message.boolean
containsUser
(Metadata metadata) Checks if the given metadata contains user information that can be resolved by this provider.fromMessage
(HasMessage message) Extracts theUser
from a givenHasMessage
instance.Returns theUser
representing the system (non-human) identity.getUserById
(Object userId) Retrieves aUser
by their unique identifier.removeFromMetadata
(Metadata metadata) Removes any user-related metadata entries from the givenMetadata
.static NoOpUserProvider
Returns the enum constant of this class with the specified name.static NoOpUserProvider[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.Methods inherited from class java.lang.Enum
clone, compareTo, describeConstable, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
Methods inherited from interface io.fluxcapacitor.javaclient.tracking.handling.authentication.UserProvider
addToMetadata, andThen, getActiveUser
-
Enum Constant Details
-
INSTANCE
-
-
Method Details
-
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
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 nameNullPointerException
- if the argument is null
-
getUserById
Description copied from interface:UserProvider
Retrieves aUser
by their unique identifier.This method is primarily used in
TestFixture
-based access control tests, such as when usingwhenCommandByUser(...)
, to simulate requests by a specific user.Implementations may return
null
if the user cannot be found, or alternatively return a new, unprivilegedUser
instance. The latter approach allows tests to verify authorization behavior for unknown or default users without requiring explicit user creation.- Specified by:
getUserById
in interfaceUserProvider
- Parameters:
userId
- the unique identifier of the user (typically a String or number)- Returns:
- the matching
User
, a default unprivilegedUser
, ornull
if not found
-
getSystemUser
Description copied from interface:UserProvider
Returns theUser
representing the system (non-human) identity. Typically used for scheduled messages, internal services, etc.- Specified by:
getSystemUser
in interfaceUserProvider
-
fromMessage
Description copied from interface:UserProvider
Extracts theUser
from a givenHasMessage
instance. Implementations may inspect message metadata or payload to resolve the user identity.- Specified by:
fromMessage
in interfaceUserProvider
- Parameters:
message
- the message containing potential user-related metadata- Returns:
- the resolved
User
, ornull
if no user info was found
-
containsUser
Description copied from interface:UserProvider
Checks if the given metadata contains user information that can be resolved by this provider.- Specified by:
containsUser
in interfaceUserProvider
- Parameters:
metadata
- the metadata to inspect- Returns:
true
if the metadata contains recognizable user information
-
removeFromMetadata
Description copied from interface:UserProvider
Removes any user-related metadata entries from the givenMetadata
.- Specified by:
removeFromMetadata
in interfaceUserProvider
- Parameters:
metadata
- the metadata to clean- Returns:
- a new
Metadata
instance without any user-specific keys
-
addToMetadata
Description copied from interface:UserProvider
Adds user-related metadata to a message.- Specified by:
addToMetadata
in interfaceUserProvider
- Parameters:
metadata
- the original metadatauser
- the user to includeifAbsent
- iftrue
, metadata is only added if not already present- Returns:
- updated
Metadata
with user info conditionally added
-