Class AuthorizationResult


  • public final class AuthorizationResult
    extends Object
    Represents the result of the authorization of a request.
    Since:
    1.5.0
    • Method Detail

      • accessPermitted

        public static AuthorizationResult accessPermitted()
        Creates a new AuthorizationResult instance which indicates that access to the requested protected resource is allowed.
        Returns:
        A successful AuthorizationResult instance.
      • accessDenied

        public static AuthorizationResult accessDenied​(String reason)
        Creates a new AuthorizationResult instance which indicates that access to the request protected resource is denied, for the given reason.
        Parameters:
        reason - The reason why authorization has failed.
        Returns:
        A failed AuthorizationResult instance.
      • accessDenied

        public static AuthorizationResult accessDenied​(String reason,
                                                       JsonValue detail)
        Creates a new AuthorizationResult instance which indicates that access to the request protected resource is denied, for the given reason and detail.
        Parameters:
        reason - The reason why authorization failed.
        detail - A JsonValue containing additional detail on why authorization failed.
        Returns:
        A failed AuthorizationResult instance.
      • isAuthorized

        public boolean isAuthorized()
        Whether the request is authorized to access the requested resource.
        Returns:
        true if the request is authorized.
      • getReason

        public String getReason()
        Gets the reason why the request is not authorized to access the requested resource.
        Returns:
        The reason why authorization failed. null if the request is authorized.
      • getDetail

        public JsonValue getDetail()
        Gets the detail of why the request is not authorized to access the requested resource.
        Returns:
        A JsonValue containing additional detail on why authorization failed. Maybe null when the request is unauthorized or null if the request is authorized.