Skip to content

Commit 0ce1208

Browse files
authored
Add dcql support (#17)
* extend api * support dcql * run on test * fix tests
1 parent f57c8e6 commit 0ce1208

File tree

14 files changed

+464
-29
lines changed

14 files changed

+464
-29
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ name: Test
22

33
on:
44
push:
5+
pull_request:
56

67
jobs:
78
test:

api/credentials-config-service.yaml

Lines changed: 172 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,10 +290,16 @@ components:
290290
$ref: '#/components/schemas/Credential'
291291
presentationDefinition:
292292
$ref: '#/components/schemas/PresentationDefinition'
293+
nullable: true
294+
dcql:
295+
$ref: '#/components/schemas/DCQL'
296+
nullable: true
293297
flatClaims:
294298
type: boolean
295299
default: false
296300
description: When set, the claim are flatten to plain JWT-claims before beeing included, instead of keeping the credential/presentation structure, where the claims are under the key vc or vp
301+
required:
302+
- credentials
297303
Service:
298304
type: object
299305
description: Configuration of a service and its credentials
@@ -311,6 +317,13 @@ components:
311317
description: A specific OIDC scope for that service, specifying the necessary VC types (credentials)
312318
additionalProperties:
313319
$ref: '#/components/schemas/ServiceScopesEntry'
320+
authorizationType:
321+
type: string
322+
description: The authorization redirect to be created.
323+
default: FRONTEND_V2
324+
enum:
325+
- FRONTEND_V2
326+
- DEEPLINK
314327
required:
315328
- oidcScopes
316329
- defaultOidcScope
@@ -335,6 +348,165 @@ components:
335348
description: The list of services
336349
items:
337350
$ref: '#/components/schemas/Service'
351+
DCQL:
352+
type: object
353+
description: JSON encoded query to request the credentials to be included in the presentation
354+
properties:
355+
credentials:
356+
type: array
357+
description: A non-empty array of Credential Queries that specify the requested Credentials.
358+
items:
359+
$ref: '#/components/schemas/CredentialQuery'
360+
credential_sets:
361+
type: array
362+
description: A non-empty array of Credential Set Queries that specifies additional constraints on which of the requested Credentials to return.
363+
items:
364+
$ref: '#/components/schemas/CredentialSetQuery'
365+
required:
366+
- credentials
367+
CredentialQuery:
368+
type: object
369+
description: A Credential Query is an object representing a request for a presentation of one or more matching Credentials
370+
properties:
371+
id:
372+
type: string
373+
description: A string identifying the Credential in the response and, if provided, the constraints in credential_sets. The value MUST be a non-empty string consisting of alphanumeric, underscore (_), or hyphen (-) characters. Within the Authorization Request, the same id MUST NOT be present more than once.
374+
example: my-credential-query-id
375+
format:
376+
type: string
377+
description: A string that specifies the format of the requested Credential.
378+
enum:
379+
- mso_mdoc
380+
- vc+sd-jwt
381+
- dc+sd-jwt
382+
- ldp_vc
383+
- jwt_vc_json
384+
example: jwt_vc_json
385+
multiple:
386+
type: boolean
387+
default: false
388+
description: A boolean which indicates whether multiple Credentials can be returned for this Credential Query. If omitted, the default value is false.
389+
example: false
390+
claims:
391+
type: array
392+
description: A non-empty array of objects that specifies claims in the requested Credential. Verifiers MUST NOT point to the same claim more than once in a single query. Wallets SHOULD ignore such duplicate claim queries.
393+
items:
394+
$ref: '#/components/schemas/ClaimsQuery'
395+
meta:
396+
$ref: '#/components/schemas/MetaDataQuery'
397+
require_cryptographic_holder_binding:
398+
type: boolean
399+
default: true
400+
description: A boolean which indicates whether the Verifier requires a Cryptographic Holder Binding proof. The default value is true, i.e., a Verifiable Presentation with Cryptographic Holder Binding is required. If set to false, the Verifier accepts a Credential without Cryptographic Holder Binding proof.
401+
example: true
402+
claim_sets:
403+
type: array
404+
description: A non-empty array containing arrays of identifiers for elements in claims that specifies which combinations of claims for the Credential are requested.
405+
items:
406+
$ref: '#/components/schemas/ClaimSet'
407+
trusted_authorities:
408+
type: array
409+
description: A non-empty array of objects that specifies expected authorities or trust frameworks that certify Issuers, that the Verifier will accept. Every Credential returned by the Wallet SHOULD match at least one of the conditions present in the corresponding trusted_authorities array if present.
410+
items:
411+
$ref: '#/components/schemas/TrustedAuthorityQuery'
412+
ClaimsQuery:
413+
type: object
414+
description: A query to specifies claims in the requested Credential.
415+
properties:
416+
id:
417+
type: string
418+
description: REQUIRED if claim_sets is present in the Credential Query; OPTIONAL otherwise. A string identifying the particular claim. The value MUST be a non-empty string consisting of alphanumeric, underscore (_), or hyphen (-) characters. Within the particular claims array, the same id MUST NOT be present more than once.
419+
example: my-claim-query-id
420+
path:
421+
type: array
422+
description: The value MUST be a non-empty array representing a claims path pointer that specifies the path to a claim within the Credential. See https://openid.net/specs/openid-4-verifiable-presentations-1_0.html#name-claims-path-pointer
423+
items:
424+
type: object
425+
example: ["path", "to", "claim"]
426+
values:
427+
type: array
428+
description: A non-empty array of strings, integers or boolean values that specifies the expected values of the claim. If the values property is present, the Wallet SHOULD return the claim only if the type and value of the claim both match exactly for at least one of the elements in the array.
429+
items:
430+
type: object
431+
example: ["supported-value-1", "supported-value-2"]
432+
intent_to_retain:
433+
type: boolean
434+
description: MDoc specific parameter, ignored for all other types. The flag can be set to inform that the reader wishes to keep(store) the data. In case of false, its data is only used to be dispalyed and verified.
435+
example: false
436+
namespace:
437+
type: string
438+
description: MDoc specific parameter, ignored for all other types. Refers to a namespace inside an mdoc.
439+
example: "org.iso.7367.1"
440+
claim_name:
441+
type: string
442+
description: MDoc specific parameter, ignored for all other types. Identifier for the data-element in the namespace.
443+
example: "first_name"
444+
MetaDataQuery:
445+
type: object
446+
description: Defines additional properties requested by the Verifier that apply to the metadata and validity data of the Credential. The properties of this object are defined per Credential Format. If empty, no specific constraints are placed on the metadata or validity of the requested Credential.
447+
properties:
448+
vct_values:
449+
type: array
450+
description: SD-JWT and JWT specific parameter. A non-empty array of strings that specifies allowed values for the type of the requested Verifiable Credential.The Wallet MAY return Credentials that inherit from any of the specified types, following the inheritance logic defined in https://datatracker.ietf.org/doc/html/draft-ietf-oauth-sd-jwt-vc-10
451+
items:
452+
type: string
453+
doctype_value:
454+
type: string
455+
description: Required for MDoc. String that specifies an allowed value for the doctype of the requested Verifiable Credential. It MUST be a valid doctype identifier as defined in https://www.iso.org/standard/69084.html
456+
example: "org.iso.7367.1.mVRC"
457+
type_values:
458+
type: array
459+
description: Required for ldp_vc. A non-empty array of string arrays. The Type value of the credential needs to be a subset of at least one of the string-arrays.
460+
items:
461+
type: array
462+
items:
463+
type: string
464+
ClaimSet:
465+
type: array
466+
description: An array contain identifiers of elements in the claims, that specifies wich combination of claims is requested
467+
items:
468+
type: string
469+
example: ["claim-id-a","claim-id-b"]
470+
TrustedAuthorityQuery:
471+
type: object
472+
description: An object representing information that helps to identify an authority or the trust framework that certifies Issuers. A Credential is identified as a match to a Trusted Authorities Query if it matches with one of the provided values in one of the provided types.
473+
properties:
474+
type:
475+
type: string
476+
description: A string uniquely identifying the type of information about the issuer trust framework.
477+
- aki
478+
- etsi_tl
479+
- openid_federation
480+
example: "aki"
481+
values:
482+
type: array
483+
description: A non-empty array of strings, where each string (value) contains information specific to the used Trusted Authorities Query type that allows the identification of an issuer, a trust framework, or a federation that an issuer belongs to.
484+
items:
485+
type: string
486+
example: ["s9tIpPmhxdiuNkHMEWNpYim8S8Y"]
487+
required:
488+
- type
489+
- values
490+
CredentialSetQuery:
491+
type: object
492+
description: A Credential Set Query is an object representing a request for one or more Credentials to satisfy a particular use case with the Verifier.
493+
properties:
494+
options:
495+
type: array
496+
description: A non-empty array, where each value in the array is a list of Credential Query identifiers representing one set of Credentials that satisfies the use case. The value of each element in the options array is a non-empty array of identifiers which reference elements in credentials.
497+
items:
498+
type: array
499+
items:
500+
type: string
501+
required:
502+
type: boolean
503+
description: A boolean which indicates whether this set of Credentials is required to satisfy the particular use case at the Verifier.
504+
default: true
505+
example: true
506+
purpose:
507+
type: object
508+
description: A string, number or object specifying the purpose of the query. This specification does not define a specific structure or specific values for this property. The purpose is intended to be used by the Verifier to communicate the reason for the query to the Wallet. The Wallet MAY use this information to show the user the reason for the request.
509+
example: "Identification"
338510
PresentationDefinition:
339511
type: object
340512
description: Proofs required by the service - see https://identity.foundation/presentation-exchange/#presentation-definition

pom.xml

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@
7070
<version.org.openapitools.generator-maven-plugin>6.6.0</version.org.openapitools.generator-maven-plugin>
7171
<version.io.kokuwa.micronaut.codegen>3.4.6</version.io.kokuwa.micronaut.codegen>
7272

73+
<!-- dcql -->
74+
<version.io.github.wistefan.dcql-java>0.0.1</version.io.github.wistefan.dcql-java>
75+
7376
<!-- test -->
7477
<version.org.mockito.mocktio-all>1.10.19</version.org.mockito.mocktio-all>
7578

@@ -82,7 +85,6 @@
8285
<jacoco.utReportFile>${jacoco.reportFolder}/test.exec</jacoco.utReportFile>
8386
</properties>
8487

85-
8688
<dependencyManagement>
8789
<dependencies>
8890
<dependency>
@@ -140,6 +142,13 @@
140142
<artifactId>micronaut-jackson-databind</artifactId>
141143
</dependency>
142144

145+
<!-- dcql -->
146+
<dependency>
147+
<groupId>io.github.wistefan</groupId>
148+
<artifactId>dcql-java</artifactId>
149+
<version>${version.io.github.wistefan.dcql-java}</version>
150+
</dependency>
151+
143152
<!-- required for config micronaut > 4.x -->
144153
<dependency>
145154
<groupId>org.yaml</groupId>
@@ -262,7 +271,7 @@
262271
<version>${version.org.openapitools.generator-maven-plugin}</version>
263272
<executions>
264273
<execution>
265-
<id>til</id>
274+
<id>ccs</id>
266275
<phase>generate-sources</phase>
267276
<goals>
268277
<goal>generate</goal>
@@ -272,7 +281,7 @@
272281
<apiPackage>org.fiware.iam.ccs.api</apiPackage>
273282
<strictSpec>true</strictSpec>
274283
<modelPackage>org.fiware.iam.ccs.model</modelPackage>
275-
<generateAliasAsModel>true</generateAliasAsModel>
284+
<generateAliasAsModel>false</generateAliasAsModel>
276285
<generateModels>true</generateModels>
277286
<generateApiTests>true</generateApiTests>
278287
<generatorName>micronaut</generatorName>
@@ -286,7 +295,7 @@
286295
<introspected>true</introspected>
287296
<useBeanValidation>false</useBeanValidation>
288297
<supportAsync>false</supportAsync>
289-
<jacksonDatabindNullable>false</jacksonDatabindNullable>
298+
<jacksonDatabindNullable>true</jacksonDatabindNullable>
290299
<generateExamples>true</generateExamples>
291300
</configOptions>
292301
<typeMappings>

0 commit comments

Comments
 (0)