Class Scopes

java.lang.Object
land.oras.auth.Scopes

@NullMarked public final class Scopes extends Object
Store scopes
  • Method Details

    • of

      public static Scopes of(ContainerRef containerRef, Scope... scopes)
      Create a new Scopes object
      Parameters:
      containerRef - The container reference
      scopes - The scopes
      Returns:
      A new Scopes object
    • of

      public static Scopes of(String service, ContainerRef containerRef, Scope... scopes)
      Create a new Scopes object
      Parameters:
      service - The service
      containerRef - The container reference
      scopes - The scopes
      Returns:
      A new Scopes object
    • empty

      public static Scopes empty(ContainerRef containerRef, String service)
      Create a new Scopes object with no scopes
      Parameters:
      containerRef - The container reference
      service - The service
      Returns:
      A new Scopes object with no scopes
    • withRegistryScopes

      public Scopes withRegistryScopes(Scope... scopes)
      Return a new copy of the Scopes object with the given scopes
      Parameters:
      scopes - The scopes to set
      Returns:
      A new Scopes object with the given scopes
    • withAddedRegistryScopes

      public Scopes withAddedRegistryScopes(Scope... newScopes)
      Return a new copy of the Scopes object with the added scopes
      Parameters:
      newScopes - The scopes to add
      Returns:
      A new Scopes object with the given scopes
    • withAddedGlobalScopes

      public Scopes withAddedGlobalScopes(String... globalScopes)
      Return a new copy of the Scopes object with the given scopes
      Parameters:
      globalScopes - The global scopes to add
      Returns:
      A new Scopes object with the given scopes
    • withOnlyGlobalScopes

      public Scopes withOnlyGlobalScopes()
      Return scopes that only contains global scopes (i.e. no repository or registry scopes)
      Returns:
      A new Scopes object with only global scopes
    • withoutGlobalScopes

      public Scopes withoutGlobalScopes()
      Return scopes that only contains non-global scopes (i.e. only repository or registry scopes)
      Returns:
      A new Scopes object with only non-global scopes
    • withNewScope

      public Scopes withNewScope(String scope)
      Return a new copy of the Scopes object with the given scope
      Parameters:
      scope - The scope to add
      Returns:
      A new Scopes object with the given scope
    • withService

      public Scopes withService(@Nullable String service)
      Return a new copy of the Scopes object with the given service
      Parameters:
      service - The service to set
      Returns:
      A new Scopes object with the given service
    • getService

      public @Nullable String getService()
      Get the service
      Returns:
      The service
    • getScopes

      public List<String> getScopes()
      Get the scopes
      Returns:
      The scopes
    • getRegistry

      public String getRegistry()
      Get the registry
      Returns:
      The registry
    • getContainerRef

      public ContainerRef getContainerRef()
      Get the container reference
      Returns:
      The container reference
    • isGlobal

      public boolean isGlobal()
      Return if these are global scopes (i.e. no repository or registry scopes) Typically AWS ECR uses global scopes for authentication, while Docker Hub uses repository scopes.
      Returns:
      True if these are global scopes, false otherwise
    • hasGlobalScopes

      public boolean hasGlobalScopes()
      Return if these scopes include global scopes (i.e. at least one scope that is not a repository or registry scope)
      Returns:
      True if these scopes include global scopes, false otherwise
    • isPullOnly

      public boolean isPullOnly()
      Return if these are pull-only scopes (i.e. all scopes end with ":pull" and there are no global scopes)
      Returns:
      True if these are pull-only scopes, false otherwise
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object