-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Ssi): add credential issuer and credential subject id validation…
… rules
- Loading branch information
Showing
36 changed files
with
811 additions
and
135 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -127,6 +127,7 @@ controlplane: | |
miw: | ||
url: "" | ||
authorityId: "" | ||
authorityIssuer: "" | ||
oauth: | ||
tokenurl: "" | ||
client: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -125,6 +125,7 @@ runtime: | |
miw: | ||
url: "" | ||
authorityId: "" | ||
authorityIssuer: "" | ||
oauth: | ||
tokenurl: "" | ||
client: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -128,6 +128,7 @@ controlplane: | |
miw: | ||
url: "" | ||
authorityId: "" | ||
authorityIssuer: "" | ||
oauth: | ||
tokenurl: "" | ||
client: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,6 +44,7 @@ controlplane: | |
miw: | ||
url: "" | ||
authorityId: "" | ||
authorityIssuer: "" | ||
oauth: | ||
tokenurl: "" | ||
client: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,6 +43,7 @@ controlplane: | |
miw: | ||
url: "" | ||
authorityId: "" | ||
authorityIssuer: "" | ||
oauth: | ||
tokenurl: "" | ||
client: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
97 changes: 0 additions & 97 deletions
97
...c/test/java/org/eclipse/tractusx/edc/iam/ssi/identity/extractor/fixtures/Credentials.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
...ient/src/main/java/org/eclipse/tractusx/edc/iam/ssi/miw/SsiMiwConfigurationExtension.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/* | ||
* Copyright (c) 2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Apache License, Version 2.0 which is available at | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* Contributors: | ||
* Bayerische Motoren Werke Aktiengesellschaft (BMW AG) - initial API and implementation | ||
* | ||
*/ | ||
|
||
package org.eclipse.tractusx.edc.iam.ssi.miw; | ||
|
||
import org.eclipse.edc.runtime.metamodel.annotation.Extension; | ||
import org.eclipse.edc.runtime.metamodel.annotation.Provider; | ||
import org.eclipse.edc.runtime.metamodel.annotation.Setting; | ||
import org.eclipse.edc.spi.system.ServiceExtension; | ||
import org.eclipse.edc.spi.system.ServiceExtensionContext; | ||
import org.eclipse.tractusx.edc.iam.ssi.miw.config.SsiMiwConfiguration; | ||
|
||
import java.net.URI; | ||
import java.net.URLEncoder; | ||
import java.nio.charset.StandardCharsets; | ||
|
||
import static java.lang.String.format; | ||
|
||
|
||
@Extension(SsiMiwConfigurationExtension.EXTENSION_NAME) | ||
public class SsiMiwConfigurationExtension implements ServiceExtension { | ||
|
||
|
||
@Setting(value = "MIW API base url") | ||
public static final String MIW_BASE_URL = "tx.ssi.miw.url"; | ||
@Setting(value = "MIW Authority ID") | ||
public static final String MIW_AUTHORITY_ID = "tx.ssi.miw.authority.id"; | ||
@Setting(value = "MIW Authority Issuer") | ||
public static final String MIW_AUTHORITY_ISSUER = "tx.ssi.miw.authority.issuer"; | ||
public static final String AUTHORITY_ID_TEMPLATE = "did:web:%s:%s"; | ||
protected static final String EXTENSION_NAME = "SSI Miw configuration extension"; | ||
|
||
@Provider | ||
public SsiMiwConfiguration miwConfiguration(ServiceExtensionContext context) { | ||
var baseUrl = context.getConfig().getString(MIW_BASE_URL); | ||
var authorityId = context.getConfig().getString(MIW_AUTHORITY_ID); | ||
var authorityIssuer = authorityIssuer(context, baseUrl, authorityId); | ||
|
||
return SsiMiwConfiguration.Builder.newInstance() | ||
.url(baseUrl) | ||
.authorityId(authorityId) | ||
.authorityIssuer(authorityIssuer) | ||
.build(); | ||
} | ||
|
||
|
||
private String authorityIssuer(ServiceExtensionContext context, String baseUrl, String authorityId) { | ||
var uri = URI.create(baseUrl); | ||
var defaultAuthorityIssuer = format(AUTHORITY_ID_TEMPLATE, URLEncoder.encode(uri.getAuthority(), StandardCharsets.UTF_8), authorityId); | ||
return context.getConfig().getString(MIW_AUTHORITY_ISSUER, defaultAuthorityIssuer); | ||
} | ||
} |
Oops, something went wrong.