Skip to content

Commit

Permalink
bug fixing and api update
Browse files Browse the repository at this point in the history
  • Loading branch information
pulledtim committed Nov 10, 2023
1 parent f56c653 commit 8c3433b
Show file tree
Hide file tree
Showing 21 changed files with 43 additions and 769 deletions.
11 changes: 4 additions & 7 deletions api/credentials-config-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -214,11 +214,6 @@ components:
example: https://til-pdc.gaia-x.fiware.dev
required:
- type
ServiceScopes:
type: object
description: A specific OIDC scope for that service, specifying the necessary VC types (credentials)
additionalProperties:
$ref: '#/components/schemas/ServiceScopesEntry'
ServiceScopesEntry:
type: array
minItems: 1
Expand All @@ -237,8 +232,10 @@ components:
description: Default OIDC scope to be used if none is specified
example: default
oidcScopes:
$ref: '#/components/schemas/ServiceScopes'
#default: null
type: object
description: A specific OIDC scope for that service, specifying the necessary VC types (credentials)
additionalProperties:
$ref: '#/components/schemas/ServiceScopesEntry'
required:
- oidcScopes
- defaultOidcScope
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@

<!-- code gen -->
<version.org.openapitools.generator-maven-plugin>6.6.0</version.org.openapitools.generator-maven-plugin>
<version.io.kokuwa.micronaut.codegen>3.4.5</version.io.kokuwa.micronaut.codegen>
<version.io.kokuwa.micronaut.codegen>3.4.6</version.io.kokuwa.micronaut.codegen>

<!-- test -->
<version.org.mockito.mocktio-all>1.10.19</version.org.mockito.mocktio-all>
Expand Down Expand Up @@ -246,7 +246,7 @@
<strictSpec>true</strictSpec>
<modelPackage>org.fiware.iam.ccs.model</modelPackage>
<generateAliasAsModel>true</generateAliasAsModel>
<generateModels>false</generateModels>
<generateModels>true</generateModels>
<generateApiTests>true</generateApiTests>
<generatorName>micronaut</generatorName>
<modelNameSuffix>VO</modelNameSuffix>
Expand Down
22 changes: 11 additions & 11 deletions src/main/java/org/fiware/iam/ServiceMapper.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
package org.fiware.iam;

import org.fiware.iam.ccs.model.CredentialVO;
import org.fiware.iam.ccs.model.ServiceScopesEntryVO;
import org.fiware.iam.ccs.model.ServiceScopesVO;
import org.fiware.iam.ccs.model.ServiceVO;
import org.fiware.iam.ccs.model.*;
import org.fiware.iam.repository.Credential;
import org.fiware.iam.repository.EndpointEntry;
import org.fiware.iam.repository.EndpointType;
Expand All @@ -21,17 +18,20 @@ public interface ServiceMapper {

Service map(ServiceVO serviceVO);

default Map<String, Collection<Credential>> map(ServiceScopesVO value) {

default Map<String,Collection<Credential>> map(Map<String,ServiceScopesEntryVO> value){
return Optional.ofNullable(value)
.orElseGet(ServiceScopesVO::new)
.orElseGet(Map::of)
.entrySet()
.stream()
.collect(Collectors.toMap(Map.Entry::getKey, e -> e.getValue().stream().map(this::map).toList()));
}

default ServiceScopesVO mapCredentials(Map<String, Collection<Credential>> scopes) {
ServiceScopesVO answer = new ServiceScopesVO();
scopes.entrySet().forEach(entry -> {
default Map<String,ServiceScopesEntryVO> mapCredentials(Map<String,Collection<Credential>> value){
Map<String,ServiceScopesEntryVO> answer = new HashMap<>();
Optional.ofNullable(value)
.orElseGet(Map::of)
.entrySet().forEach(entry -> {
ServiceScopesEntryVO credentialVOS = new ServiceScopesEntryVO();
entry.getValue().stream().map(this::map).forEach(credentialVOS::add);
answer.put(entry.getKey(), credentialVOS);
Expand Down Expand Up @@ -73,7 +73,7 @@ default CredentialVO map(Credential credential) {

/**
* Map a list of string-entries, encoding TrustedParticipants endpoints to a list of {@link EndpointEntry} with
* type {{@link EndpointType.TRUSTED_PARTICIPANTS}
* type {{@link EndpointType#TRUSTED_PARTICIPANTS}
*/
default List<EndpointEntry> participantsToEntries(List<String> endpoints) {
if (endpoints == null) {
Expand All @@ -88,7 +88,7 @@ default List<EndpointEntry> participantsToEntries(List<String> endpoints) {

/**
* Map a list of string-entries, encoding TrustedIssuers endpoints to a list of {@link EndpointEntry} with
* type {{@link EndpointType.TRUSTED_ISSUERS}
* type {{@link EndpointType#TRUSTED_ISSUERS}
*/
default List<EndpointEntry> issuersToEntries(List<String> endpoints) {
if (endpoints == null) {
Expand Down
130 changes: 0 additions & 130 deletions src/main/java/org/fiware/iam/ccs/model/CredentialVO.java

This file was deleted.

142 changes: 0 additions & 142 deletions src/main/java/org/fiware/iam/ccs/model/ProblemDetailsVO.java

This file was deleted.

Loading

0 comments on commit 8c3433b

Please sign in to comment.