Class Authorization


public class Authorization extends Object
An Authorization is granted by an Authority in response to an access token.
  • Field Details


      public static final Authorization UNAUTHORIZED
      An Authorization that disallows everything
  • Constructor Details

    • Authorization

      public Authorization(String name, Collection<String> grants, long maxBufferSize, String accessToken, Json defaults, Json overrides)
      Create a new Authorization
      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

    • 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.
      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()
    • 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()
      toString in class Object