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 AuthorizationOutcomecreateForbidden(UserMessage anUserMessage) Creates a "forbidden" outcome with a localized message.static AuthorizationOutcomecreateForbidden(String aMessage) Creates a "forbidden" outcome with a message.static AuthorizationOutcomeFactory method that specifies that a user is authorized to access the REST resource.static AuthorizationOutcomeFactory method that specifies that a user is forbidden to access the REST resource.Returns aUserMessagethat must be added to the HTTP response in case of forbidden state.booleanDefines if the REST resource is accessible according to the evaluatedAuthorizationRule.booleanDefines 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 messagethat 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:
trueif the REST resource is considered accessible,falseotherwise
-
isForbidden
public boolean isForbidden()Defines if the REST resource is not accessible according to the evaluatedAuthorizationRule.- Returns:
trueif the REST resource is considered not accessible,falseotherwise
-
getMessage
Returns aUserMessagethat must be added to the HTTP response in case of forbidden state.- Returns:
- the message.
-