Annotation Interface NoUserRequired


This annotation allows a message handler or payload to be invoked even if the current user is not authenticated. It effectively overrides broader authentication requirements — for example, those set by RequiresUser on a root or parent package or class.

@NoUserRequired is particularly useful in applications where most handlers require authentication, but you want to selectively permit anonymous access to specific messages or operations (e.g., public APIs, health checks).

Note that @NoUserRequired is not the inverse of RequiresUser — it does not forbid authenticated users, nor does it prevent handling if a user is present. It simply removes the requirement for authentication in the context where it is applied.

Example usage:


 @NoUserRequired
 @HandleCommand
 void handle(SignUpUser command) {
     // This can be invoked by anonymous users
 }