Class Authorization

java.lang.Object
org.faceless.publisher.web.Authorization

public class Authorization extends Object
An Authorization is granted by an Authority in response to an access token.
  • 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 name
      grants - the grants this Authorization has - may include wildcards, * eg "*" or "**" or "admin/*". "*" matches one, "**" matches any segments
      maxBufferSize - the maximum buffer size allowed with this Authorization
      accessToken - the bearer token
      defaults - the Authorization defaults
      overrides - the Authorization overrides
  • Method Details

    • getUnauthorized

      public static final Authorization getUnauthorized(String origin)
      Return an Authorization that disallows everything
      Parameters:
      accessControlAllowOrigin - the AccessControlAllowOrigin header (may be null)
    • isAuthorized

      public boolean isAuthorized(String... required)
      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

      public String getAccessToken()
      Return the full access-token, which may be empty but will never be null
    • getName

      public String getName()
      Return the user name
    • getAccessControlAllowOrigin

      public String getAccessControlAllowOrigin()
      Return the value to set as the Access-Control-Allow-Origin header, if applicable, or null
    • applyDefaultsAndOverrides

      public void applyDefaultsAndOverrides(String type, Json data)
      Apply the defaults for this type under the supplied json object, and the overrides over it
    • toString

      public String toString()
      Overrides:
      toString in class Object