Package org.faceless.publisher.web
Class Authorization
java.lang.Object
org.faceless.publisher.web.Authorization
An Authorization is granted by an Authority in response to an access token.
-
Constructor Summary
ConstructorsConstructorDescriptionAuthorization
(String name, Collection<String> grants, long maxBufferSize, String accessToken, String accessControlAllowOrigin, Json defaults, Json overrides) Create a new Authorization -
Method Summary
Modifier and TypeMethodDescriptionvoid
applyDefaultsAndOverrides
(String type, Json data) Apply the defaults for this type under the supplied json object, and the overrides over itReturn the value to set as the Access-Control-Allow-Origin header, if applicable, or nullReturn the full access-token, which may be empty but will never be nulllong
getName()
Return the user namestatic final Authorization
getUnauthorized
(String origin) Return an Authorization that disallows everythingboolean
isAuthorized
(String... required) Check if this Authorization allows all the specified requirements Requirements can be of the form "ws", "admin/pause" - no wildcards.toString()
-
Constructor Details
-
Authorization
public Authorization(String name, Collection<String> grants, long maxBufferSize, String accessToken, String accessControlAllowOrigin, Json defaults, Json overrides) Create a new Authorization- Parameters:
name
- the user namegrants
- the grants this Authorization has - may include wildcards, * eg "*" or "**" or "admin/*". "*" matches one, "**" matches any segmentsmaxBufferSize
- the maximum buffer size allowed with this AuthorizationaccessToken
- the bearer tokendefaults
- the Authorization defaultsoverrides
- the Authorization overrides
-
-
Method Details
-
getUnauthorized
Return an Authorization that disallows everything- Parameters:
accessControlAllowOrigin
- the AccessControlAllowOrigin header (may be null)
-
isAuthorized
Check if this Authorization allows all the specified requirements Requirements can be of the form "ws", "admin/pause" - no wildcards.- Returns:
- true if all specified requiremnts are met, false otherwise
-
getMaxBufferSize
public long getMaxBufferSize() -
getAccessToken
Return the full access-token, which may be empty but will never be null -
getName
Return the user name -
getAccessControlAllowOrigin
Return the value to set as the Access-Control-Allow-Origin header, if applicable, or null -
applyDefaultsAndOverrides
Apply the defaults for this type under the supplied json object, and the overrides over it -
toString
-