Class AuthorizationOutcome
java.lang.Object
com.orchestranetworks.rest.security.AuthorizationOutcome
Defines the authorization for whether or not a user can access a REST resource.
The possible states are:
- authorized – the user has access to the REST resource.
- forbidden – the user does not have access to the REST resource. An access denied error response will be returned with, optionally, a message.
- Since:
- 5.9.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic AuthorizationOutcome
createForbidden
(UserMessage anUserMessage) Creates a "forbidden" outcome with a localized message.static AuthorizationOutcome
createForbidden
(String aMessage) Creates a "forbidden" outcome with a message.static AuthorizationOutcome
Factory method that specifies that a user is authorized to access the REST resource.static AuthorizationOutcome
Factory method that specifies that a user is forbidden to access the REST resource.Returns aUserMessage
that must be added to the HTTP response in case of forbidden state.boolean
Defines if the REST resource is accessible according to the evaluatedAuthorizationRule
.boolean
Defines if the REST resource is not accessible according to the evaluatedAuthorizationRule
.
-
Method Details
-
getAuthorized
Factory method that specifies that a user is authorized to access the REST resource.No specific authorization message is returned to the client.
-
getForbidden
Factory method that specifies that a user is forbidden to access the REST resource.No specific message is returned to the client.
-
createForbidden
Creates a "forbidden" outcome with a localized message.- Parameters:
anUserMessage
- specifies thelocalized message
that will be returned to the client- See Also:
-
createForbidden
Creates a "forbidden" outcome with a message.- Parameters:
aMessage
- specifies the message that will be returned to the client- See Also:
-
isAuthorized
public boolean isAuthorized()Defines if the REST resource is accessible according to the evaluatedAuthorizationRule
.- Returns:
true
if the REST resource is considered accessible,false
otherwise
-
isForbidden
public boolean isForbidden()Defines if the REST resource is not accessible according to the evaluatedAuthorizationRule
.- Returns:
true
if the REST resource is considered not accessible,false
otherwise
-
getMessage
Returns aUserMessage
that must be added to the HTTP response in case of forbidden state.- Returns:
- the message.
-