mirror of
https://github.com/google/nomulus.git
synced 2025-04-30 03:57:51 +02:00
Allow usage of allocation tokens in nomulus create_domain (#1756)
Useful when doing internal registrations like get.boo
This commit is contained in:
parent
c118af0d6a
commit
3c0805def5
4 changed files with 55 additions and 2 deletions
|
@ -46,6 +46,11 @@ final class CreateDomainCommand extends CreateOrUpdateDomainCommand
|
||||||
description = "Force the creation of premium domains.")
|
description = "Force the creation of premium domains.")
|
||||||
private boolean forcePremiums;
|
private boolean forcePremiums;
|
||||||
|
|
||||||
|
@Parameter(
|
||||||
|
names = "--allocation_token",
|
||||||
|
description = "Allocation token to use when creating the domain(s)")
|
||||||
|
private String allocationToken;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
@Named("base64StringGenerator")
|
@Named("base64StringGenerator")
|
||||||
StringGenerator passwordGenerator;
|
StringGenerator passwordGenerator;
|
||||||
|
@ -92,7 +97,8 @@ final class CreateDomainCommand extends CreateOrUpdateDomainCommand
|
||||||
"currency", currency,
|
"currency", currency,
|
||||||
"price", cost,
|
"price", cost,
|
||||||
"dsRecords", DsRecord.convertToSoy(dsRecords),
|
"dsRecords", DsRecord.convertToSoy(dsRecords),
|
||||||
"reason", reason);
|
"reason", reason,
|
||||||
|
"allocationToken", allocationToken);
|
||||||
if (requestedByRegistrar != null) {
|
if (requestedByRegistrar != null) {
|
||||||
soyMapData.put("requestedByRegistrar", requestedByRegistrar.toString());
|
soyMapData.put("requestedByRegistrar", requestedByRegistrar.toString());
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
{@param dsRecords: list<[keyTag:int, alg:int, digestType:int, digest:string]>}
|
{@param dsRecords: list<[keyTag:int, alg:int, digestType:int, digest:string]>}
|
||||||
{@param? reason: string}
|
{@param? reason: string}
|
||||||
{@param? requestedByRegistrar: string}
|
{@param? requestedByRegistrar: string}
|
||||||
|
{@param? allocationToken: string}
|
||||||
|
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||||
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
|
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
|
||||||
|
@ -56,7 +57,7 @@
|
||||||
</domain:authInfo>
|
</domain:authInfo>
|
||||||
</domain:create>
|
</domain:create>
|
||||||
</create>
|
</create>
|
||||||
{if length($dsRecords) > 0 or $price != null or $reason or $requestedByRegistrar}
|
{if length($dsRecords) > 0 or $price != null or $reason or $requestedByRegistrar or $allocationToken}
|
||||||
<extension>
|
<extension>
|
||||||
{if $price != null}
|
{if $price != null}
|
||||||
<fee:create xmlns:fee="urn:ietf:params:xml:ns:fee-0.12">
|
<fee:create xmlns:fee="urn:ietf:params:xml:ns:fee-0.12">
|
||||||
|
@ -86,6 +87,13 @@
|
||||||
{/if}
|
{/if}
|
||||||
</metadata:metadata>
|
</metadata:metadata>
|
||||||
{/if}
|
{/if}
|
||||||
|
{if $allocationToken}
|
||||||
|
<allocationToken:allocationToken
|
||||||
|
xmlns:allocationToken=
|
||||||
|
"urn:ietf:params:xml:ns:allocationToken-1.0">
|
||||||
|
{$allocationToken}
|
||||||
|
</allocationToken:allocationToken>
|
||||||
|
{/if}
|
||||||
</extension>
|
</extension>
|
||||||
{/if}
|
{/if}
|
||||||
<clTRID>RegistryTool</clTRID>
|
<clTRID>RegistryTool</clTRID>
|
||||||
|
|
|
@ -179,6 +179,19 @@ class CreateDomainCommandTest extends EppToolCommandTestCase<CreateDomainCommand
|
||||||
eppVerifier.verifySent("domain_create_metadata.xml");
|
eppVerifier.verifySent("domain_create_metadata.xml");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testSuccess_allocationToken() throws Exception {
|
||||||
|
createTld("tld");
|
||||||
|
runCommandForced(
|
||||||
|
"--client=NewRegistrar",
|
||||||
|
"--registrant=crr-admin",
|
||||||
|
"--admins=crr-admin",
|
||||||
|
"--techs=crr-tech",
|
||||||
|
"--allocation_token=abc123",
|
||||||
|
"example.tld");
|
||||||
|
eppVerifier.verifySent("domain_create_token.xml");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testFailure_duplicateDomains() {
|
void testFailure_duplicateDomains() {
|
||||||
IllegalArgumentException thrown =
|
IllegalArgumentException thrown =
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||||
|
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
|
||||||
|
<command>
|
||||||
|
<create>
|
||||||
|
<domain:create
|
||||||
|
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
|
||||||
|
<domain:name>example.tld</domain:name>
|
||||||
|
<domain:period unit="y">1</domain:period>
|
||||||
|
<domain:registrant>crr-admin</domain:registrant>
|
||||||
|
<domain:contact type="admin">crr-admin</domain:contact>
|
||||||
|
<domain:contact type="tech">crr-tech</domain:contact>
|
||||||
|
<domain:authInfo>
|
||||||
|
<domain:pw>abcdefghijklmnop</domain:pw>
|
||||||
|
</domain:authInfo>
|
||||||
|
</domain:create>
|
||||||
|
</create>
|
||||||
|
<extension>
|
||||||
|
<allocationToken:allocationToken
|
||||||
|
xmlns:allocationToken=
|
||||||
|
"urn:ietf:params:xml:ns:allocationToken-1.0">
|
||||||
|
abc123
|
||||||
|
</allocationToken:allocationToken>
|
||||||
|
</extension>
|
||||||
|
<clTRID>RegistryTool</clTRID>
|
||||||
|
</command>
|
||||||
|
</epp>
|
Loading…
Add table
Reference in a new issue