Class AllocationTokenFlowUtils
- java.lang.Object
-
- google.registry.flows.domain.token.AllocationTokenFlowUtils
-
public class AllocationTokenFlowUtils extends java.lang.Object
Utility functions for dealing withAllocationToken
s in domain flows.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
AllocationTokenFlowUtils.AllocationTokenNotInPromotionException
The allocation token is not currently valid.static class
AllocationTokenFlowUtils.AllocationTokenNotValidForDomainException
The allocation token is not valid for this domain.static class
AllocationTokenFlowUtils.AllocationTokenNotValidForRegistrarException
The allocation token is not valid for this registrar.static class
AllocationTokenFlowUtils.AllocationTokenNotValidForTldException
The allocation token is not valid for this TLD.static class
AllocationTokenFlowUtils.AlreadyRedeemedAllocationTokenException
The allocation token was already redeemed.static class
AllocationTokenFlowUtils.InvalidAllocationTokenException
The allocation token is invalid.static class
AllocationTokenFlowUtils.MissingRemovePackageTokenOnPackageDomainException
The __REMOVEPACKAGE__ token is missing on a package domain commandstatic class
AllocationTokenFlowUtils.RemovePackageTokenOnNonPackageDomainException
The __REMOVEPACKAGE__ token is not allowed on non package domains
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description AllocationTokenDomainCheckResults
checkDomainsWithToken(java.util.List<com.google.common.net.InternetDomainName> domainNames, java.lang.String token, java.lang.String registrarId, org.joda.time.DateTime now)
Checks if the allocation token applies to the given domain names, used for domain checks.static Domain
maybeApplyPackageRemovalToken(Domain domain, java.util.Optional<AllocationToken> allocationToken)
AllocationToken
redeemToken(AllocationToken token, HistoryEntry.HistoryEntryId redemptionHistoryId)
Redeems a SINGLE_USEAllocationToken
, returning the redeemed copy.static void
validateToken(com.google.common.net.InternetDomainName domainName, AllocationToken token, java.lang.String registrarId, org.joda.time.DateTime now)
Validates a given token.java.util.Optional<AllocationToken>
verifyAllocationTokenCreateIfPresent(DomainCommand.Create command, Registry registry, java.lang.String registrarId, org.joda.time.DateTime now, java.util.Optional<AllocationTokenExtension> extension)
Verifies and returns the allocation token if one is specified, otherwise does nothing.java.util.Optional<AllocationToken>
verifyAllocationTokenIfPresent(Domain existingDomain, Registry registry, java.lang.String registrarId, org.joda.time.DateTime now, java.util.Optional<AllocationTokenExtension> extension)
Verifies and returns the allocation token if one is specified, otherwise does nothing.static void
verifyTokenAllowedOnDomain(Domain domain, java.util.Optional<AllocationToken> allocationToken)
-
-
-
Method Detail
-
checkDomainsWithToken
public AllocationTokenDomainCheckResults checkDomainsWithToken(java.util.List<com.google.common.net.InternetDomainName> domainNames, java.lang.String token, java.lang.String registrarId, org.joda.time.DateTime now)
Checks if the allocation token applies to the given domain names, used for domain checks.- Returns:
- A map of domain names to domain check error response messages. If a message is present for a a given domain then it does not validate with this allocation token; domains that do validate have blank messages (i.e. no error).
-
redeemToken
public AllocationToken redeemToken(AllocationToken token, HistoryEntry.HistoryEntryId redemptionHistoryId)
Redeems a SINGLE_USEAllocationToken
, returning the redeemed copy.
-
validateToken
public static void validateToken(com.google.common.net.InternetDomainName domainName, AllocationToken token, java.lang.String registrarId, org.joda.time.DateTime now) throws EppException
Validates a given token. The token could be invalid if it has allowed client IDs or TLDs that do not include this client ID / TLD, or if the token has a promotion that is not currently running.- Throws:
EppException
- if the token is invalid in any way
-
verifyAllocationTokenCreateIfPresent
public java.util.Optional<AllocationToken> verifyAllocationTokenCreateIfPresent(DomainCommand.Create command, Registry registry, java.lang.String registrarId, org.joda.time.DateTime now, java.util.Optional<AllocationTokenExtension> extension) throws EppException
Verifies and returns the allocation token if one is specified, otherwise does nothing.- Throws:
EppException
-
verifyAllocationTokenIfPresent
public java.util.Optional<AllocationToken> verifyAllocationTokenIfPresent(Domain existingDomain, Registry registry, java.lang.String registrarId, org.joda.time.DateTime now, java.util.Optional<AllocationTokenExtension> extension) throws EppException
Verifies and returns the allocation token if one is specified, otherwise does nothing.- Throws:
EppException
-
verifyTokenAllowedOnDomain
public static void verifyTokenAllowedOnDomain(Domain domain, java.util.Optional<AllocationToken> allocationToken) throws EppException
- Throws:
EppException
-
maybeApplyPackageRemovalToken
public static Domain maybeApplyPackageRemovalToken(Domain domain, java.util.Optional<AllocationToken> allocationToken)
-
-