Class DomainLockUtils

java.lang.Object
google.registry.tools.DomainLockUtils

public final class DomainLockUtils extends Object
Utility functions for validating and applying RegistryLocks.

For both locks and unlocks, a lock must be requested via the createRegistry*Request methods then verified through the verifyAndApply* methods. These methods will verify that the domain in question is in a lock/unlockable state and will return the lock object.

  • Constructor Details

    • DomainLockUtils

      @Inject public DomainLockUtils(@Named("base58StringGenerator") StringGenerator stringGenerator, @Config("registryAdminClientId") String registryAdminRegistrarId, CloudTasksUtils cloudTasksUtils)
  • Method Details

    • saveNewRegistryLockRequest

      public RegistryLock saveNewRegistryLockRequest(String domainName, String registrarId, @Nullable String registrarPocId, boolean isAdmin)
      Creates and persists a lock request when requested by a user.

      The lock will not be applied until verifyAndApplyLock(java.lang.String, boolean) is called.

    • saveNewRegistryUnlockRequest

      public RegistryLock saveNewRegistryUnlockRequest(String domainName, String registrarId, boolean isAdmin, Optional<org.joda.time.Duration> relockDuration)
      Creates and persists an unlock request when requested by a user.

      The unlock will not be applied until verifyAndApplyUnlock(java.lang.String, boolean) is called.

    • verifyAndApplyLock

      public RegistryLock verifyAndApplyLock(String verificationCode, boolean isAdmin)
      Verifies and applies the lock request previously requested by a user.
    • verifyAndApplyUnlock

      public RegistryLock verifyAndApplyUnlock(String verificationCode, boolean isAdmin)
      Verifies and applies the unlock request previously requested by a user.
    • administrativelyApplyLock

      public RegistryLock administrativelyApplyLock(String domainName, String registrarId, @Nullable String registrarPocId, boolean isAdmin)
      Creates and applies a lock in one step.

      This should only be used for admin actions, e.g. Nomulus tool commands or relocks. Note: in the case of relocks, isAdmin is determined by the previous lock.

    • administrativelyApplyUnlock

      public RegistryLock administrativelyApplyUnlock(String domainName, String registrarId, boolean isAdmin, Optional<org.joda.time.Duration> relockDuration)
      Creates and applies an unlock in one step.

      This should only be used for admin actions, e.g. Nomulus tool commands.

    • enqueueDomainRelock

      public void enqueueDomainRelock(RegistryLock lock)
      Enqueues a task to asynchronously re-lock a registry-locked domain after it was unlocked.

      Note: the relockDuration must be present on the lock object.

    • enqueueDomainRelock

      public void enqueueDomainRelock(org.joda.time.Duration countdown, long lockRevisionId, int previousAttempts)
      Enqueues a task to asynchronously re-lock a registry-locked domain after it was unlocked.