diff --git a/app/views/epp/domains/info.xml.builder b/app/views/epp/domains/info.xml.builder index 564487370..cef29f662 100644 --- a/app/views/epp/domains/info.xml.builder +++ b/app/views/epp/domains/info.xml.builder @@ -36,6 +36,17 @@ xml.epp_head do end end + xml.tag!('domain:dnssec') do + @domain.dnskeys.each do |x| + xml.tag!('domain:dnskey') do + xml.tag!('domain:flags', x.flags) + xml.tag!('domain:protocol', x.protocol) + xml.tag!('domain:alg', x.alg) + xml.tag!('domain:pubKey', x.public_key) + end + end + end if @domain.dnskeys.any? + ## TODO Find out what this domain:host is all about xml.tag!('domain:clID', @domain.owner_contact_code) diff --git a/spec/epp/domain_spec.rb b/spec/epp/domain_spec.rb index cef16057e..b23c9158f 100644 --- a/spec/epp/domain_spec.rb +++ b/spec/epp/domain_spec.rb @@ -504,6 +504,9 @@ describe 'EPP Domain', epp: true do d = Domain.first d.domain_statuses.build(value: DomainStatus::CLIENT_HOLD, description: 'Payment overdue.') d.nameservers.build(hostname: 'ns1.example.com', ipv4: '192.168.1.1', ipv6: '1080:0:0:0:8:800:200C:417A') + + d.dnskeys.build(flags: 257, protocol: 3, alg: 3, public_key: 'AwEAAddt2AkLfYGKgiEZB5SmIF8EvrjxNMH6HtxWEA4RJ9Ao6LCWheg8') + d.dnskeys.build(flags: 0, protocol: 3, alg: 5, public_key: '700b97b591ed27ec2590d19f06f88bba700b97b591ed27ec2590d19f') d.save response = epp_request(domain_info_xml, :xml) @@ -531,9 +534,20 @@ describe 'EPP Domain', epp: true do expect(inf_data.css('hostAddr').last.text).to eq('1080:0:0:0:8:800:200C:417A') expect(inf_data.css('crDate').text).to eq(d.created_at.to_time.utc.to_s) expect(inf_data.css('exDate').text).to eq(d.valid_to.to_time.utc.to_s) - expect(inf_data.css('pw').text).to eq(d.auth_info) + dnskey_1 = inf_data.css('dnskey')[0] + expect(dnskey_1.css('flags').first.text).to eq('257') + expect(dnskey_1.css('protocol').first.text).to eq('3') + expect(dnskey_1.css('alg').first.text).to eq('3') + expect(dnskey_1.css('pubKey').first.text).to eq('AwEAAddt2AkLfYGKgiEZB5SmIF8EvrjxNMH6HtxWEA4RJ9Ao6LCWheg8') + + dnskey_2 = inf_data.css('dnskey')[1] + expect(dnskey_2.css('flags').first.text).to eq('0') + expect(dnskey_2.css('protocol').first.text).to eq('3') + expect(dnskey_2.css('alg').first.text).to eq('5') + expect(dnskey_2.css('pubKey').first.text).to eq('700b97b591ed27ec2590d19f06f88bba700b97b591ed27ec2590d19f') + d.touch response = epp_request(domain_info_xml, :xml) diff --git a/spec/epp/epp_helper_spec.rb b/spec/epp/epp_helper_spec.rb index 0e5efcef1..79f13ec37 100644 --- a/spec/epp/epp_helper_spec.rb +++ b/spec/epp/epp_helper_spec.rb @@ -16,6 +16,14 @@ describe 'EPP Helper', epp: true do ns2.example.net jd1234 + + + 257 + 3 + 5 + AwEAAddt2AkLfYGKgiEZB5SmIF8EvrjxNMH6HtxWEA4RJ9Ao6LCWheg8 + + sh8013 sh8013 sh801333 @@ -44,6 +52,14 @@ describe 'EPP Helper', epp: true do ns2.test.net 32fsdaf + + + 257 + 3 + 5 + AwEAAddt2AkLfYGKgiEZB5SmIF8EvrjxNMH6HtxWEA4RJ9Ao6LCWheg8 + + 2323rafaf 3dgxx 345xxv @@ -54,18 +70,20 @@ describe 'EPP Helper', epp: true do ').to_s.squish - xml = domain_create_xml( - name: 'one.ee', - period_value: '345', - period_unit: 'd', - nameservers: [{ hostObj: 'ns1.test.net' }, { hostObj: 'ns2.test.net' }], - registrant: '32fsdaf', - contacts: [ - { contact_value: '2323rafaf', contact_type: 'admin' }, - { contact_value: '3dgxx', contact_type: 'tech' }, - { contact_value: '345xxv', contact_type: 'tech' } + xml = domain_create_xml({ + name: { value: 'one.ee' }, + period: {value: '345', attrs: { unit: 'd' } }, + ns: [ + { hostObj: {value: 'ns1.test.net' } }, + { hostObj: {value: 'ns2.test.net' } } + ], + registrant: { value: '32fsdaf' }, + _other: [ + { contact: {value: '2323rafaf', attrs: { type: 'admin' } } }, + { contact: {value: '3dgxx', attrs: { type: 'tech' } } }, + { contact: {value: '345xxv', attrs: { type: 'tech' } } } ] - ) + }) generated = Nokogiri::XML(xml).to_s.squish expect(generated).to eq(expected) @@ -86,13 +104,14 @@ describe 'EPP Helper', epp: true do ').to_s.squish - xml = domain_create_xml( - name: 'one.ee', - period: false, - nameservers: [], - registrant: false, - contacts: [] - ) + xml = domain_create_xml({ + name: { value: 'one.ee' }, + period: nil, + ns: nil, + registrant: nil, + _other: nil, + dnssec: nil + }) generated = Nokogiri::XML(xml).to_s.squish expect(generated).to eq(expected) diff --git a/spec/support/epp.rb b/spec/support/epp.rb index 59e26cb5a..ac23f8edd 100644 --- a/spec/support/epp.rb +++ b/spec/support/epp.rb @@ -58,8 +58,8 @@ module Epp name: { value: 'example.ee' }, period: { value: '1', attrs: { unit: 'y' } }, ns: [ - { hostObj: { value: 'ns1.example.com' } }, - { hostObj: { value: 'ns2.example.com' } } + { hostObj: { value: 'ns1.example.net' } }, + { hostObj: { value: 'ns2.example.net' } } ], registrant: { value: 'jd1234' }, dnssec: [