italia / eudi-wallet-it-python

Python toolchain for building an OpenID4VP RP with a SATOSA backend compliant with the Italian Wallet implementation profile
Apache License 2.0
17 stars 14 forks source link

pydantic schema validator for entity configuration #48

Closed Pyscho79 closed 1 year ago

Pyscho79 commented 1 year ago
peppelinux commented 1 year ago

Please see

https://github.com/italia/spid-cie-oidc-django/tree/main/spid_cie_oidc/entity/schemas

salvatorelaiso commented 1 year ago

Relying Party Entity Configuration has metadata specification TBD.

Could you suggest me where to retrieve the information needed to complete the task?

peppelinux commented 1 year ago

We have an open issue in openid foundation before resolving that TBD

please use for now the non normative example, I'll give you in the revision the parameters that will be set as optional

salvatorelaiso commented 1 year ago

Relying Party Entity Configuration provides an example of presentation_definition as follows:

{
  "presentation_definition": {
    "id": "presentation definitions",
    "input_descriptors": [
      {
        "id": "pid-sd-jwt:unique_id+given_name+family_name",
        "name": "Person Identification Data",
        "purpose": "User authentication",
        "format": "vc+sd-jwt",
        "constraints": {
          "fields": [
            {
              "path": [
                "$.credentialSubject.unique_id",
                "$.credentialSubject.given_name",
                "$.credentialSubject.family_name",
              ]
            }
          ],
          "limit_discolusre": "preferred"
        }
      }
    ]
  }
}

and in the example of Entity Configuration we have the following array of presentation_definition

"presentation_definitions": [
                  {
                    "id": "pid-sd-jwt:unique_id+given_name+family_name",
                    "input_descriptors": [
                        {
                            "id": "sd-jwt",
                            "format": {
                                "jwt": {
                                    "alg": [
                                        "EdDSA",
                                        "ES256"
                                    ]
                                },
                                "constraints": {
                                    "limit_disclosure": "required",
                                    "fields": [
                                        {
                                            "path": [
                                                "$.sd-jwt.type"
                                            ],
                                            "filter": {
                                                "type": "string",
                                                "const": "PersonIdentificationData"
                                            }
                                        },
                                        {
                                            "path": [
                                                "$.sd-jwt.cnf"
                                            ],
                                            "filter": {
                                                "type": "object",
                                            }
                                        },
                                        {
                                            "path": [
                                                "$.sd-jwt.family_name"
                                            ],
                                            "intent_to_retain": "true"
                                        },
                                        {
                                            "path": [
                                                "$.sd-jwt.given_name"
                                            ],
                                            "intent_to_retain": "true"
                                        },
                                        {
                                            "path": [
                                                "$.sd-jwt.unique_id"
                                            ],
                                            "intent_to_retain": "true"
                                        }
                                    ]
                                }
                            }
                        }
                    ]
                  },
                  {
                    "id": "mDL-sample-req",
                    "input_descriptors": [
                        {
                            "id": "mDL",
                            "format": {
                                "mso_mdoc": {
                                    "alg": [
                                        "EdDSA",
                                        "ES256"
                                    ]
                                },
                                "constraints": {
                                    "limit_disclosure": "required",
                                    "fields": [
                                        {
                                            "path": [
                                                "$.mdoc.doctype"
                                            ],
                                            "filter": {
                                                "type": "string",
                                                "const": "org.iso.18013.5.1.mDL"
                                            }
                                        },
                                        {
                                            "path": [
                                                "$.mdoc.namespace"
                                            ],
                                            "filter": {
                                                "type": "string",
                                                "const": "org.iso.18013.5.1"
                                            }
                                        },
                                        {
                                            "path": [
                                                "$.mdoc.family_name"
                                            ],
                                            "intent_to_retain": "false"
                                        },
                                        {
                                            "path": [
                                                "$.mdoc.portrait"
                                            ],
                                            "intent_to_retain": "false"
                                        },
                                        {
                                            "path": [
                                                "$.mdoc.driving_privileges"
                                            ],
                                            "intent_to_retain": "false"
                                        }
                                    ]
                                }
                            }
                        }
                    ]
                }
            ],

As you can see, input_descriptors have different format type. In the first one we have a simple string while in the second example we can see format as a dict. Can we assume both to be valid?

Pyscho79 commented 1 year ago

From the DIF standard, schema Entity Configuration to push in Federation ./pyeudiw.presentation_exchange