Package org.forgerock.authz.filter.api
Class AuthorizationResult
- java.lang.Object
-
- org.forgerock.authz.filter.api.AuthorizationResult
-
public final class AuthorizationResult extends Object
Represents the result of the authorization of a request.- Since:
- 1.5.0
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static AuthorizationResult
accessDenied(String reason)
Creates a newAuthorizationResult
instance which indicates that access to the request protected resource is denied, for the given reason.static AuthorizationResult
accessDenied(String reason, JsonValue detail)
Creates a newAuthorizationResult
instance which indicates that access to the request protected resource is denied, for the given reason and detail.static AuthorizationResult
accessPermitted()
Creates a newAuthorizationResult
instance which indicates that access to the requested protected resource is allowed.JsonValue
getDetail()
Gets the detail of why the request is not authorized to access the requested resource.String
getReason()
Gets the reason why the request is not authorized to access the requested resource.boolean
isAuthorized()
Whether the request is authorized to access the requested resource.
-
-
-
Method Detail
-
accessPermitted
public static AuthorizationResult accessPermitted()
Creates a newAuthorizationResult
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 newAuthorizationResult
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 newAuthorizationResult
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
- AJsonValue
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. Maybenull
when the request is unauthorized ornull
if the request is authorized.
-
-