Conversation
Signed-off-by: Stefan Wiedemann <wistefan@googlemail.com>
| @Slf4j | ||
| public class ClaimsEvaluator { | ||
|
|
||
| private static final String SD_KEY = "_sd"; |
There was a problem hiding this comment.
Maybe a additional documentation for this key would be useful. At least I was unfamiliar with the selective disclosure field specifics
| Object candidate = candidateWrapper.value; | ||
|
|
||
| // If map contains _sd, reveal it and MERGE revealed entries with the original map | ||
| if (disclosures != null && candidate instanceof Map<?, ?> mapCandidate && mapCandidate.containsKey("_sd")) { |
There was a problem hiding this comment.
| if (disclosures != null && candidate instanceof Map<?, ?> mapCandidate && mapCandidate.containsKey("_sd")) { | |
| if (disclosures != null && candidate instanceof Map<?, ?> mapCandidate && mapCandidate.containsKey(SD_KEY)) { |
|
|
||
| // If map contains _sd, reveal it and MERGE revealed entries with the original map | ||
| if (disclosures != null && candidate instanceof Map<?, ?> mapCandidate && mapCandidate.containsKey("_sd")) { | ||
| Object sdObj = mapCandidate.get("_sd"); |
There was a problem hiding this comment.
| Object sdObj = mapCandidate.get("_sd"); | |
| Object sdObj = mapCandidate.get(SD_KEY); |
| .toList(); | ||
| } | ||
|
|
||
| public static List<LdpCredential> toLdpCredentials(List<Credential> credentialsList) { |
There was a problem hiding this comment.
Just out of curiosity: Would it be a possible scenario to have a type-mixed set of credentials?
There was a problem hiding this comment.
Initially yes, but we filter the list of credentials for format, before mapping them. This can be done, because since "format" is a mandatory field for every DCQL, e.g. every DCQL can only return a single type of format. Thus, we filter out the credentials by format, map them to the concrete format and apply the query to that pre-filtered list.
| selectedCredentials.addAll(credentialsFullfilling); | ||
| } | ||
| // if no sets are requested, put the credentials at one | ||
| return new QueryResult(true, Map.of("credentials", selectedCredentials)); |
There was a problem hiding this comment.
| return new QueryResult(true, Map.of("credentials", selectedCredentials)); | |
| return new QueryResult(true, Map.of(DEFAULT_KEY, selectedCredentials)); |
|
|
||
| private static List<Credential> evaluateCredentialQuery(CredentialQuery credentialQuery, List<Credential> credentialsList) { | ||
|
|
||
| if (!containsClaims(credentialQuery) |
There was a problem hiding this comment.
Either I have a "Knick in der Optik" or you might have to check this condition
No description provided.