mirror of
https://github.com/internetee/registry.git
synced 2025-07-03 01:33:36 +02:00
Rails update, request validation
This commit is contained in:
parent
4744a35dd9
commit
4684b311a2
13 changed files with 1047 additions and 70 deletions
2
Gemfile
2
Gemfile
|
@ -1,6 +1,6 @@
|
|||
source 'https://rubygems.org'
|
||||
|
||||
gem 'rails', '4.1.1'
|
||||
gem 'rails', '4.1.4'
|
||||
|
||||
# Use postgresql as the database for Active Record
|
||||
gem 'pg'
|
||||
|
|
52
Gemfile.lock
52
Gemfile.lock
|
@ -1,27 +1,27 @@
|
|||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
actionmailer (4.1.1)
|
||||
actionpack (= 4.1.1)
|
||||
actionview (= 4.1.1)
|
||||
actionmailer (4.1.4)
|
||||
actionpack (= 4.1.4)
|
||||
actionview (= 4.1.4)
|
||||
mail (~> 2.5.4)
|
||||
actionpack (4.1.1)
|
||||
actionview (= 4.1.1)
|
||||
activesupport (= 4.1.1)
|
||||
actionpack (4.1.4)
|
||||
actionview (= 4.1.4)
|
||||
activesupport (= 4.1.4)
|
||||
rack (~> 1.5.2)
|
||||
rack-test (~> 0.6.2)
|
||||
actionview (4.1.1)
|
||||
activesupport (= 4.1.1)
|
||||
actionview (4.1.4)
|
||||
activesupport (= 4.1.4)
|
||||
builder (~> 3.1)
|
||||
erubis (~> 2.7.0)
|
||||
activemodel (4.1.1)
|
||||
activesupport (= 4.1.1)
|
||||
activemodel (4.1.4)
|
||||
activesupport (= 4.1.4)
|
||||
builder (~> 3.1)
|
||||
activerecord (4.1.1)
|
||||
activemodel (= 4.1.1)
|
||||
activesupport (= 4.1.1)
|
||||
activerecord (4.1.4)
|
||||
activemodel (= 4.1.4)
|
||||
activesupport (= 4.1.4)
|
||||
arel (~> 5.0.0)
|
||||
activesupport (4.1.1)
|
||||
activesupport (4.1.4)
|
||||
i18n (~> 0.6, >= 0.6.9)
|
||||
json (~> 1.7, >= 1.7.7)
|
||||
minitest (~> 5.1)
|
||||
|
@ -94,19 +94,19 @@ GEM
|
|||
rack (1.5.2)
|
||||
rack-test (0.6.2)
|
||||
rack (>= 1.0)
|
||||
rails (4.1.1)
|
||||
actionmailer (= 4.1.1)
|
||||
actionpack (= 4.1.1)
|
||||
actionview (= 4.1.1)
|
||||
activemodel (= 4.1.1)
|
||||
activerecord (= 4.1.1)
|
||||
activesupport (= 4.1.1)
|
||||
rails (4.1.4)
|
||||
actionmailer (= 4.1.4)
|
||||
actionpack (= 4.1.4)
|
||||
actionview (= 4.1.4)
|
||||
activemodel (= 4.1.4)
|
||||
activerecord (= 4.1.4)
|
||||
activesupport (= 4.1.4)
|
||||
bundler (>= 1.3.0, < 2.0)
|
||||
railties (= 4.1.1)
|
||||
railties (= 4.1.4)
|
||||
sprockets-rails (~> 2.0)
|
||||
railties (4.1.1)
|
||||
actionpack (= 4.1.1)
|
||||
activesupport (= 4.1.1)
|
||||
railties (4.1.4)
|
||||
actionpack (= 4.1.4)
|
||||
activesupport (= 4.1.4)
|
||||
rake (>= 0.8.7)
|
||||
thor (>= 0.18.1, < 2.0)
|
||||
raindrops (0.13.0)
|
||||
|
@ -191,7 +191,7 @@ DEPENDENCIES
|
|||
pg
|
||||
pry
|
||||
pry-byebug
|
||||
rails (= 4.1.1)
|
||||
rails (= 4.1.4)
|
||||
rspec-rails (~> 3.0.1)
|
||||
sass-rails (~> 4.0.3)
|
||||
sdoc (~> 0.4.0)
|
||||
|
|
|
@ -3,6 +3,7 @@ module Epp::Common
|
|||
|
||||
included do
|
||||
protect_from_forgery with: :null_session
|
||||
before_action :validate_request, only: [:proxy]
|
||||
end
|
||||
|
||||
def proxy
|
||||
|
@ -25,4 +26,15 @@ module Epp::Common
|
|||
def current_epp_user
|
||||
@current_epp_user ||= EppUser.find(epp_session[:epp_user_id]) if epp_session[:epp_user_id]
|
||||
end
|
||||
|
||||
def validate_request
|
||||
xsd = Nokogiri::XML::Schema(File.read('doc/schemas/epp-1.0.xsd'))
|
||||
doc = Nokogiri::XML(params[:frame])
|
||||
@extValues = xsd.validate(doc)
|
||||
if @extValues.any?
|
||||
@code = '2001'
|
||||
@msg = 'Command syntax error'
|
||||
render '/epp/error' and return
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -2,6 +2,7 @@ class Epp::ErrorsController < ApplicationController
|
|||
include Epp::Common
|
||||
|
||||
def error
|
||||
@code, @msg = params[:code], params[:msg]
|
||||
render '/epp/error'
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,9 +1,19 @@
|
|||
xml.epp_head do
|
||||
xml.response do
|
||||
xml.result('code' => params[:code]) do
|
||||
xml.msg(params[:msg], 'lang' => 'en')
|
||||
xml.result('code' => @code) do
|
||||
xml.msg(@msg, 'lang' => 'en')
|
||||
end
|
||||
end
|
||||
|
||||
@extValues.each do |x|
|
||||
xml.extValue do
|
||||
xml.value do
|
||||
# xml.tag!()
|
||||
xml.reason x.to_s
|
||||
end
|
||||
end
|
||||
|
||||
end if @extValues && @extValues.any?
|
||||
|
||||
xml << render('/epp/shared/trID')
|
||||
end
|
||||
|
|
387
doc/schemas/contact-1.0.xsd
Normal file
387
doc/schemas/contact-1.0.xsd
Normal file
|
@ -0,0 +1,387 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<schema targetNamespace="urn:ietf:params:xml:ns:contact-1.0"
|
||||
xmlns:contact="urn:ietf:params:xml:ns:contact-1.0"
|
||||
xmlns:epp="urn:ietf:params:xml:ns:epp-1.0"
|
||||
xmlns:eppcom="urn:ietf:params:xml:ns:eppcom-1.0"
|
||||
xmlns="http://www.w3.org/2001/XMLSchema"
|
||||
elementFormDefault="qualified">
|
||||
|
||||
<!--
|
||||
Import common element types.
|
||||
-->
|
||||
<import namespace="urn:ietf:params:xml:ns:eppcom-1.0" schemaLocation="doc/schemas/eppcom-1.0.xsd"/>
|
||||
<import namespace="urn:ietf:params:xml:ns:epp-1.0" schemaLocation="doc/schemas/epp-1.0.xsd"/>
|
||||
|
||||
<annotation>
|
||||
<documentation>
|
||||
Extensible Provisioning Protocol v1.0
|
||||
contact provisioning schema.
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<!--
|
||||
Child elements found in EPP commands.
|
||||
-->
|
||||
<element name="check" type="contact:mIDType"/>
|
||||
<element name="create" type="contact:createType"/>
|
||||
<element name="delete" type="contact:sIDType"/>
|
||||
<element name="info" type="contact:authIDType"/>
|
||||
<element name="transfer" type="contact:authIDType"/>
|
||||
<element name="update" type="contact:updateType"/>
|
||||
|
||||
<!--
|
||||
Utility types.
|
||||
-->
|
||||
<simpleType name="ccType">
|
||||
<restriction base="token">
|
||||
<length value="2"/>
|
||||
</restriction>
|
||||
</simpleType>
|
||||
<complexType name="e164Type">
|
||||
<simpleContent>
|
||||
<extension base="contact:e164StringType">
|
||||
<attribute name="x" type="token"/>
|
||||
</extension>
|
||||
</simpleContent>
|
||||
</complexType>
|
||||
|
||||
<simpleType name="e164StringType">
|
||||
<restriction base="token">
|
||||
<pattern value="(\+[0-9]{1,3}\.[0-9]{1,14})?"/>
|
||||
<maxLength value="17"/>
|
||||
</restriction>
|
||||
</simpleType>
|
||||
|
||||
<simpleType name="pcType">
|
||||
<restriction base="token">
|
||||
<maxLength value="16"/>
|
||||
</restriction>
|
||||
</simpleType>
|
||||
|
||||
<simpleType name="postalLineType">
|
||||
<restriction base="normalizedString">
|
||||
<minLength value="1"/>
|
||||
<maxLength value="255"/>
|
||||
</restriction>
|
||||
</simpleType>
|
||||
|
||||
<simpleType name="optPostalLineType">
|
||||
<restriction base="normalizedString">
|
||||
<maxLength value="255"/>
|
||||
</restriction>
|
||||
</simpleType>
|
||||
|
||||
<!--
|
||||
Child elements of the <create> command.
|
||||
-->
|
||||
<complexType name="createType">
|
||||
<sequence>
|
||||
<element name="id" type="eppcom:clIDType"/>
|
||||
<element name="postalInfo" type="contact:postalInfoType"
|
||||
maxOccurs="2"/>
|
||||
<element name="voice" type="contact:e164Type"
|
||||
minOccurs="0"/>
|
||||
<element name="fax" type="contact:e164Type"
|
||||
minOccurs="0"/>
|
||||
<element name="email" type="eppcom:minTokenType"/>
|
||||
<element name="authInfo" type="contact:authInfoType"/>
|
||||
<element name="disclose" type="contact:discloseType"
|
||||
minOccurs="0"/>
|
||||
</sequence>
|
||||
</complexType>
|
||||
|
||||
<complexType name="postalInfoType">
|
||||
<sequence>
|
||||
<element name="name" type="contact:postalLineType"/>
|
||||
<element name="org" type="contact:optPostalLineType"
|
||||
minOccurs="0"/>
|
||||
<element name="addr" type="contact:addrType"/>
|
||||
</sequence>
|
||||
<attribute name="type" type="contact:postalInfoEnumType"
|
||||
use="required"/>
|
||||
</complexType>
|
||||
|
||||
<simpleType name="postalInfoEnumType">
|
||||
<restriction base="token">
|
||||
<enumeration value="loc"/>
|
||||
<enumeration value="int"/>
|
||||
</restriction>
|
||||
</simpleType>
|
||||
|
||||
<complexType name="addrType">
|
||||
<sequence>
|
||||
<element name="street" type="contact:optPostalLineType"
|
||||
minOccurs="0" maxOccurs="3"/>
|
||||
<element name="city" type="contact:postalLineType"/>
|
||||
<element name="sp" type="contact:optPostalLineType"
|
||||
minOccurs="0"/>
|
||||
<element name="pc" type="contact:pcType"
|
||||
minOccurs="0"/>
|
||||
<element name="cc" type="contact:ccType"/>
|
||||
</sequence>
|
||||
</complexType>
|
||||
|
||||
<complexType name="authInfoType">
|
||||
<choice>
|
||||
<element name="pw" type="eppcom:pwAuthInfoType"/>
|
||||
<element name="ext" type="eppcom:extAuthInfoType"/>
|
||||
</choice>
|
||||
</complexType>
|
||||
|
||||
<complexType name="discloseType">
|
||||
<sequence>
|
||||
<element name="name" type="contact:intLocType"
|
||||
minOccurs="0" maxOccurs="2"/>
|
||||
<element name="org" type="contact:intLocType"
|
||||
minOccurs="0" maxOccurs="2"/>
|
||||
<element name="addr" type="contact:intLocType"
|
||||
minOccurs="0" maxOccurs="2"/>
|
||||
<element name="voice" minOccurs="0"/>
|
||||
<element name="fax" minOccurs="0"/>
|
||||
<element name="email" minOccurs="0"/>
|
||||
</sequence>
|
||||
<attribute name="flag" type="boolean" use="required"/>
|
||||
</complexType>
|
||||
|
||||
<complexType name="intLocType">
|
||||
<attribute name="type" type="contact:postalInfoEnumType"
|
||||
use="required"/>
|
||||
</complexType>
|
||||
|
||||
<!--
|
||||
Child element of commands that require only an identifier.
|
||||
-->
|
||||
<complexType name="sIDType">
|
||||
<sequence>
|
||||
<element name="id" type="eppcom:clIDType"/>
|
||||
</sequence>
|
||||
</complexType>
|
||||
|
||||
<!--
|
||||
Child element of commands that accept multiple identifiers.
|
||||
-->
|
||||
<complexType name="mIDType">
|
||||
<sequence>
|
||||
<element name="id" type="eppcom:clIDType"
|
||||
maxOccurs="unbounded"/>
|
||||
</sequence>
|
||||
</complexType>
|
||||
|
||||
<!--
|
||||
Child elements of the <info> and <transfer> commands.
|
||||
-->
|
||||
<complexType name="authIDType">
|
||||
<sequence>
|
||||
<element name="id" type="eppcom:clIDType"/>
|
||||
<element name="authInfo" type="contact:authInfoType"
|
||||
minOccurs="0"/>
|
||||
</sequence>
|
||||
</complexType>
|
||||
|
||||
<!--
|
||||
Child elements of the <update> command.
|
||||
-->
|
||||
<complexType name="updateType">
|
||||
<sequence>
|
||||
<element name="id" type="eppcom:clIDType"/>
|
||||
<element name="add" type="contact:addRemType"
|
||||
minOccurs="0"/>
|
||||
<element name="rem" type="contact:addRemType"
|
||||
minOccurs="0"/>
|
||||
<element name="chg" type="contact:chgType"
|
||||
minOccurs="0"/>
|
||||
</sequence>
|
||||
</complexType>
|
||||
|
||||
<!--
|
||||
Data elements that can be added or removed.
|
||||
-->
|
||||
<complexType name="addRemType">
|
||||
<sequence>
|
||||
<element name="status" type="contact:statusType"
|
||||
maxOccurs="7"/>
|
||||
</sequence>
|
||||
</complexType>
|
||||
|
||||
<!--
|
||||
Data elements that can be changed.
|
||||
-->
|
||||
<complexType name="chgType">
|
||||
<sequence>
|
||||
<element name="postalInfo" type="contact:chgPostalInfoType"
|
||||
minOccurs="0" maxOccurs="2"/>
|
||||
<element name="voice" type="contact:e164Type"
|
||||
minOccurs="0"/>
|
||||
<element name="fax" type="contact:e164Type"
|
||||
minOccurs="0"/>
|
||||
<element name="email" type="eppcom:minTokenType"
|
||||
minOccurs="0"/>
|
||||
<element name="authInfo" type="contact:authInfoType"
|
||||
minOccurs="0"/>
|
||||
<element name="disclose" type="contact:discloseType"
|
||||
minOccurs="0"/>
|
||||
</sequence>
|
||||
</complexType>
|
||||
|
||||
<complexType name="chgPostalInfoType">
|
||||
<sequence>
|
||||
<element name="name" type="contact:postalLineType"
|
||||
minOccurs="0"/>
|
||||
<element name="org" type="contact:optPostalLineType"
|
||||
minOccurs="0"/>
|
||||
<element name="addr" type="contact:addrType"
|
||||
minOccurs="0"/>
|
||||
</sequence>
|
||||
<attribute name="type" type="contact:postalInfoEnumType"
|
||||
use="required"/>
|
||||
</complexType>
|
||||
|
||||
<!--
|
||||
Child response elements.
|
||||
-->
|
||||
<element name="chkData" type="contact:chkDataType"/>
|
||||
<element name="creData" type="contact:creDataType"/>
|
||||
<element name="infData" type="contact:infDataType"/>
|
||||
<element name="panData" type="contact:panDataType"/>
|
||||
<element name="trnData" type="contact:trnDataType"/>
|
||||
|
||||
<!--
|
||||
<check> response elements.
|
||||
-->
|
||||
<complexType name="chkDataType">
|
||||
<sequence>
|
||||
<element name="cd" type="contact:checkType"
|
||||
maxOccurs="unbounded"/>
|
||||
</sequence>
|
||||
</complexType>
|
||||
|
||||
<complexType name="checkType">
|
||||
<sequence>
|
||||
<element name="id" type="contact:checkIDType"/>
|
||||
<element name="reason" type="eppcom:reasonType"
|
||||
minOccurs="0"/>
|
||||
</sequence>
|
||||
</complexType>
|
||||
|
||||
<complexType name="checkIDType">
|
||||
<simpleContent>
|
||||
<extension base="eppcom:clIDType">
|
||||
<attribute name="avail" type="boolean"
|
||||
use="required"/>
|
||||
</extension>
|
||||
</simpleContent>
|
||||
</complexType>
|
||||
|
||||
<!--
|
||||
<create> response elements.
|
||||
-->
|
||||
<complexType name="creDataType">
|
||||
<sequence>
|
||||
<element name="id" type="eppcom:clIDType"/>
|
||||
<element name="crDate" type="dateTime"/>
|
||||
</sequence>
|
||||
</complexType>
|
||||
|
||||
<!--
|
||||
<info> response elements.
|
||||
-->
|
||||
<complexType name="infDataType">
|
||||
<sequence>
|
||||
<element name="id" type="eppcom:clIDType"/>
|
||||
<element name="roid" type="eppcom:roidType"/>
|
||||
<element name="status" type="contact:statusType"
|
||||
maxOccurs="7"/>
|
||||
<element name="postalInfo" type="contact:postalInfoType"
|
||||
maxOccurs="2"/>
|
||||
<element name="voice" type="contact:e164Type"
|
||||
minOccurs="0"/>
|
||||
<element name="fax" type="contact:e164Type"
|
||||
minOccurs="0"/>
|
||||
<element name="email" type="eppcom:minTokenType"/>
|
||||
<element name="clID" type="eppcom:clIDType"/>
|
||||
<element name="crID" type="eppcom:clIDType"/>
|
||||
<element name="crDate" type="dateTime"/>
|
||||
<element name="upID" type="eppcom:clIDType"
|
||||
minOccurs="0"/>
|
||||
<element name="upDate" type="dateTime"
|
||||
minOccurs="0"/>
|
||||
<element name="trDate" type="dateTime"
|
||||
minOccurs="0"/>
|
||||
<element name="authInfo" type="contact:authInfoType"
|
||||
minOccurs="0"/>
|
||||
<element name="disclose" type="contact:discloseType"
|
||||
minOccurs="0"/>
|
||||
</sequence>
|
||||
</complexType>
|
||||
|
||||
<!--
|
||||
Status is a combination of attributes and an optional human-readable
|
||||
message that may be expressed in languages other than English.
|
||||
-->
|
||||
<complexType name="statusType">
|
||||
<simpleContent>
|
||||
<extension base="normalizedString">
|
||||
<attribute name="s" type="contact:statusValueType"
|
||||
use="required"/>
|
||||
<attribute name="lang" type="language"
|
||||
default="en"/>
|
||||
</extension>
|
||||
</simpleContent>
|
||||
</complexType>
|
||||
|
||||
<simpleType name="statusValueType">
|
||||
<restriction base="token">
|
||||
<enumeration value="clientDeleteProhibited"/>
|
||||
<enumeration value="clientTransferProhibited"/>
|
||||
<enumeration value="clientUpdateProhibited"/>
|
||||
<enumeration value="linked"/>
|
||||
<enumeration value="ok"/>
|
||||
<enumeration value="pendingCreate"/>
|
||||
<enumeration value="pendingDelete"/>
|
||||
<enumeration value="pendingTransfer"/>
|
||||
<enumeration value="pendingUpdate"/>
|
||||
<enumeration value="serverDeleteProhibited"/>
|
||||
<enumeration value="serverTransferProhibited"/>
|
||||
<enumeration value="serverUpdateProhibited"/>
|
||||
</restriction>
|
||||
</simpleType>
|
||||
|
||||
<!--
|
||||
Pending action notification response elements.
|
||||
-->
|
||||
<complexType name="panDataType">
|
||||
<sequence>
|
||||
<element name="id" type="contact:paCLIDType"/>
|
||||
<element name="paTRID" type="epp:trIDType"/>
|
||||
<element name="paDate" type="dateTime"/>
|
||||
</sequence>
|
||||
</complexType>
|
||||
|
||||
<complexType name="paCLIDType">
|
||||
<simpleContent>
|
||||
<extension base="eppcom:clIDType">
|
||||
<attribute name="paResult" type="boolean"
|
||||
use="required"/>
|
||||
</extension>
|
||||
</simpleContent>
|
||||
</complexType>
|
||||
|
||||
<!--
|
||||
<transfer> response elements.
|
||||
-->
|
||||
<complexType name="trnDataType">
|
||||
<sequence>
|
||||
<element name="id" type="eppcom:clIDType"/>
|
||||
<element name="trStatus" type="eppcom:trStatusType"/>
|
||||
<element name="reID" type="eppcom:clIDType"/>
|
||||
<element name="reDate" type="dateTime"/>
|
||||
<element name="acID" type="eppcom:clIDType"/>
|
||||
<element name="acDate" type="dateTime"/>
|
||||
</sequence>
|
||||
</complexType>
|
||||
|
||||
<!--
|
||||
End of schema.
|
||||
-->
|
||||
</schema>
|
443
doc/schemas/epp-1.0.xsd
Normal file
443
doc/schemas/epp-1.0.xsd
Normal file
|
@ -0,0 +1,443 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<schema targetNamespace="urn:ietf:params:xml:ns:epp-1.0"
|
||||
xmlns:epp="urn:ietf:params:xml:ns:epp-1.0"
|
||||
xmlns:eppcom="urn:ietf:params:xml:ns:eppcom-1.0"
|
||||
xmlns="http://www.w3.org/2001/XMLSchema"
|
||||
elementFormDefault="qualified">
|
||||
|
||||
<!--
|
||||
Import common element types.
|
||||
-->
|
||||
<import namespace="urn:ietf:params:xml:ns:eppcom-1.0" schemaLocation="doc/schemas/eppcom-1.0.xsd" />
|
||||
|
||||
<annotation>
|
||||
<documentation>
|
||||
Extensible Provisioning Protocol v1.0 schema.
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<!--
|
||||
Every EPP XML instance must begin with this element.
|
||||
-->
|
||||
<element name="epp" type="epp:eppType"/>
|
||||
|
||||
<!--
|
||||
An EPP XML instance must contain a greeting, hello, command,
|
||||
response, or extension.
|
||||
-->
|
||||
<complexType name="eppType">
|
||||
<choice>
|
||||
<element name="greeting" type="epp:greetingType"/>
|
||||
<element name="hello"/>
|
||||
<element name="command" type="epp:commandType"/>
|
||||
<element name="response" type="epp:responseType"/>
|
||||
<element name="extension" type="epp:extAnyType"/>
|
||||
</choice>
|
||||
</complexType>
|
||||
|
||||
<!--
|
||||
A greeting is sent by a server in response to a client connection
|
||||
or <hello>.
|
||||
-->
|
||||
<complexType name="greetingType">
|
||||
<sequence>
|
||||
<element name="svID" type="epp:sIDType"/>
|
||||
<element name="svDate" type="dateTime"/>
|
||||
<element name="svcMenu" type="epp:svcMenuType"/>
|
||||
<element name="dcp" type="epp:dcpType"/>
|
||||
</sequence>
|
||||
</complexType>
|
||||
|
||||
<!--
|
||||
Server IDs are strings with minimum and maximum length restrictions.
|
||||
-->
|
||||
<simpleType name="sIDType">
|
||||
<restriction base="normalizedString">
|
||||
<minLength value="3"/>
|
||||
<maxLength value="64"/>
|
||||
</restriction>
|
||||
</simpleType>
|
||||
|
||||
<!--
|
||||
A server greeting identifies available object services.
|
||||
-->
|
||||
<complexType name="svcMenuType">
|
||||
<sequence>
|
||||
<element name="version" type="epp:versionType"
|
||||
maxOccurs="unbounded"/>
|
||||
<element name="lang" type="language"
|
||||
maxOccurs="unbounded"/>
|
||||
<element name="objURI" type="anyURI"
|
||||
maxOccurs="unbounded"/>
|
||||
<element name="svcExtension" type="epp:extURIType"
|
||||
minOccurs="0"/>
|
||||
</sequence>
|
||||
</complexType>
|
||||
|
||||
<!--
|
||||
Data Collection Policy types.
|
||||
-->
|
||||
<complexType name="dcpType">
|
||||
<sequence>
|
||||
<element name="access" type="epp:dcpAccessType"/>
|
||||
<element name="statement" type="epp:dcpStatementType"
|
||||
maxOccurs="unbounded"/>
|
||||
<element name="expiry" type="epp:dcpExpiryType"
|
||||
minOccurs="0"/>
|
||||
</sequence>
|
||||
</complexType>
|
||||
|
||||
<complexType name="dcpAccessType">
|
||||
<choice>
|
||||
<element name="all"/>
|
||||
<element name="none"/>
|
||||
<element name="null"/>
|
||||
<element name="other"/>
|
||||
<element name="personal"/>
|
||||
<element name="personalAndOther"/>
|
||||
</choice>
|
||||
</complexType>
|
||||
|
||||
<complexType name="dcpStatementType">
|
||||
<sequence>
|
||||
<element name="purpose" type="epp:dcpPurposeType"/>
|
||||
<element name="recipient" type="epp:dcpRecipientType"/>
|
||||
<element name="retention" type="epp:dcpRetentionType"/>
|
||||
</sequence>
|
||||
</complexType>
|
||||
|
||||
<complexType name="dcpPurposeType">
|
||||
<sequence>
|
||||
<element name="admin"
|
||||
minOccurs="0"/>
|
||||
<element name="contact"
|
||||
minOccurs="0"/>
|
||||
<element name="other"
|
||||
minOccurs="0"/>
|
||||
<element name="prov"
|
||||
minOccurs="0"/>
|
||||
</sequence>
|
||||
</complexType>
|
||||
|
||||
<complexType name="dcpRecipientType">
|
||||
<sequence>
|
||||
<element name="other"
|
||||
minOccurs="0"/>
|
||||
<element name="ours" type="epp:dcpOursType"
|
||||
minOccurs="0" maxOccurs="unbounded"/>
|
||||
<element name="public"
|
||||
minOccurs="0"/>
|
||||
<element name="same"
|
||||
minOccurs="0"/>
|
||||
<element name="unrelated"
|
||||
minOccurs="0"/>
|
||||
</sequence>
|
||||
</complexType>
|
||||
|
||||
<complexType name="dcpOursType">
|
||||
<sequence>
|
||||
<element name="recDesc" type="epp:dcpRecDescType"
|
||||
minOccurs="0"/>
|
||||
</sequence>
|
||||
</complexType>
|
||||
|
||||
<simpleType name="dcpRecDescType">
|
||||
<restriction base="token">
|
||||
<minLength value="1"/>
|
||||
<maxLength value="255"/>
|
||||
</restriction>
|
||||
</simpleType>
|
||||
|
||||
<complexType name="dcpRetentionType">
|
||||
<choice>
|
||||
<element name="business"/>
|
||||
<element name="indefinite"/>
|
||||
<element name="legal"/>
|
||||
<element name="none"/>
|
||||
<element name="stated"/>
|
||||
</choice>
|
||||
</complexType>
|
||||
|
||||
<complexType name="dcpExpiryType">
|
||||
<choice>
|
||||
<element name="absolute" type="dateTime"/>
|
||||
<element name="relative" type="duration"/>
|
||||
</choice>
|
||||
</complexType>
|
||||
|
||||
<!--
|
||||
Extension framework types.
|
||||
-->
|
||||
<complexType name="extAnyType">
|
||||
<sequence>
|
||||
<any namespace="##other"
|
||||
maxOccurs="unbounded"/>
|
||||
</sequence>
|
||||
</complexType>
|
||||
|
||||
<complexType name="extURIType">
|
||||
<sequence>
|
||||
<element name="extURI" type="anyURI"
|
||||
maxOccurs="unbounded"/>
|
||||
</sequence>
|
||||
</complexType>
|
||||
|
||||
<!--
|
||||
An EPP version number is a dotted pair of decimal numbers.
|
||||
-->
|
||||
<simpleType name="versionType">
|
||||
<restriction base="token">
|
||||
<pattern value="[1-9]+\.[0-9]+"/>
|
||||
<enumeration value="1.0"/>
|
||||
</restriction>
|
||||
</simpleType>
|
||||
|
||||
<!--
|
||||
Command types.
|
||||
-->
|
||||
<complexType name="commandType">
|
||||
<sequence>
|
||||
<choice>
|
||||
<element name="check" type="epp:readWriteType"/>
|
||||
<element name="create" type="epp:readWriteType"/>
|
||||
<element name="delete" type="epp:readWriteType"/>
|
||||
<element name="info" type="epp:readWriteType"/>
|
||||
<element name="login" type="epp:loginType"/>
|
||||
<element name="logout"/>
|
||||
<element name="poll" type="epp:pollType"/>
|
||||
<element name="renew" type="epp:readWriteType"/>
|
||||
<element name="transfer" type="epp:transferType"/>
|
||||
<element name="update" type="epp:readWriteType"/>
|
||||
</choice>
|
||||
<element name="extension" type="epp:extAnyType"
|
||||
minOccurs="0"/>
|
||||
<element name="clTRID" type="epp:trIDStringType"
|
||||
minOccurs="0"/>
|
||||
</sequence>
|
||||
</complexType>
|
||||
|
||||
<!--
|
||||
The <login> command.
|
||||
-->
|
||||
<complexType name="loginType">
|
||||
<sequence>
|
||||
<element name="clID" type="eppcom:clIDType"/>
|
||||
<element name="pw" type="epp:pwType"/>
|
||||
<element name="newPW" type="epp:pwType"
|
||||
minOccurs="0"/>
|
||||
<element name="options" type="epp:credsOptionsType"/>
|
||||
<element name="svcs" type="epp:loginSvcType"/>
|
||||
</sequence>
|
||||
</complexType>
|
||||
|
||||
<complexType name="credsOptionsType">
|
||||
<sequence>
|
||||
<element name="version" type="epp:versionType"/>
|
||||
<element name="lang" type="language"/>
|
||||
</sequence>
|
||||
</complexType>
|
||||
|
||||
<simpleType name="pwType">
|
||||
<restriction base="token">
|
||||
<minLength value="6"/>
|
||||
<maxLength value="16"/>
|
||||
</restriction>
|
||||
</simpleType>
|
||||
|
||||
<complexType name="loginSvcType">
|
||||
<sequence>
|
||||
<element name="objURI" type="anyURI"
|
||||
maxOccurs="unbounded"/>
|
||||
<element name="svcExtension" type="epp:extURIType"
|
||||
minOccurs="0"/>
|
||||
</sequence>
|
||||
</complexType>
|
||||
|
||||
<!--
|
||||
The <poll> command.
|
||||
-->
|
||||
<complexType name="pollType">
|
||||
<attribute name="op" type="epp:pollOpType"
|
||||
use="required"/>
|
||||
<attribute name="msgID" type="token"/>
|
||||
</complexType>
|
||||
|
||||
<simpleType name="pollOpType">
|
||||
<restriction base="token">
|
||||
<enumeration value="ack"/>
|
||||
<enumeration value="req"/>
|
||||
</restriction>
|
||||
</simpleType>
|
||||
|
||||
<!--
|
||||
The <transfer> command. This is object-specific, and uses attributes
|
||||
to identify the requested operation.
|
||||
-->
|
||||
<complexType name="transferType">
|
||||
<sequence>
|
||||
<any namespace="##other"/>
|
||||
</sequence>
|
||||
<attribute name="op" type="epp:transferOpType"
|
||||
use="required"/>
|
||||
</complexType>
|
||||
|
||||
<simpleType name="transferOpType">
|
||||
<restriction base="token">
|
||||
<enumeration value="approve"/>
|
||||
<enumeration value="cancel"/>
|
||||
<enumeration value="query"/>
|
||||
<enumeration value="reject"/>
|
||||
<enumeration value="request"/>
|
||||
</restriction>
|
||||
</simpleType>
|
||||
|
||||
<!--
|
||||
All other object-centric commands. EPP doesn't specify the syntax or
|
||||
semantics of object-centric command elements. The elements MUST be
|
||||
described in detail in another schema specific to the object.
|
||||
-->
|
||||
<complexType name="readWriteType">
|
||||
<sequence>
|
||||
<any namespace="##other"/>
|
||||
</sequence>
|
||||
</complexType>
|
||||
|
||||
<complexType name="trIDType">
|
||||
<sequence>
|
||||
<element name="clTRID" type="epp:trIDStringType"
|
||||
minOccurs="0"/>
|
||||
<element name="svTRID" type="epp:trIDStringType"/>
|
||||
</sequence>
|
||||
</complexType>
|
||||
|
||||
<simpleType name="trIDStringType">
|
||||
<restriction base="token">
|
||||
<minLength value="3"/>
|
||||
<maxLength value="64"/>
|
||||
</restriction>
|
||||
</simpleType>
|
||||
|
||||
<!--
|
||||
Response types.
|
||||
-->
|
||||
<complexType name="responseType">
|
||||
<sequence>
|
||||
<element name="result" type="epp:resultType"
|
||||
maxOccurs="unbounded"/>
|
||||
<element name="msgQ" type="epp:msgQType"
|
||||
minOccurs="0"/>
|
||||
|
||||
<element name="resData" type="epp:extAnyType"
|
||||
minOccurs="0"/>
|
||||
<element name="extension" type="epp:extAnyType"
|
||||
minOccurs="0"/>
|
||||
<element name="trID" type="epp:trIDType"/>
|
||||
</sequence>
|
||||
</complexType>
|
||||
|
||||
<complexType name="resultType">
|
||||
<sequence>
|
||||
<element name="msg" type="epp:msgType"/>
|
||||
<choice minOccurs="0" maxOccurs="unbounded">
|
||||
<element name="value" type="epp:errValueType"/>
|
||||
<element name="extValue" type="epp:extErrValueType"/>
|
||||
</choice>
|
||||
</sequence>
|
||||
<attribute name="code" type="epp:resultCodeType"
|
||||
use="required"/>
|
||||
</complexType>
|
||||
|
||||
<complexType name="errValueType" mixed="true">
|
||||
<sequence>
|
||||
<any namespace="##any" processContents="skip"/>
|
||||
</sequence>
|
||||
<anyAttribute namespace="##any" processContents="skip"/>
|
||||
</complexType>
|
||||
<complexType name="extErrValueType">
|
||||
<sequence>
|
||||
<element name="value" type="epp:errValueType"/>
|
||||
<element name="reason" type="epp:msgType"/>
|
||||
</sequence>
|
||||
</complexType>
|
||||
|
||||
<complexType name="msgQType">
|
||||
<sequence>
|
||||
<element name="qDate" type="dateTime"
|
||||
minOccurs="0"/>
|
||||
<element name="msg" type="epp:mixedMsgType"
|
||||
minOccurs="0"/>
|
||||
</sequence>
|
||||
<attribute name="count" type="unsignedLong"
|
||||
use="required"/>
|
||||
<attribute name="id" type="eppcom:minTokenType"
|
||||
use="required"/>
|
||||
</complexType>
|
||||
|
||||
<complexType name="mixedMsgType" mixed="true">
|
||||
<sequence>
|
||||
<any processContents="skip"
|
||||
minOccurs="0" maxOccurs="unbounded"/>
|
||||
</sequence>
|
||||
<attribute name="lang" type="language"
|
||||
default="en"/>
|
||||
</complexType>
|
||||
|
||||
<!--
|
||||
Human-readable text may be expressed in languages other than English.
|
||||
-->
|
||||
<complexType name="msgType">
|
||||
<simpleContent>
|
||||
<extension base="normalizedString">
|
||||
<attribute name="lang" type="language"
|
||||
default="en"/>
|
||||
</extension>
|
||||
</simpleContent>
|
||||
</complexType>
|
||||
|
||||
<!--
|
||||
EPP result codes.
|
||||
-->
|
||||
<simpleType name="resultCodeType">
|
||||
<restriction base="unsignedShort">
|
||||
<enumeration value="1000"/>
|
||||
<enumeration value="1001"/>
|
||||
<enumeration value="1300"/>
|
||||
<enumeration value="1301"/>
|
||||
<enumeration value="1500"/>
|
||||
<enumeration value="2000"/>
|
||||
<enumeration value="2001"/>
|
||||
<enumeration value="2002"/>
|
||||
<enumeration value="2003"/>
|
||||
<enumeration value="2004"/>
|
||||
<enumeration value="2005"/>
|
||||
<enumeration value="2100"/>
|
||||
<enumeration value="2101"/>
|
||||
<enumeration value="2102"/>
|
||||
<enumeration value="2103"/>
|
||||
<enumeration value="2104"/>
|
||||
<enumeration value="2105"/>
|
||||
<enumeration value="2106"/>
|
||||
<enumeration value="2200"/>
|
||||
<enumeration value="2201"/>
|
||||
<enumeration value="2202"/>
|
||||
<enumeration value="2300"/>
|
||||
<enumeration value="2301"/>
|
||||
<enumeration value="2302"/>
|
||||
<enumeration value="2303"/>
|
||||
<enumeration value="2304"/>
|
||||
<enumeration value="2305"/>
|
||||
<enumeration value="2306"/>
|
||||
<enumeration value="2307"/>
|
||||
<enumeration value="2308"/>
|
||||
<enumeration value="2400"/>
|
||||
<enumeration value="2500"/>
|
||||
<enumeration value="2501"/>
|
||||
<enumeration value="2502"/>
|
||||
</restriction>
|
||||
</simpleType>
|
||||
|
||||
<!--
|
||||
End of schema.
|
||||
-->
|
||||
</schema>
|
105
doc/schemas/eppcom-1.0.xsd
Normal file
105
doc/schemas/eppcom-1.0.xsd
Normal file
|
@ -0,0 +1,105 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<schema targetNamespace="urn:ietf:params:xml:ns:eppcom-1.0"
|
||||
xmlns:eppcom="urn:ietf:params:xml:ns:eppcom-1.0"
|
||||
xmlns="http://www.w3.org/2001/XMLSchema"
|
||||
elementFormDefault="qualified">
|
||||
|
||||
<annotation>
|
||||
<documentation>
|
||||
Extensible Provisioning Protocol v1.0
|
||||
shared structures schema.
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<!--
|
||||
Object authorization information types.
|
||||
-->
|
||||
<complexType name="pwAuthInfoType">
|
||||
<simpleContent>
|
||||
<extension base="normalizedString">
|
||||
<attribute name="roid" type="eppcom:roidType"/>
|
||||
</extension>
|
||||
</simpleContent>
|
||||
</complexType>
|
||||
|
||||
<complexType name="extAuthInfoType">
|
||||
<sequence>
|
||||
<any namespace="##other"/>
|
||||
</sequence>
|
||||
</complexType>
|
||||
|
||||
<!--
|
||||
<check> response types.
|
||||
-->
|
||||
<complexType name="reasonType">
|
||||
<simpleContent>
|
||||
<extension base="eppcom:reasonBaseType">
|
||||
<attribute name="lang" type="language"/>
|
||||
</extension>
|
||||
</simpleContent>
|
||||
</complexType>
|
||||
|
||||
<simpleType name="reasonBaseType">
|
||||
<restriction base="token">
|
||||
<minLength value="1"/>
|
||||
<maxLength value="32"/>
|
||||
</restriction>
|
||||
</simpleType>
|
||||
|
||||
<!--
|
||||
Abstract client and object identifier type.
|
||||
-->
|
||||
<simpleType name="clIDType">
|
||||
<restriction base="token">
|
||||
<minLength value="3"/>
|
||||
<maxLength value="16"/>
|
||||
</restriction>
|
||||
</simpleType>
|
||||
|
||||
<!--
|
||||
DNS label type.
|
||||
-->
|
||||
<simpleType name="labelType">
|
||||
<restriction base="token">
|
||||
<minLength value="1"/>
|
||||
<maxLength value="255"/>
|
||||
</restriction>
|
||||
</simpleType>
|
||||
|
||||
<!--
|
||||
Non-empty token type.
|
||||
-->
|
||||
<simpleType name="minTokenType">
|
||||
<restriction base="token">
|
||||
<minLength value="1"/>
|
||||
</restriction>
|
||||
</simpleType>
|
||||
|
||||
<!--
|
||||
Repository Object IDentifier type.
|
||||
-->
|
||||
<simpleType name="roidType">
|
||||
<restriction base="token">
|
||||
<pattern value="(\w|_){1,80}-\w{1,8}"/>
|
||||
</restriction>
|
||||
</simpleType>
|
||||
|
||||
<!--
|
||||
Transfer status identifiers.
|
||||
-->
|
||||
<simpleType name="trStatusType">
|
||||
<restriction base="token">
|
||||
<enumeration value="clientApproved"/>
|
||||
<enumeration value="clientCancelled"/>
|
||||
<enumeration value="clientRejected"/>
|
||||
<enumeration value="pending"/>
|
||||
<enumeration value="serverApproved"/>
|
||||
<enumeration value="serverCancelled"/>
|
||||
</restriction>
|
||||
</simpleType>
|
||||
|
||||
<!--
|
||||
End of schema.
|
||||
-->
|
||||
</schema>
|
|
@ -1,7 +1,7 @@
|
|||
require 'rails_helper'
|
||||
|
||||
describe 'EPP Contact', epp: true do
|
||||
let(:server) { Epp::Server.new({server: 'localhost', tag: 'test', password: 'test', port: 701}) }
|
||||
let(:server) { Epp::Server.new({server: 'localhost', tag: 'gitlab', password: 'ghyt9e4fu', port: 701}) }
|
||||
|
||||
context 'with valid user' do
|
||||
before(:each) { Fabricate(:epp_user) }
|
||||
|
|
|
@ -1,24 +1,34 @@
|
|||
<?xml version="1.0" encoding="utf-8" standalone="no"?><epp
|
||||
xmlns="urn:ietf:params:xml:ns:epp-1.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="urn:ietf:params:xml:ns:epp-1.0 epp-
|
||||
1.0.xsd"><command><create><contact:create
|
||||
xmlns:contact="http://www.nic.cz/xml/epp/contact-1.6"
|
||||
xsi:schemaLocation="http://www.nic.cz/xml/epp/contact-1.6 contact-1.6.xsd">
|
||||
<contact:id>CID:TEST:10</contact:id>
|
||||
<contact:postalInfo>
|
||||
<contact:name>Test</contact:name>
|
||||
<contact:addr><contact:street>Test Street 11-2</contact:street>
|
||||
<contact:city>Test City</contact:city>
|
||||
<contact:pc>123456</contact:pc>
|
||||
<contact:cc>EE</contact:cc>
|
||||
</contact:addr>
|
||||
</contact:postalInfo>
|
||||
<contact:voice>+372.5555555</contact:voice>
|
||||
<contact:email>test@test.com</contact:email>
|
||||
<contact:ident type="op">37812124567</contact:ident>
|
||||
</contact:create>
|
||||
</create>
|
||||
<clTRID>neka005#10-02-08at13:51:37</clTRID>
|
||||
</command>
|
||||
</epp>
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
|
||||
<command>
|
||||
<create>
|
||||
<contact:create
|
||||
xmlns:contact="urn:ietf:params:xml:ns:contact-1.0">
|
||||
<contact:id>sh8013</contact:id>
|
||||
<contact:postalInfo type="int">
|
||||
<contact:name>John Doe</contact:name>
|
||||
<contact:org>Example Inc.</contact:org>
|
||||
<contact:addr>
|
||||
<contact:street>123 Example Dr.</contact:street>
|
||||
<contact:street>Suite 100</contact:street>
|
||||
<contact:city>Dulles</contact:city>
|
||||
<contact:sp>VA</contact:sp>
|
||||
<contact:pc>20166-6503</contact:pc>
|
||||
<contact:cc>US</contact:cc>
|
||||
</contact:addr>
|
||||
</contact:postalInfo>
|
||||
<contact:voice x="1234">+1.7035555555</contact:voice>
|
||||
<contact:fax>+1.7035555556</contact:fax>
|
||||
<contact:email>jdoe@example.com</contact:email>
|
||||
<contact:authInfo>
|
||||
<contact:pw>2fooBAR</contact:pw>
|
||||
</contact:authInfo>
|
||||
<contact:disclose flag="0">
|
||||
<contact:voice/>
|
||||
<contact:email/>
|
||||
</contact:disclose>
|
||||
</contact:create>
|
||||
</create>
|
||||
<clTRID>ABC-12345</clTRID>
|
||||
</command>
|
||||
</epp>
|
||||
|
|
|
@ -2,20 +2,20 @@
|
|||
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd">
|
||||
<command>
|
||||
<login>
|
||||
<clID>test</clID>
|
||||
<pw>test</pw>
|
||||
<clID>gitlab</clID>
|
||||
<pw>ghyt9e4fu</pw>
|
||||
<options>
|
||||
<version>1.0</version>
|
||||
<lang>en</lang>
|
||||
</options>
|
||||
<svcs>
|
||||
<objURI>http://www.nic.cz/xml/epp/contact-1.6</objURI>
|
||||
<objURI>http://www.nic.cz/xml/epp/nsset-1.2</objURI>
|
||||
<objURI>http://www.nic.cz/xml/epp/domain-1.4</objURI>
|
||||
<objURI>http://www.nic.cz/xml/epp/keyset-1.3</objURI>
|
||||
<svcExtension>
|
||||
<objURI>urn:ietf:params:xml:ns:contact-1.0</objURI>
|
||||
<!-- <objURI>http://www.nic.cz/xml/epp/nsset-1.2</objURI> -->
|
||||
<!-- <objURI>http://www.nic.cz/xml/epp/domain-1.4</objURI> -->
|
||||
<!-- <objURI>http://www.nic.cz/xml/epp/keyset-1.3</objURI> -->
|
||||
<!-- <svcExtension>
|
||||
<extURI>http://www.nic.cz/xml/epp/enumval-1.2</extURI>
|
||||
</svcExtension>
|
||||
</svcExtension> -->
|
||||
</svcs>
|
||||
</login>
|
||||
<clTRID>wgyn001#10-02-08at13:58:06</clTRID>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
Fabricator(:epp_user) do
|
||||
username 'test'
|
||||
password 'test'
|
||||
username 'gitlab'
|
||||
password 'ghyt9e4fu'
|
||||
registrar
|
||||
active true
|
||||
end
|
||||
|
|
|
@ -5,21 +5,30 @@ module Epp
|
|||
|
||||
# handles connection and login automatically
|
||||
def epp_request filename
|
||||
res = Nokogiri::XML(server.request(read_body(filename)))
|
||||
parse_response(res)
|
||||
begin
|
||||
parse_response(server.request(read_body(filename)))
|
||||
rescue Exception => e
|
||||
e
|
||||
end
|
||||
end
|
||||
|
||||
def epp_plain_request filename
|
||||
res = Nokogiri::XML(server.send_request(read_body(filename)))
|
||||
parse_response(res)
|
||||
begin
|
||||
parse_response(server.send_request(read_body(filename)))
|
||||
rescue Exception => e
|
||||
e
|
||||
end
|
||||
end
|
||||
|
||||
def parse_response res
|
||||
def parse_response raw
|
||||
res = Nokogiri::XML(raw)
|
||||
|
||||
{
|
||||
result_code: res.css('epp response result').first[:code],
|
||||
msg: res.css('epp response result msg').text,
|
||||
clTRID: res.css('epp trID clTRID').text,
|
||||
parsed: res.remove_namespaces!
|
||||
parsed: res.remove_namespaces!,
|
||||
raw: raw
|
||||
}
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue