Annotation Interface ForbidsUser


Indicates that a handler method, class, package, or payload should not be invoked or processed if a user is currently authenticated.

This annotation acts as a negative filter for message handling based on user presence.

Useful for restricting certain behavior to unauthenticated flows only — such as registration, public APIs, or guest access paths.

See Also:
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    boolean
    Determines whether an exception should be thrown when the authorization check fails.
  • Element Details

    • throwIfUnauthorized

      boolean throwIfUnauthorized
      Determines whether an exception should be thrown when the authorization check fails.

      If true (the default), an UnauthorizedException will be thrown when a user is present.

      If false, the annotated handler or message will be silently skipped instead.

      This opt-out strategy is useful for conditionally invoked handlers where fallback behavior is preferred.

      Default:
      true