Class AccessCheckResult

java.lang.Object
com.vaadin.flow.server.auth.AccessCheckResult
All Implemented Interfaces:
Serializable

public class AccessCheckResult extends Object implements Serializable
A representation of the access check result, potentially providing deny reason.
See Also:
  • Constructor Details

    • AccessCheckResult

      public AccessCheckResult(AccessCheckDecision decision, String reason)
      Creates a new result.
      Parameters:
      decision - the access checker decision.
      reason - a message explaining the reason for that decision.
  • Method Details

    • decision

      public AccessCheckDecision decision()
      Gets the navigation access checker decision.
      Returns:
      the navigation access checker decision, never null.
    • reason

      public String reason()
      Gets the reason for the navigation access checker decision.

      May be null for allow and neutral decisions.

      Returns:
      the reason for the navigation access checker decision.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

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

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

      public static AccessCheckResult create(AccessCheckDecision decision, String reason)
      Create a result instance for the provided decision and reason.

      The reason cannot be null for AccessCheckDecision.DENY and AccessCheckDecision.REJECT. For AccessCheckDecision.ALLOW the reason is ignored.
      Parameters:
      decision - the decision for this result, never null.
      reason - a message explaining why the current decision has been taken. Useful for debugging purposes.
      Returns:
      a result instance for given decision and reason.
    • allow

      public static AccessCheckResult allow()
      Create a result instance informing that the navigation to the target view is allowed for the current user.
      Returns:
      a AccessCheckDecision.ALLOW result instance.
    • neutral

      public static AccessCheckResult neutral()
      Create a result instance informing that the checker cannot take a decision based on the given navigation information.
      Returns:
      a AccessCheckDecision.NEUTRAL result instance.
    • deny

      public static AccessCheckResult deny(String reason)
      Create a result instance informing that the navigation to the target view is denied for the current user.
      Parameters:
      reason - a message explaining why the navigation has been denied. Useful for debugging purposes.
      Returns:
      a AccessCheckDecision.DENY result instance.
    • reject

      public static AccessCheckResult reject(String reason)
      Create a result instance informing that the navigation to the target view is denied for the current user because of a misconfiguration or a critical development time error.
      Parameters:
      reason - a message explaining why the navigation has been denied and the critical issue encountered. Useful for debugging purposes.
      Returns:
      a AccessCheckDecision.REJECT result instance.