Class Authority

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

public class Authority extends Object
An Authority authorizes "grants" on a ServiceEngine to be run remotely. One or more are required to allow normal use. At a minimum they require a Key (public or secret) and one or more grants which they can approve. Requests made to the service engine will be tested against each authority and the first one that matches will be used to configure the job.
  • Field Details

    • ALLOWALL

      public static final Authority ALLOWALL
      A generic authority that allows all operations without restriction
  • Constructor Details

    • Authority

      public Authority()
      Create a new Authority
    • Authority

      public Authority(Json json)
      Create a new Authority by parsing the supplied Json
      Parameters:
      json - the json decsribing the Authority
  • Method Details

    • setKey

      public Authority setKey(Key key)
      Set the the Key for this Authority
      Parameters:
      key - the PublicKey or SecretKey
    • setGrants

      public Authority setGrants(Collection<String> grants)
      Set the the list of grants approved by this Authority
      Parameters:
      grants - the grants
    • setMaxBufferSize

      public Authority setMaxBufferSize(long limit)
      Set the the maximum buffer size for network traffic claiming this authority
      Parameters:
      limit - the limit, or 0 for no limit
    • matches

      public boolean matches(InetAddress ip)
      Return true of this authority matches the specified IP address
      Parameters:
      ip - the address
      Returns:
      true if this authority applies
    • originMatches

      public boolean originMatches(String origin, StringBuilder header)
      Return true of this authority matches the specified HTTP Origin header
      Parameters:
      origin - the origin
      header - if not null, the StringBuffer will be populated with the values for the "Access-Control-Allow-Origin" header
      Returns:
      true if this authority applies
    • getMatches

      public Collection<String> getMatches()
      Return the a read-only list of "matches" from this Authority
    • getGrants

      public Collection<String> getGrants()
      Return the a read-only list of "grants" from this Authority
    • getMaxBufferSize

      public long getMaxBufferSize()
      Return the the max-buffer-size from this Authority
    • getDefaults

      public Json getDefaults()
      Return the the set of Json "defaults" for this Authority
    • getOverrides

      public Json getOverrides()
      Return the the set of Json "overrides" for this Authority
    • getKey

      public Key getKey()
      Return the the public or secret key for this Authority
    • toString

      public String toString()
      Overrides:
      toString in class Object