Skip to content

temp support for tech-x #10

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions api/credentials-config-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,30 @@ components:
example: https://til-pdc.gaia-x.fiware.dev
holderVerification:
$ref: '#/components/schemas/HolderVerification'
requireCompliance:
type: boolean
default: false
description: Does the given credential require a compliancy credential
jwtInclusion:
$ref: '#/components/schemas/JwtInclusion'
required:
- type
JwtInclusion:
type: object
properties:
enabled:
type: boolean
default: true
description: Should the given credential be included into the generated JWT
fullInclusion:
type: boolean
default: false
description: Should the complete credential be embedded
claimsToInclude:
type: array
description: Claims to be included
items:
type: string
TrustedParticipantsListEndpoint:
type: object
description: Endpoint of the trusted participants list and its type
Expand Down
7 changes: 7 additions & 0 deletions src/main/java/org/fiware/iam/ServiceMapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,14 @@ default Credential map(CredentialVO credentialVO) {
credential.setVerifyHolder(false);
credential.setHolderClaim(null);
}
credential.setRequireCompliance(credentialVO.getRequireCompliance());
credential.setJwtInclusion(map(credentialVO.getJwtInclusion()));
return credential;
}

JwtInclusion map(JwtInclusionVO jwtInclusionVO);
JwtInclusionVO map(JwtInclusion jwtInclusion);

default Collection<CredentialVO> map(Collection<Credential> credentials) {
if (credentials == null) {
return null;
Expand All @@ -97,6 +102,8 @@ default CredentialVO map(Credential credential) {
.type(credential.getCredentialType())
.trustedIssuersLists(entriesToIssuers(credential.getTrustedLists()))
.trustedParticipantsLists(entriesToParticipants(credential.getTrustedLists()).stream().map(Object.class::cast).toList())
.requireCompliance(credential.isRequireCompliance())
.jwtInclusion(map(credential.getJwtInclusion()))
.holderVerification(new HolderVerificationVO()
.enabled(credential.isVerifyHolder())
.claim(credential.getHolderClaim()));
Expand Down
13 changes: 4 additions & 9 deletions src/main/java/org/fiware/iam/repository/Credential.java
Original file line number Diff line number Diff line change
@@ -1,17 +1,8 @@
package org.fiware.iam.repository;

import io.micronaut.core.annotation.Introspected;
import jakarta.persistence.CascadeType;
import jakarta.persistence.Entity;
import jakarta.persistence.FetchType;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.Id;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.ManyToOne;
import jakarta.persistence.OneToMany;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import lombok.experimental.Accessors;

import java.util.List;
Expand All @@ -33,5 +24,9 @@ public class Credential {

private boolean verifyHolder;

private boolean requireCompliance;

private JwtInclusion jwtInclusion;

private String holderClaim;
}
19 changes: 19 additions & 0 deletions src/main/java/org/fiware/iam/repository/JwtInclusion.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package org.fiware.iam.repository;

import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import java.util.List;

@Getter
@Setter
@EqualsAndHashCode
@ToString
public class JwtInclusion {

private boolean enabled;
private boolean fullInclusion;
private List<String> claimsToInclude;
}
Loading