Class Scope

java.lang.Object
sonia.scm.security.Scope
All Implemented Interfaces:
Iterable<String>

public final class Scope extends Object implements Iterable<String>
Scope of a token. A scope is able to reduce the permissions of a token authentication. That means we can issue a token which is only suitable for a single or a set of actions e.g.: we could create a token which can only read a single repository. The values of the scope should be explicit string representations of shiro permissions. An empty scope means all permissions of the user.
Since:
2.0.0
  • Method Details

    • iterator

      public Iterator<String> iterator()
      Specified by:
      iterator in interface Iterable<String>
    • isEmpty

      public boolean isEmpty()
      Returns true if the scope is empty.
    • empty

      public static Scope empty()
      Creates an empty scope.
    • valueOf

      public static Scope valueOf(Iterable<String> values)
      Creates a scope object from the given iterable.
      Parameters:
      values - values of scope
      Returns:
      new scope
    • valueOf

      public static Scope valueOf(String... values)
      Create a scope from the given array.
      Parameters:
      values - values of scope
      Returns:
      new scope.
    • toString

      public String toString()
      Overrides:
      toString in class Object