-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1056 from eclipse-tractusx/release/0.5.4
Release version 0.5.4
- Loading branch information
Showing
41 changed files
with
605 additions
and
111 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -103,8 +103,8 @@ jobs: | |
test-azure-vault-postgres: | ||
runs-on: ubuntu-latest | ||
needs: [ test-prepare, secret-presence ] | ||
if: | | ||
needs.secret-presence.outputs.AZURE_KV_CREDS | ||
# disabled cause secret expired | ||
if: false | ||
steps: | ||
- name: Checkout | ||
uses: actions/[email protected] | ||
|
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 |
---|---|---|
|
@@ -79,18 +79,6 @@ jobs: | |
run: | | ||
./gradlew checkstyleMain checkstyleTest | ||
markdown-lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/[email protected] | ||
|
||
- name: Install mardkdownlint | ||
run: npm install -g markdownlint-cli2 | ||
|
||
- name: Run markdownlint | ||
run: | | ||
markdownlint-cli2-config .markdownlint.yaml "**/*.md" "#.github" "#charts" | ||
unit-tests: | ||
runs-on: ubuntu-latest | ||
needs: [ verify-formatting, verify-license-headers ] | ||
|
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
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
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
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Token Based Authentication Service | ||
|
||
The token based authentication service extension is used to secure connector APIs. These APIs are not protected by the `AuthenticationService` by default. To find out how a specific API is protected please consult its documentation. | ||
|
||
APIs, protected by this extension, require a client to authenticate by adding a authentication key to the request header. | ||
|
||
Authentication Header Example: | ||
``` | ||
curl <url> --header "X-API-Key: <key>" | ||
``` | ||
|
||
## Configuration | ||
|
||
| Key | Description | Required | | ||
|:-----------------------|:-------------------------------------------------------------|:---------| | ||
| edc.api.auth.key | API Key Header Value | false | | ||
| edc.api.auth.key.alias | Secret name of the API Key Header Value, stored in the vault | false | | ||
|
||
- If the API key is stored in the Vault _and_ in the configuration, the extension will take the key from the vault. | ||
|
||
- If no API key is defined, a random value is generated and printed out into the logs. |
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,26 @@ | ||
/* | ||
* Copyright (c) 2020 - 2022 Microsoft Corporation | ||
* | ||
* 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: | ||
* Microsoft Corporation - initial API and implementation | ||
* | ||
*/ | ||
|
||
plugins { | ||
`java-library` | ||
} | ||
|
||
dependencies { | ||
implementation(libs.edc.spi.auth) | ||
implementation(libs.jakarta.rsApi) | ||
|
||
testImplementation(testFixtures(libs.edc.junit)) | ||
} | ||
|
||
|
65 changes: 65 additions & 0 deletions
65
.../main/java/org/eclipse/tractusx/edc/api/auth/token/TokenBasedAuthenticationExtension.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,65 @@ | ||
/* | ||
* Copyright (c) 2020 - 2022 Microsoft Corporation | ||
* | ||
* 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: | ||
* Microsoft Corporation - initial API and implementation | ||
* Mercedes-Benz Tech Innovation GmbH - add README.md; authentication key can be retrieved from vault | ||
* Fraunhofer Institute for Software and Systems Engineering - update monitor info | ||
* | ||
*/ | ||
|
||
package org.eclipse.tractusx.edc.api.auth.token; | ||
|
||
import org.eclipse.edc.api.auth.spi.AuthenticationService; | ||
import org.eclipse.edc.runtime.metamodel.annotation.Extension; | ||
import org.eclipse.edc.runtime.metamodel.annotation.Inject; | ||
import org.eclipse.edc.runtime.metamodel.annotation.Provides; | ||
import org.eclipse.edc.runtime.metamodel.annotation.Setting; | ||
import org.eclipse.edc.spi.security.Vault; | ||
import org.eclipse.edc.spi.system.ServiceExtension; | ||
import org.eclipse.edc.spi.system.ServiceExtensionContext; | ||
|
||
import java.util.UUID; | ||
|
||
/** | ||
* Extension that registers an AuthenticationService that uses API Keys | ||
*/ | ||
@Provides(AuthenticationService.class) | ||
@Extension(value = TokenBasedAuthenticationExtension.NAME) | ||
public class TokenBasedAuthenticationExtension implements ServiceExtension { | ||
|
||
public static final String NAME = "Static token API Authentication"; | ||
@Setting | ||
private static final String AUTH_SETTING_APIKEY = "edc.api.auth.key"; | ||
@Setting | ||
private static final String AUTH_SETTING_APIKEY_ALIAS = "edc.api.auth.key.alias"; | ||
@Inject | ||
private Vault vault; | ||
|
||
@Override | ||
public String name() { | ||
return NAME; | ||
} | ||
|
||
@Override | ||
public void initialize(ServiceExtensionContext context) { | ||
String apiKey = null; | ||
|
||
var apiKeyAlias = context.getSetting(AUTH_SETTING_APIKEY_ALIAS, null); | ||
if (apiKeyAlias != null) { | ||
apiKey = vault.resolveSecret(apiKeyAlias); | ||
} | ||
|
||
if (apiKey == null) { | ||
apiKey = context.getSetting(AUTH_SETTING_APIKEY, UUID.randomUUID().toString()); | ||
} | ||
|
||
context.registerService(AuthenticationService.class, new TokenBasedAuthenticationService(apiKey)); | ||
} | ||
} |
Oops, something went wrong.