-
Notifications
You must be signed in to change notification settings - Fork 212
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: Standalone STS * feat: STS client configuration extension + launcher * pr remarks * chore: update dependencies file * pr remarks
- Loading branch information
Showing
42 changed files
with
1,568 additions
and
99 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
38 changes: 0 additions & 38 deletions
38
...in/java/org/eclipse/edc/connector/api/sts/controller/SecureTokenServiceApiController.java
This file was deleted.
Oops, something went wrong.
33 changes: 0 additions & 33 deletions
33
...-trust-sts-api/src/main/java/org/eclipse/edc/connector/api/sts/model/StsTokenRequest.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
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
24 changes: 24 additions & 0 deletions
24
extensions/common/iam/identity-trust/identity-trust-sts/build.gradle.kts
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,24 @@ | ||
/* | ||
* 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 | ||
* | ||
*/ | ||
|
||
plugins { | ||
`java-library` | ||
`maven-publish` | ||
} | ||
|
||
dependencies { | ||
api(project(":extensions:common:iam:identity-trust:identity-trust-sts:identity-trust-sts-api")) | ||
api(project(":extensions:common:iam:identity-trust:identity-trust-sts:identity-trust-sts-client-configuration")) | ||
} | ||
|
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
60 changes: 60 additions & 0 deletions
60
...s-api/src/main/java/org/eclipse/edc/connector/api/sts/SecureTokenServiceApiExtension.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,60 @@ | ||
/* | ||
* 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.edc.connector.api.sts; | ||
|
||
import org.eclipse.edc.connector.api.sts.configuration.StsApiConfiguration; | ||
import org.eclipse.edc.connector.api.sts.controller.SecureTokenServiceApiController; | ||
import org.eclipse.edc.connector.api.sts.exception.StsTokenExceptionMapper; | ||
import org.eclipse.edc.connector.api.sts.validation.StsTokenRequestValidator; | ||
import org.eclipse.edc.iam.identitytrust.sts.service.StsClientService; | ||
import org.eclipse.edc.iam.identitytrust.sts.service.StsClientTokenGeneratorService; | ||
import org.eclipse.edc.runtime.metamodel.annotation.Extension; | ||
import org.eclipse.edc.runtime.metamodel.annotation.Inject; | ||
import org.eclipse.edc.spi.monitor.Monitor; | ||
import org.eclipse.edc.spi.system.ServiceExtension; | ||
import org.eclipse.edc.spi.system.ServiceExtensionContext; | ||
import org.eclipse.edc.web.spi.WebService; | ||
|
||
@Extension(SecureTokenServiceApiExtension.NAME) | ||
public class SecureTokenServiceApiExtension implements ServiceExtension { | ||
|
||
public static final String NAME = "Secure Token Service API"; | ||
|
||
@Inject | ||
private StsApiConfiguration stsApiConfiguration; | ||
|
||
@Inject | ||
private StsClientService clientService; | ||
|
||
@Inject | ||
private StsClientTokenGeneratorService tokenService; | ||
|
||
@Inject | ||
private Monitor monitor; | ||
|
||
@Inject | ||
private WebService webService; | ||
|
||
@Override | ||
public String name() { | ||
return NAME; | ||
} | ||
|
||
@Override | ||
public void initialize(ServiceExtensionContext context) { | ||
webService.registerResource(stsApiConfiguration.getContextAlias(), new SecureTokenServiceApiController(clientService, tokenService, new StsTokenRequestValidator())); | ||
webService.registerResource(stsApiConfiguration.getContextAlias(), new StsTokenExceptionMapper()); | ||
} | ||
} |
61 changes: 61 additions & 0 deletions
61
...sts-api/src/main/java/org/eclipse/edc/connector/api/sts/StsApiConfigurationExtension.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,61 @@ | ||
/* | ||
* 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.edc.connector.api.sts; | ||
|
||
import org.eclipse.edc.connector.api.sts.configuration.StsApiConfiguration; | ||
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.spi.system.ServiceExtension; | ||
import org.eclipse.edc.spi.system.ServiceExtensionContext; | ||
import org.eclipse.edc.web.spi.WebServer; | ||
import org.eclipse.edc.web.spi.configuration.WebServiceConfigurer; | ||
import org.eclipse.edc.web.spi.configuration.WebServiceSettings; | ||
|
||
@Extension(value = StsApiConfigurationExtension.NAME) | ||
@Provides({ StsApiConfiguration.class }) | ||
public class StsApiConfigurationExtension implements ServiceExtension { | ||
|
||
public static final String NAME = "Secure Token Service API configuration"; | ||
public static final String STS_CONTEXT_ALIAS = "sts"; | ||
private static final String WEB_SERVICE_NAME = "STS API"; | ||
private static final int DEFAULT_STS_API_PORT = 9292; | ||
private static final String DEFAULT_STS_API_CONTEXT_PATH = "/api/v1/sts"; | ||
|
||
public static final WebServiceSettings SETTINGS = WebServiceSettings.Builder.newInstance() | ||
.apiConfigKey("web.http." + STS_CONTEXT_ALIAS) | ||
.contextAlias(STS_CONTEXT_ALIAS) | ||
.defaultPath(DEFAULT_STS_API_CONTEXT_PATH) | ||
.defaultPort(DEFAULT_STS_API_PORT) | ||
.useDefaultContext(true) | ||
.name(WEB_SERVICE_NAME) | ||
.build(); | ||
|
||
@Inject | ||
private WebServer webServer; | ||
@Inject | ||
private WebServiceConfigurer configurator; | ||
|
||
@Override | ||
public String name() { | ||
return NAME; | ||
} | ||
|
||
@Override | ||
public void initialize(ServiceExtensionContext context) { | ||
var config = configurator.configure(context, webServer, SETTINGS); | ||
context.registerService(StsApiConfiguration.class, new StsApiConfiguration(config)); | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
...pi/src/main/java/org/eclipse/edc/connector/api/sts/configuration/StsApiConfiguration.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,29 @@ | ||
/* | ||
* 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.edc.connector.api.sts.configuration; | ||
|
||
import org.eclipse.edc.web.spi.configuration.WebServiceConfiguration; | ||
|
||
/** | ||
* Configuration for the STS API | ||
*/ | ||
public class StsApiConfiguration extends WebServiceConfiguration { | ||
|
||
public StsApiConfiguration(WebServiceConfiguration webServiceConfiguration) { | ||
this.contextAlias = webServiceConfiguration.getContextAlias(); | ||
this.path = webServiceConfiguration.getPath(); | ||
this.port = webServiceConfiguration.getPort(); | ||
} | ||
} |
Oops, something went wrong.