Class AuthScope

java.lang.Object
com.peterphi.std.guice.common.auth.AuthScope

public class AuthScope extends Object
  • Constructor Details

  • Method Details

    • getSkip

      public boolean getSkip(AuthConstraint annotation)
      Determine the value of "skip" for a given (optionally annotated) method. The rule for this is:
      1. If config contains force-skip, use that value
      2. If AuthConstraint annotation is present and skip is true, the result is true (e.g. for login pages and other open resources)
      3. Otherwise, if there's a value in config for "skip", use that
      4. Otherwise, if the AuthConstraint annotation is present, use the skip value from that
      5. Otherwise (e.g. for no AuthConstraint annotated REST methods), the default is not to skip
      Parameters:
      annotation -
      Returns:
    • getRoles

      public List<String> getRoles(AuthConstraint annotation) throws IllegalArgumentException
      Determine the required role for a given (optionally annotated) method. The rule for this is simple priority:
      1. Roles specified in config for this scope id
      2. Annotated roles
      3. If no annotation and no configured roles, throw an IllegalArgumentException
      Parameters:
      annotation -
      Returns:
      Throws:
      IllegalArgumentException - If no annotation and no configured role
    • toString

      public String toString()
      Overrides:
      toString in class Object