swp-fu-eid / eid-fu-swp

Docker-based REST API implemented with Django and restframework.
MIT License
2 stars 1 forks source link

Add eID python types #51

Closed m273d15 closed 6 years ago

m273d15 commented 7 years ago

Types to implement (see eID-Server specification):

m273d15 commented 7 years ago

Implementing VersionType and starting to configure a test infrastructure for python scripts

Armagetron commented 7 years ago

Waiting for first commit. Then I will add SessionType.

m273d15 commented 7 years ago

Implementing PlaceType and ICAOCountry

larissazech commented 7 years ago

Implementing VerificationResultType, AttributeSelectionType and OperationsSelectorType.

m273d15 commented 7 years ago

implementing GeneralPlaceType

larissazech commented 7 years ago

Implementing AttributeRequestType and OperationsRequestorType.

auvin commented 7 years ago

Implementing AttributeResponseType

auvin commented 7 years ago

Some Types need Datatypes which are not described in the eID-Server specification like AgeType or CommunityIDType. I think some of them are described in TR-03127 and we have to implement these as well.

auvin commented 7 years ago

The data types involve mostly complex data types defined in the XML Schema Definition (XSD). The corresponding XSD-File TR-03130eID-Server.xsd is attached to this guideline.

So in the TR-03130eID-Server.xsd are the complex data types described.

auvin commented 7 years ago

The GeneralDateType is described as follows:

<complexType name="GeneralDateType">
    <sequence>
        <element name="DateString">
            <simpleType>
                <restriction base="string">
                    <whiteSpace value="preserve" />
                    <pattern value="[0-9 ]{8}" />
                </restriction>
            </simpleType>
        </element>
        <element name="DateValue" type="date" minOccurs="0" />
    </sequence>
</complexType>

So the element DateValue has type date, which i think is reffering to the XSD type xs:date. Now i am not sure if ishould implement this datatype as a simple string, with an own date-class or with the build in date-object provided by python (datetime.date)?

Solution: Take the the build in classes/objects from python.

Armagetron commented 7 years ago

SessionID added

Armagetron commented 7 years ago

WSDLs are available in this branch: https://github.com/swp-fu-eid/eid-fu-swp/tree/eid_server_wsdl

larissazech commented 7 years ago

@nielsgroth and I are quite confused by the specifications of the GeneralDateType, or, more specifically, of the DateString. The definition in the eID-Server specification reads as follows:

The data type GeneralDateType MUST contain the date representation read directly from the chip in the DateString element. An 8-place string SHALL be used here that MUST contain spaces as well as numerical values (0-9). It's transmitted in the yyyymmdd format (4 places for the year, 2 places for the month and 2 places for the day) as specified in [EAC] Part 2 Annex A Section 2: ASN.1 Definition. The optional element DateValue of the simple type date MUST only be present if the eID-Server was able to read a complete date from the eID Application.

and taken from the xsd (as already mentioned above):

Now, what format do we accept? Where do we accept whitespaces? Does the DateString really must contain whitespaces? Somewhere...? And do they count into the 8 places? And do we keep them?

@Armagetron @nils-wisiol feedback is greatly appreciated.

Armagetron commented 7 years ago

I understand the definition in a way that the date should have the form "20170825" but "2017 08 25" should be understood as well.

larissazech commented 7 years ago

All specified types seem to be implemented by now.

@Armagetron @m273d15 @nielsgroth What should be done in preparation of the pull request?

nils-wisiol commented 7 years ago

I believe

MUST contain spaces as well as numerical values (0-9)

should be read as in: must contain (spaces and numerical values). So either is fine. Then I'd read

An 8-place string SHALL be used here

as in: it could be more or less than 8 chars.

Therefore, I agree with @Armagetron that, judging from the docs, 2017 08 25 should be accepted. <pattern value="[0-9 ]{8}" /> however does not match 2017 08 25 (wtf?).

I propose, whenever we need to parse a date formatted like this, remove all whitespace before parsing. Whenever we render a date like this, do not include whitespace. That way we should somewhat follow the standard and be compatible to whoever else had to implement this.

larissazech commented 6 years ago

Implemented by #70. Closed.