Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: introduce jwt-spi and jwt-core modules #1867

Merged
merged 1 commit into from
Aug 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ styleguide.md @paullatzelsperger
/buildSrc/ @paullatzelsperger @marcgs

/common/state-machine-lib/ @ndr-brt @algattik
/common/token-generation-lib/ @bscholtes1A
/common/token-validation-lib/ @bscholtes1A

/core/base/agent/ @jimmarino
/core/base/policy/ @jimmarino
Expand Down
1 change: 0 additions & 1 deletion common/util/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ publishing {
create<MavenPublication>("common-util") {
artifactId = "common-util"
from(components["java"])
artifacts.forEach { a -> println(a.file) }
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022 Amadeus
ndr-brt marked this conversation as resolved.
Show resolved Hide resolved
* Copyright (c) 2022 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
Expand All @@ -8,30 +8,27 @@
* SPDX-License-Identifier: Apache-2.0
*
* Contributors:
* Amadeus - initial API and implementation
* Bayerische Motoren Werke Aktiengesellschaft (BMW AG) - initial API and implementation
*
*/

plugins {
`java-library`
`java-test-fixtures`
`maven-publish`
}

val mockitoVersion: String by project
val nimbusVersion: String by project

dependencies {
api(project(":spi:common:core-spi"))
api(project(":spi:common:jwt-spi"))

implementation("com.nimbusds:nimbus-jose-jwt:${nimbusVersion}")
testImplementation("org.mockito:mockito-core:${mockitoVersion}")
}

publishing {
publications {
create<MavenPublication>("token-validation-lib") {
artifactId = "token-validation-lib"
create<MavenPublication>("jwt-spi") {
artifactId = "jwt-spi"
from(components["java"])
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@
*
*/

package org.eclipse.dataspaceconnector.common.token;
package org.eclipse.dataspaceconnector.core.jwt;

import org.eclipse.dataspaceconnector.spi.jwt.JwtDecorator;
import org.eclipse.dataspaceconnector.spi.jwt.JwtDecoratorRegistry;

import java.util.ArrayList;
import java.util.Collection;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
*
*/

package org.eclipse.dataspaceconnector.common.token;
package org.eclipse.dataspaceconnector.core.jwt;

import com.nimbusds.jose.JOSEException;
import com.nimbusds.jose.JWSAlgorithm;
Expand All @@ -25,6 +25,8 @@
import com.nimbusds.jwt.SignedJWT;
import org.eclipse.dataspaceconnector.spi.EdcException;
import org.eclipse.dataspaceconnector.spi.iam.TokenRepresentation;
import org.eclipse.dataspaceconnector.spi.jwt.JwtDecorator;
import org.eclipse.dataspaceconnector.spi.jwt.TokenGenerationService;
import org.eclipse.dataspaceconnector.spi.result.Result;
import org.jetbrains.annotations.NotNull;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@
*
*/

package org.eclipse.dataspaceconnector.common.token;
package org.eclipse.dataspaceconnector.core.jwt;

import org.eclipse.dataspaceconnector.spi.jwt.TokenValidationRule;
import org.eclipse.dataspaceconnector.spi.jwt.TokenValidationRulesRegistry;

import java.util.ArrayList;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*
*/

package org.eclipse.dataspaceconnector.common.token;
package org.eclipse.dataspaceconnector.core.jwt;

import com.nimbusds.jose.JOSEException;
import com.nimbusds.jose.JWSHeader;
Expand All @@ -23,6 +23,8 @@
import org.eclipse.dataspaceconnector.spi.iam.ClaimToken;
import org.eclipse.dataspaceconnector.spi.iam.PublicKeyResolver;
import org.eclipse.dataspaceconnector.spi.iam.TokenRepresentation;
import org.eclipse.dataspaceconnector.spi.jwt.TokenValidationRulesRegistry;
import org.eclipse.dataspaceconnector.spi.jwt.TokenValidationService;
import org.eclipse.dataspaceconnector.spi.result.Result;

import java.text.ParseException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*
*/

package org.eclipse.dataspaceconnector.common.token;
package org.eclipse.dataspaceconnector.core.jwt;

import com.nimbusds.jose.JOSEException;
import com.nimbusds.jose.JWSHeader;
Expand All @@ -23,6 +23,8 @@
import com.nimbusds.jose.jwk.gen.RSAKeyGenerator;
import com.nimbusds.jwt.SignedJWT;
import org.assertj.core.api.Condition;
import org.eclipse.dataspaceconnector.spi.jwt.JwtDecorator;
import org.eclipse.dataspaceconnector.spi.jwt.TokenGenerationService;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*
*/

package org.eclipse.dataspaceconnector.common.token;
package org.eclipse.dataspaceconnector.core.jwt;

import com.nimbusds.jose.JOSEException;
import com.nimbusds.jose.JWSAlgorithm;
Expand All @@ -24,6 +24,8 @@
import com.nimbusds.jwt.JWTClaimsSet;
import com.nimbusds.jwt.SignedJWT;
import org.eclipse.dataspaceconnector.spi.iam.PublicKeyResolver;
import org.eclipse.dataspaceconnector.spi.jwt.TokenValidationRule;
import org.eclipse.dataspaceconnector.spi.jwt.TokenValidationService;
import org.eclipse.dataspaceconnector.spi.result.Result;
import org.jetbrains.annotations.Nullable;
import org.junit.jupiter.api.BeforeEach;
Expand Down
1 change: 1 addition & 0 deletions data-protocols/ids/ids-token-validation/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ dependencies {
api(project(":common:util"))
api(project(":data-protocols:ids:ids-spi"))
api(project(":spi:common:oauth2-spi"))
api(project(":spi:common:jwt-spi"))

api("de.fraunhofer.iais.eis.ids.infomodel:java:${infoModelVersion}")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
package org.eclipse.dataspaceconnector.ids.token.validation.rule;

import com.nimbusds.jwt.SignedJWT;
import org.eclipse.dataspaceconnector.common.token.TokenValidationRule;
import org.eclipse.dataspaceconnector.spi.EdcException;
import org.eclipse.dataspaceconnector.spi.jwt.TokenValidationRule;
import org.eclipse.dataspaceconnector.spi.result.Result;
import org.jetbrains.annotations.Nullable;

Expand Down
4 changes: 2 additions & 2 deletions docs/developer/modules.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@

org.eclipse.dataspaceconnector:state-machine-lib:0.0.1-SNAPSHOT
org.eclipse.dataspaceconnector:token-generation-lib:0.0.1-SNAPSHOT
org.eclipse.dataspaceconnector:token-validation-lib:0.0.1-SNAPSHOT
org.eclipse.dataspaceconnector:common-util:0.0.1-SNAPSHOT
org.eclipse.dataspaceconnector:ids:0.0.1-SNAPSHOT
org.eclipse.dataspaceconnector:data-plane-server:0.0.1-SNAPSHOT
org.eclipse.dataspaceconnector:module-domain:0.0.1-SNAPSHOT
org.eclipse.dataspaceconnector:module-processor:0.0.1-SNAPSHOT
org.eclipse.dataspaceconnector:core-base:0.0.1-SNAPSHOT
org.eclipse.dataspaceconnector:core-boot:0.0.1-SNAPSHOT
org.eclipse.dataspaceconnector:jwt-spi:0.0.1-SNAPSHOT
org.eclipse.dataspaceconnector:policy-engine:0.0.1-SNAPSHOT
org.eclipse.dataspaceconnector:policy-evaluator:0.0.1-SNAPSHOT
org.eclipse.dataspaceconnector:contract:0.0.1-SNAPSHOT
Expand Down Expand Up @@ -42,6 +41,7 @@ org.eclipse.dataspaceconnector:auth-spi:0.0.1-SNAPSHOT
org.eclipse.dataspaceconnector:catalog-spi:0.0.1-SNAPSHOT
org.eclipse.dataspaceconnector:core-spi:0.0.1-SNAPSHOT
org.eclipse.dataspaceconnector:identity-did-spi:0.0.1-SNAPSHOT
org.eclipse.dataspaceconnector:jwt-spi:0.0.1-SNAPSHOT
org.eclipse.dataspaceconnector:oauth2-spi:0.0.1-SNAPSHOT
org.eclipse.dataspaceconnector:transaction-datasource-spi:0.0.1-SNAPSHOT
org.eclipse.dataspaceconnector:transaction-spi:0.0.1-SNAPSHOT
Expand Down
1 change: 1 addition & 0 deletions extensions/common/iam/oauth2/daps/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ val nimbusVersion: String by project
val okHttpVersion: String by project

dependencies {
api(project(":spi:common:core-spi"))
api(project(":spi:common:oauth2-spi"))

implementation("com.nimbusds:nimbus-jose-jwt:${nimbusVersion}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

import com.nimbusds.jose.JWSHeader;
import com.nimbusds.jwt.JWTClaimsSet;
import org.eclipse.dataspaceconnector.common.token.JwtDecorator;
import org.eclipse.dataspaceconnector.spi.jwt.JwtDecorator;

public class DapsJwtDecorator implements JwtDecorator {
@Override
Expand Down
3 changes: 1 addition & 2 deletions extensions/common/iam/oauth2/oauth2-core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ val okHttpVersion: String by project

dependencies {
api(project(":spi:common:oauth2-spi"))
implementation(project(":common:token-generation-lib"))
implementation(project(":common:token-validation-lib"))
implementation(project(":core:common:jwt-core"))

implementation("com.nimbusds:nimbus-jose-jwt:${nimbusVersion}")
implementation("com.squareup.okhttp3:okhttp:${okHttpVersion}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
package org.eclipse.dataspaceconnector.iam.oauth2.core;

import okhttp3.OkHttpClient;
import org.eclipse.dataspaceconnector.common.token.TokenGenerationServiceImpl;
import org.eclipse.dataspaceconnector.common.token.TokenValidationServiceImpl;
import org.eclipse.dataspaceconnector.core.jwt.TokenGenerationServiceImpl;
import org.eclipse.dataspaceconnector.core.jwt.TokenValidationServiceImpl;
import org.eclipse.dataspaceconnector.iam.oauth2.core.identity.CredentialsRequestAdditionalParametersProvider;
import org.eclipse.dataspaceconnector.iam.oauth2.core.identity.IdentityProviderKeyResolver;
import org.eclipse.dataspaceconnector.iam.oauth2.core.identity.IdentityProviderKeyResolverConfiguration;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@
import okhttp3.FormBody;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import org.eclipse.dataspaceconnector.common.token.JwtDecorator;
import org.eclipse.dataspaceconnector.common.token.JwtDecoratorRegistry;
import org.eclipse.dataspaceconnector.common.token.TokenGenerationService;
import org.eclipse.dataspaceconnector.common.token.TokenValidationService;
import org.eclipse.dataspaceconnector.iam.oauth2.core.Oauth2Configuration;
import org.eclipse.dataspaceconnector.spi.EdcException;
import org.eclipse.dataspaceconnector.spi.iam.ClaimToken;
import org.eclipse.dataspaceconnector.spi.iam.IdentityService;
import org.eclipse.dataspaceconnector.spi.iam.TokenParameters;
import org.eclipse.dataspaceconnector.spi.iam.TokenRepresentation;
import org.eclipse.dataspaceconnector.spi.jwt.JwtDecorator;
import org.eclipse.dataspaceconnector.spi.jwt.JwtDecoratorRegistry;
import org.eclipse.dataspaceconnector.spi.jwt.TokenGenerationService;
import org.eclipse.dataspaceconnector.spi.jwt.TokenValidationService;
import org.eclipse.dataspaceconnector.spi.result.Result;
import org.eclipse.dataspaceconnector.spi.types.TypeManager;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import com.nimbusds.jose.JWSHeader;
import com.nimbusds.jose.util.Base64URL;
import com.nimbusds.jwt.JWTClaimsSet;
import org.eclipse.dataspaceconnector.common.token.JwtDecorator;
import org.eclipse.dataspaceconnector.spi.jwt.JwtDecorator;

import java.time.Clock;
import java.util.Date;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

package org.eclipse.dataspaceconnector.iam.oauth2.core.jwt;

import org.eclipse.dataspaceconnector.common.token.JwtDecoratorRegistryImpl;
import org.eclipse.dataspaceconnector.core.jwt.JwtDecoratorRegistryImpl;
import org.eclipse.dataspaceconnector.iam.oauth2.spi.Oauth2JwtDecoratorRegistry;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@

import com.nimbusds.jwt.JWTClaimsSet;
import com.nimbusds.jwt.SignedJWT;
import org.eclipse.dataspaceconnector.common.token.TokenValidationRule;
import org.eclipse.dataspaceconnector.iam.oauth2.core.Oauth2Configuration;
import org.eclipse.dataspaceconnector.spi.EdcException;
import org.eclipse.dataspaceconnector.spi.jwt.TokenValidationRule;
import org.eclipse.dataspaceconnector.spi.result.Result;
import org.jetbrains.annotations.Nullable;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

package org.eclipse.dataspaceconnector.iam.oauth2.core.rule;

import org.eclipse.dataspaceconnector.common.token.TokenValidationRulesRegistryImpl;
import org.eclipse.dataspaceconnector.core.jwt.TokenValidationRulesRegistryImpl;
import org.eclipse.dataspaceconnector.iam.oauth2.core.Oauth2Configuration;
import org.eclipse.dataspaceconnector.iam.oauth2.spi.Oauth2ValidationRulesRegistry;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@
import com.nimbusds.jwt.JWTClaimsSet;
import com.nimbusds.jwt.SignedJWT;
import okhttp3.OkHttpClient;
import org.eclipse.dataspaceconnector.common.token.JwtDecoratorRegistryImpl;
import org.eclipse.dataspaceconnector.common.token.TokenGenerationService;
import org.eclipse.dataspaceconnector.common.token.TokenValidationServiceImpl;
import org.eclipse.dataspaceconnector.core.jwt.JwtDecoratorRegistryImpl;
import org.eclipse.dataspaceconnector.core.jwt.TokenValidationServiceImpl;
import org.eclipse.dataspaceconnector.iam.oauth2.core.Oauth2Configuration;
import org.eclipse.dataspaceconnector.iam.oauth2.core.rule.Oauth2ValidationRulesRegistryImpl;
import org.eclipse.dataspaceconnector.spi.iam.PublicKeyResolver;
import org.eclipse.dataspaceconnector.spi.iam.TokenParameters;
import org.eclipse.dataspaceconnector.spi.iam.TokenRepresentation;
import org.eclipse.dataspaceconnector.spi.jwt.TokenGenerationService;
import org.eclipse.dataspaceconnector.spi.result.Result;
import org.eclipse.dataspaceconnector.spi.security.CertificateResolver;
import org.eclipse.dataspaceconnector.spi.security.PrivateKeyResolver;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ dependencies {
api(project(":spi:data-plane:data-plane-spi"))
api(project(":spi:data-plane-selector:data-plane-selector-spi"))

implementation(project(":common:token-validation-lib"))
implementation(project(":common:token-generation-lib"))
implementation(project(":core:common:jwt-core"))

api("jakarta.ws.rs:jakarta.ws.rs-api:${rsApi}")
api("com.nimbusds:nimbus-jose-jwt:${nimbusVersion}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@

package org.eclipse.dataspaceconnector.transfer.dataplane.sync;

import org.eclipse.dataspaceconnector.common.token.TokenGenerationServiceImpl;
import org.eclipse.dataspaceconnector.common.token.TokenValidationRulesRegistryImpl;
import org.eclipse.dataspaceconnector.common.token.TokenValidationServiceImpl;
import org.eclipse.dataspaceconnector.core.jwt.TokenGenerationServiceImpl;
import org.eclipse.dataspaceconnector.core.jwt.TokenValidationRulesRegistryImpl;
import org.eclipse.dataspaceconnector.core.jwt.TokenValidationServiceImpl;
import org.eclipse.dataspaceconnector.dataplane.selector.client.DataPlaneSelectorClient;
import org.eclipse.dataspaceconnector.spi.EdcSetting;
import org.eclipse.dataspaceconnector.spi.WebService;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
import jakarta.ws.rs.Produces;
import jakarta.ws.rs.core.HttpHeaders;
import jakarta.ws.rs.core.MediaType;
import org.eclipse.dataspaceconnector.common.token.TokenValidationService;
import org.eclipse.dataspaceconnector.spi.exception.NotAuthorizedException;
import org.eclipse.dataspaceconnector.spi.jwt.TokenValidationService;
import org.eclipse.dataspaceconnector.spi.types.TypeManager;
import org.eclipse.dataspaceconnector.spi.types.domain.DataAddress;
import org.eclipse.dataspaceconnector.transfer.dataplane.spi.security.DataEncrypter;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

import com.nimbusds.jose.JWSHeader;
import com.nimbusds.jwt.JWTClaimsSet;
import org.eclipse.dataspaceconnector.common.token.JwtDecorator;
import org.eclipse.dataspaceconnector.spi.jwt.JwtDecorator;

import java.util.Date;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
package org.eclipse.dataspaceconnector.transfer.dataplane.sync.proxy;

import jakarta.ws.rs.core.HttpHeaders;
import org.eclipse.dataspaceconnector.common.token.TokenGenerationService;
import org.eclipse.dataspaceconnector.spi.jwt.TokenGenerationService;
import org.eclipse.dataspaceconnector.spi.result.Result;
import org.eclipse.dataspaceconnector.spi.types.TypeManager;
import org.eclipse.dataspaceconnector.spi.types.domain.edr.EndpointDataReference;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
package org.eclipse.dataspaceconnector.transfer.dataplane.sync.validation;

import com.nimbusds.jwt.SignedJWT;
import org.eclipse.dataspaceconnector.common.token.TokenValidationRule;
import org.eclipse.dataspaceconnector.spi.contract.negotiation.store.ContractNegotiationStore;
import org.eclipse.dataspaceconnector.spi.jwt.TokenValidationRule;
import org.eclipse.dataspaceconnector.spi.result.Result;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
package org.eclipse.dataspaceconnector.transfer.dataplane.sync.validation;

import com.nimbusds.jwt.SignedJWT;
import org.eclipse.dataspaceconnector.common.token.TokenValidationRule;
import org.eclipse.dataspaceconnector.spi.jwt.TokenValidationRule;
import org.eclipse.dataspaceconnector.spi.result.Result;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@

package org.eclipse.dataspaceconnector.transfer.dataplane.sync.api;

import org.eclipse.dataspaceconnector.common.token.TokenValidationService;
import org.eclipse.dataspaceconnector.spi.exception.NotAuthorizedException;
import org.eclipse.dataspaceconnector.spi.iam.ClaimToken;
import org.eclipse.dataspaceconnector.spi.jwt.TokenValidationService;
import org.eclipse.dataspaceconnector.spi.result.Result;
import org.eclipse.dataspaceconnector.spi.types.TypeManager;
import org.eclipse.dataspaceconnector.spi.types.domain.DataAddress;
Expand Down
Loading