diff --git a/README.md b/README.md index 4b29eb8..d49483f 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Cloudeko Zenei -Zenei is a open-source user management system that allows you to use authentication, user management and organizations +Zenei (as Vanguard from japanese) is a open-source user management system that allows you to use authentication, user management and organizations management in your applications. It's built with [Quarkus](https://quarkus.io) and provides authentication via OAuth2. diff --git a/core/src/main/java/dev/cloudeko/zenei/infrastructure/repository/hibernate/panache/SessionRepositoryPanache.java b/core/src/main/java/dev/cloudeko/zenei/infrastructure/repository/hibernate/panache/SessionRepositoryPanache.java deleted file mode 100644 index 3af3a45..0000000 --- a/core/src/main/java/dev/cloudeko/zenei/infrastructure/repository/hibernate/panache/SessionRepositoryPanache.java +++ /dev/null @@ -1,4 +0,0 @@ -package dev.cloudeko.zenei.infrastructure.repository.hibernate.panache; - -public class SessionRepositoryPanache { -} diff --git a/extensions/core/runtime/src/main/java/dev/cloudeko/zenei/extension/core/repository/EmailAddressRepository.java b/extensions/core/runtime/src/main/java/dev/cloudeko/zenei/extension/core/repository/EmailAddressRepository.java index 9ea8461..c669024 100644 --- a/extensions/core/runtime/src/main/java/dev/cloudeko/zenei/extension/core/repository/EmailAddressRepository.java +++ b/extensions/core/runtime/src/main/java/dev/cloudeko/zenei/extension/core/repository/EmailAddressRepository.java @@ -12,5 +12,5 @@ public interface EmailAddressRepository { Optional findByEmailAddress(String emailAddress); - void confirmEmailAddress(String token); + boolean confirmEmailAddress(String token); } diff --git a/extensions/core/runtime/src/main/resources/META-INF/quarkus-extension.yaml b/extensions/core/runtime/src/main/resources/META-INF/quarkus-extension.yaml index 11482cb..cb085cc 100644 --- a/extensions/core/runtime/src/main/resources/META-INF/quarkus-extension.yaml +++ b/extensions/core/runtime/src/main/resources/META-INF/quarkus-extension.yaml @@ -1,4 +1,4 @@ -name: External Authentication Extension +name: Zenei Quarkus Core Extension #description: Do something useful. metadata: # keywords: diff --git a/extensions/external-authentication/deployment/pom.xml b/extensions/external-authentication/deployment/pom.xml index db570f6..76f48b3 100644 --- a/extensions/external-authentication/deployment/pom.xml +++ b/extensions/external-authentication/deployment/pom.xml @@ -5,12 +5,12 @@ 4.0.0 dev.cloudeko - external-authentication-parent + external-authentication-extension-parent 0.0.1 Zenei - Extensions - External Authentication - Deployment - external-authentication-deployment + external-authentication-extension-deployment @@ -27,7 +27,7 @@ dev.cloudeko - external-authentication + external-authentication-extension io.quarkus diff --git a/extensions/external-authentication/pom.xml b/extensions/external-authentication/pom.xml index f4f4e2b..f52bc3e 100644 --- a/extensions/external-authentication/pom.xml +++ b/extensions/external-authentication/pom.xml @@ -10,7 +10,7 @@ Zenei - Extensions - External Authentication - Parent - external-authentication-parent + external-authentication-extension-parent pom diff --git a/extensions/external-authentication/runtime/pom.xml b/extensions/external-authentication/runtime/pom.xml index 1058dc1..ed8ee95 100644 --- a/extensions/external-authentication/runtime/pom.xml +++ b/extensions/external-authentication/runtime/pom.xml @@ -4,12 +4,12 @@ 4.0.0 dev.cloudeko - external-authentication-parent + external-authentication-extension-parent 0.0.1 Zenei - Extensions - External Authentication - Runtime - external-authentication + external-authentication-extension diff --git a/extensions/external-authentication/runtime/src/main/java/dev/cloudeko/zenei/extension/external/providers/ConfigurationExternalAuthResolver.java b/extensions/external-authentication/runtime/src/main/java/dev/cloudeko/zenei/extension/external/providers/ConfigurationExternalAuthResolver.java index e9ba976..d074ab4 100644 --- a/extensions/external-authentication/runtime/src/main/java/dev/cloudeko/zenei/extension/external/providers/ConfigurationExternalAuthResolver.java +++ b/extensions/external-authentication/runtime/src/main/java/dev/cloudeko/zenei/extension/external/providers/ConfigurationExternalAuthResolver.java @@ -2,6 +2,7 @@ import dev.cloudeko.zenei.extension.external.ExternalAuthProvider; import dev.cloudeko.zenei.extension.external.ExternalAuthResolver; +import dev.cloudeko.zenei.extension.external.config.ExternalAuthProviderConfig; import dev.cloudeko.zenei.extension.external.config.ExternalAuthProvidersConfig; import lombok.AllArgsConstructor; @@ -14,7 +15,7 @@ public class ConfigurationExternalAuthResolver implements ExternalAuthResolver { @Override public Optional getAuthProvider(String providerName) { - final var providerConfig = config.providers().get(providerName.toLowerCase()); + ExternalAuthProviderConfig providerConfig = config.providers().get(providerName.toLowerCase()); if (providerConfig == null || !providerConfig.enabled()) { return Optional.empty(); diff --git a/extensions/external-authentication/runtime/src/main/java/dev/cloudeko/zenei/extension/external/providers/DiscordExternalAuthProvider.java b/extensions/external-authentication/runtime/src/main/java/dev/cloudeko/zenei/extension/external/providers/DiscordExternalAuthProvider.java index dfcbc60..cb877cf 100644 --- a/extensions/external-authentication/runtime/src/main/java/dev/cloudeko/zenei/extension/external/providers/DiscordExternalAuthProvider.java +++ b/extensions/external-authentication/runtime/src/main/java/dev/cloudeko/zenei/extension/external/providers/DiscordExternalAuthProvider.java @@ -5,7 +5,9 @@ import dev.cloudeko.zenei.extension.external.config.ExternalAuthProviderConfig; import dev.cloudeko.zenei.extension.external.endpoint.ProviderEndpoints; import dev.cloudeko.zenei.extension.external.web.client.ExternalProviderAccessToken; +import dev.cloudeko.zenei.extension.external.web.external.BaseExternalClient; import dev.cloudeko.zenei.extension.external.web.external.discord.DiscordClient; +import dev.cloudeko.zenei.extension.external.web.external.discord.DiscordUser; import io.quarkus.rest.client.reactive.QuarkusRestClientBuilder; import java.net.URI; @@ -15,19 +17,19 @@ public record DiscordExternalAuthProvider(ExternalAuthProviderConfig config) imp @Override public ExternalUserProfile getExternalUserProfile(ExternalProviderAccessToken accessToken) { - final var client = QuarkusRestClientBuilder.newBuilder() + BaseExternalClient client = QuarkusRestClientBuilder.newBuilder() .baseUri(URI.create(getBaseEndpoint())) .build(DiscordClient.class); - final var user = client.getCurrentlyLoggedInUser("Bearer " + accessToken.getAccessToken()); + DiscordUser user = client.getCurrentlyLoggedInUser("Bearer " + accessToken.getAccessToken()); // Avatar URL handling String avatarUrl; if (user.getAvatar() == null || user.getAvatar().isEmpty()) { - final var discriminator = Integer.parseInt(user.getDiscriminator()); + int discriminator = Integer.parseInt(user.getDiscriminator()); avatarUrl = String.format("https://cdn.discordapp.com/embed/avatars/%d.png", discriminator % 5); } else { - final var extension = user.getAvatar().startsWith("a_") ? "gif" : "png"; + String extension = user.getAvatar().startsWith("a_") ? "gif" : "png"; avatarUrl = String.format("https://cdn.discordapp.com/avatars/%s/%s.%s", user.getId(), user.getAvatar(), extension); } diff --git a/extensions/external-authentication/runtime/src/main/java/dev/cloudeko/zenei/extension/external/providers/GithubExternalAuthProvider.java b/extensions/external-authentication/runtime/src/main/java/dev/cloudeko/zenei/extension/external/providers/GithubExternalAuthProvider.java index 927396a..e7b8712 100644 --- a/extensions/external-authentication/runtime/src/main/java/dev/cloudeko/zenei/extension/external/providers/GithubExternalAuthProvider.java +++ b/extensions/external-authentication/runtime/src/main/java/dev/cloudeko/zenei/extension/external/providers/GithubExternalAuthProvider.java @@ -6,27 +6,30 @@ import dev.cloudeko.zenei.extension.external.endpoint.ProviderEndpoints; import dev.cloudeko.zenei.extension.external.web.client.ExternalProviderAccessToken; import dev.cloudeko.zenei.extension.external.web.external.github.GithubClient; +import dev.cloudeko.zenei.extension.external.web.external.github.GithubUser; +import dev.cloudeko.zenei.extension.external.web.external.github.GithubUserEmail; import io.quarkus.rest.client.reactive.QuarkusRestClientBuilder; import java.net.URI; +import java.util.List; public record GithubExternalAuthProvider(ExternalAuthProviderConfig config) implements ExternalAuthProvider { @Override public ExternalUserProfile getExternalUserProfile(ExternalProviderAccessToken accessToken) { - final var client = QuarkusRestClientBuilder.newBuilder() + GithubClient client = QuarkusRestClientBuilder.newBuilder() .baseUri(URI.create(getBaseEndpoint())) .build(GithubClient.class); - final var externalUserBuilder = ExternalUserProfile.builder(); - final var user = client.getCurrentlyLoggedInUser("Bearer " + accessToken.getAccessToken()); + ExternalUserProfile.ExternalUserProfileBuilder externalUserBuilder = ExternalUserProfile.builder(); + GithubUser user = client.getCurrentlyLoggedInUser("Bearer " + accessToken.getAccessToken()); externalUserBuilder.id(user.getId().toString()); externalUserBuilder.username(user.getLogin()); externalUserBuilder.avatarUrl(user.getAvatarUrl()); - final var emails = client.getUserEmails("Bearer " + accessToken.getAccessToken()); - final var externalUserEmails = emails.stream() + List emails = client.getUserEmails("Bearer " + accessToken.getAccessToken()); + List externalUserEmails = emails.stream() .map(email -> new ExternalUserProfile.ExternalUserEmail( email.getEmail(), email.isPrimary(), diff --git a/extensions/external-authentication/runtime/src/main/java/dev/cloudeko/zenei/extension/external/providers/GoogleExternalAuthProvider.java b/extensions/external-authentication/runtime/src/main/java/dev/cloudeko/zenei/extension/external/providers/GoogleExternalAuthProvider.java index 83730db..82bcace 100644 --- a/extensions/external-authentication/runtime/src/main/java/dev/cloudeko/zenei/extension/external/providers/GoogleExternalAuthProvider.java +++ b/extensions/external-authentication/runtime/src/main/java/dev/cloudeko/zenei/extension/external/providers/GoogleExternalAuthProvider.java @@ -5,7 +5,9 @@ import dev.cloudeko.zenei.extension.external.config.ExternalAuthProviderConfig; import dev.cloudeko.zenei.extension.external.endpoint.ProviderEndpoints; import dev.cloudeko.zenei.extension.external.web.client.ExternalProviderAccessToken; +import dev.cloudeko.zenei.extension.external.web.external.BaseExternalClient; import dev.cloudeko.zenei.extension.external.web.external.google.GoogleClient; +import dev.cloudeko.zenei.extension.external.web.external.google.GoogleUser; import io.quarkus.rest.client.reactive.QuarkusRestClientBuilder; import java.net.URI; @@ -15,11 +17,11 @@ public record GoogleExternalAuthProvider(ExternalAuthProviderConfig config) impl @Override public ExternalUserProfile getExternalUserProfile(ExternalProviderAccessToken accessToken) { - final var client = QuarkusRestClientBuilder.newBuilder() + BaseExternalClient client = QuarkusRestClientBuilder.newBuilder() .baseUri(URI.create(getBaseEndpoint())) .build(GoogleClient.class); - final var user = client.getCurrentlyLoggedInUser("Bearer " + accessToken.getAccessToken()); + GoogleUser user = client.getCurrentlyLoggedInUser("Bearer " + accessToken.getAccessToken()); return ExternalUserProfile.builder() .id(user.getId()) diff --git a/extensions/external-authentication/runtime/src/main/java/dev/cloudeko/zenei/extension/external/web/external/BaseExternalClient.java b/extensions/external-authentication/runtime/src/main/java/dev/cloudeko/zenei/extension/external/web/external/BaseExternalClient.java new file mode 100644 index 0000000..d6d23cc --- /dev/null +++ b/extensions/external-authentication/runtime/src/main/java/dev/cloudeko/zenei/extension/external/web/external/BaseExternalClient.java @@ -0,0 +1,5 @@ +package dev.cloudeko.zenei.extension.external.web.external; + +public interface BaseExternalClient { + T getCurrentlyLoggedInUser(String token); +} diff --git a/extensions/external-authentication/runtime/src/main/java/dev/cloudeko/zenei/extension/external/web/external/discord/DiscordClient.java b/extensions/external-authentication/runtime/src/main/java/dev/cloudeko/zenei/extension/external/web/external/discord/DiscordClient.java index 9a33b88..5c499a7 100644 --- a/extensions/external-authentication/runtime/src/main/java/dev/cloudeko/zenei/extension/external/web/external/discord/DiscordClient.java +++ b/extensions/external-authentication/runtime/src/main/java/dev/cloudeko/zenei/extension/external/web/external/discord/DiscordClient.java @@ -1,11 +1,12 @@ package dev.cloudeko.zenei.extension.external.web.external.discord; +import dev.cloudeko.zenei.extension.external.web.external.BaseExternalClient; import jakarta.ws.rs.GET; import jakarta.ws.rs.HeaderParam; import jakarta.ws.rs.Path; @Path("/") -public interface DiscordClient { +public interface DiscordClient extends BaseExternalClient { @GET @Path("/users/@me") diff --git a/extensions/external-authentication/runtime/src/main/java/dev/cloudeko/zenei/extension/external/web/external/github/GithubClient.java b/extensions/external-authentication/runtime/src/main/java/dev/cloudeko/zenei/extension/external/web/external/github/GithubClient.java index 0f49af8..5daa6eb 100644 --- a/extensions/external-authentication/runtime/src/main/java/dev/cloudeko/zenei/extension/external/web/external/github/GithubClient.java +++ b/extensions/external-authentication/runtime/src/main/java/dev/cloudeko/zenei/extension/external/web/external/github/GithubClient.java @@ -1,5 +1,6 @@ package dev.cloudeko.zenei.extension.external.web.external.github; +import dev.cloudeko.zenei.extension.external.web.external.BaseExternalClient; import jakarta.ws.rs.GET; import jakarta.ws.rs.HeaderParam; import jakarta.ws.rs.Path; @@ -7,7 +8,7 @@ import java.util.List; @Path("/") -public interface GithubClient { +public interface GithubClient extends BaseExternalClient { @GET @Path("/user") diff --git a/extensions/external-authentication/runtime/src/main/java/dev/cloudeko/zenei/extension/external/web/external/google/GoogleClient.java b/extensions/external-authentication/runtime/src/main/java/dev/cloudeko/zenei/extension/external/web/external/google/GoogleClient.java index 2fc9866..eefc2cb 100644 --- a/extensions/external-authentication/runtime/src/main/java/dev/cloudeko/zenei/extension/external/web/external/google/GoogleClient.java +++ b/extensions/external-authentication/runtime/src/main/java/dev/cloudeko/zenei/extension/external/web/external/google/GoogleClient.java @@ -1,11 +1,12 @@ package dev.cloudeko.zenei.extension.external.web.external.google; +import dev.cloudeko.zenei.extension.external.web.external.BaseExternalClient; import jakarta.ws.rs.GET; import jakarta.ws.rs.HeaderParam; import jakarta.ws.rs.Path; @Path("/") -public interface GoogleClient { +public interface GoogleClient extends BaseExternalClient { @GET @Path("/userinfo/v2/me") diff --git a/extensions/external-authentication/runtime/src/main/resources/META-INF/quarkus-extension.yaml b/extensions/external-authentication/runtime/src/main/resources/META-INF/quarkus-extension.yaml index 11482cb..0283609 100644 --- a/extensions/external-authentication/runtime/src/main/resources/META-INF/quarkus-extension.yaml +++ b/extensions/external-authentication/runtime/src/main/resources/META-INF/quarkus-extension.yaml @@ -1,4 +1,4 @@ -name: External Authentication Extension +name: Zenei Quarkus External Authentication Extension #description: Do something useful. metadata: # keywords: diff --git a/extensions/jdbc-panache/deployment/pom.xml b/extensions/jdbc-panache/deployment/pom.xml new file mode 100644 index 0000000..567fde3 --- /dev/null +++ b/extensions/jdbc-panache/deployment/pom.xml @@ -0,0 +1,62 @@ + + + 4.0.0 + + dev.cloudeko + jdbc-panache-extension-parent + 0.0.1 + + + Zenei - Extensions - Jdbc Panache - Deployment + jdbc-panache-extension-deployment + + + + + dev.cloudeko + core-extension-deployment + + + + io.quarkus + quarkus-arc-deployment + + + io.quarkus + quarkus-hibernate-orm-deployment + + + io.quarkus + quarkus-hibernate-orm-panache-deployment + + + dev.cloudeko + jdbc-panache-extension + + + io.quarkus + quarkus-junit5-internal + test + + + + + + maven-compiler-plugin + + ${maven.compiler.source} + ${maven.compiler.target} + + + io.quarkus + quarkus-extension-processor + ${quarkus.version} + + + + + + + diff --git a/extensions/jdbc-panache/deployment/src/main/java/dev/cloudeko/zenei/extension/jdbc/panache/deployment/JdbcPanacheBuildSteps.java b/extensions/jdbc-panache/deployment/src/main/java/dev/cloudeko/zenei/extension/jdbc/panache/deployment/JdbcPanacheBuildSteps.java new file mode 100644 index 0000000..3efbc08 --- /dev/null +++ b/extensions/jdbc-panache/deployment/src/main/java/dev/cloudeko/zenei/extension/jdbc/panache/deployment/JdbcPanacheBuildSteps.java @@ -0,0 +1,14 @@ +package dev.cloudeko.zenei.extension.jdbc.panache.deployment; + +import io.quarkus.deployment.annotations.BuildStep; +import io.quarkus.deployment.builditem.FeatureBuildItem; + +public class JdbcPanacheBuildSteps { + + private static final String FEATURE = "jdbc-panache"; + + @BuildStep + public FeatureBuildItem feature() { + return new FeatureBuildItem(FEATURE); + } +} diff --git a/extensions/jdbc-panache/pom.xml b/extensions/jdbc-panache/pom.xml new file mode 100644 index 0000000..ab2bfc8 --- /dev/null +++ b/extensions/jdbc-panache/pom.xml @@ -0,0 +1,20 @@ + + + 4.0.0 + + dev.cloudeko + extensions + 0.0.1 + + + Zenei - Extensions - Jdbc Panache - Parent + jdbc-panache-extension-parent + pom + + + deployment + runtime + + diff --git a/extensions/jdbc-panache/runtime/pom.xml b/extensions/jdbc-panache/runtime/pom.xml new file mode 100644 index 0000000..36d2929 --- /dev/null +++ b/extensions/jdbc-panache/runtime/pom.xml @@ -0,0 +1,103 @@ + + + 4.0.0 + + dev.cloudeko + jdbc-panache-extension-parent + 0.0.1 + + + Zenei - Extensions - Jdbc Panache - Runtime + jdbc-panache-extension + + + + + dev.cloudeko + core-extension + + + + + io.quarkus + quarkus-arc + + + io.quarkus + quarkus-hibernate-orm + + + io.quarkus + quarkus-hibernate-orm-panache + + + + + org.projectlombok + lombok + ${org.projectlombok.version} + provided + + + org.mapstruct + mapstruct + ${org.mapstruct.version} + + + + + + + io.quarkus + quarkus-extension-maven-plugin + ${quarkus.version} + + + compile + + extension-descriptor + + + ${project.groupId}:${project.artifactId}-deployment:${project.version} + + + + + + + maven-compiler-plugin + + ${maven.compiler.source} + ${maven.compiler.target} + + -parameters + + + + org.projectlombok + lombok + ${org.projectlombok.version} + + + org.mapstruct + mapstruct-processor + ${org.mapstruct.version} + + + org.projectlombok + lombok-mapstruct-binding + 0.2.0 + + + io.quarkus + quarkus-extension-processor + ${quarkus.version} + + + + + + + diff --git a/core/src/main/java/dev/cloudeko/zenei/infrastructure/repository/hibernate/entity/EmailAddressEntity.java b/extensions/jdbc-panache/runtime/src/main/java/dev/cloudeko/zenei/extension/jdbc/panache/entity/EmailAddressEntity.java similarity index 95% rename from core/src/main/java/dev/cloudeko/zenei/infrastructure/repository/hibernate/entity/EmailAddressEntity.java rename to extensions/jdbc-panache/runtime/src/main/java/dev/cloudeko/zenei/extension/jdbc/panache/entity/EmailAddressEntity.java index 3c63f93..fc7cc9e 100644 --- a/core/src/main/java/dev/cloudeko/zenei/infrastructure/repository/hibernate/entity/EmailAddressEntity.java +++ b/extensions/jdbc-panache/runtime/src/main/java/dev/cloudeko/zenei/extension/jdbc/panache/entity/EmailAddressEntity.java @@ -1,4 +1,4 @@ -package dev.cloudeko.zenei.infrastructure.repository.hibernate.entity; +package dev.cloudeko.zenei.extension.jdbc.panache.entity; import io.quarkus.hibernate.orm.panache.PanacheEntity; import jakarta.persistence.*; diff --git a/core/src/main/java/dev/cloudeko/zenei/infrastructure/repository/hibernate/entity/ExternalAccessTokenEntity.java b/extensions/jdbc-panache/runtime/src/main/java/dev/cloudeko/zenei/extension/jdbc/panache/entity/ExternalAccessTokenEntity.java similarity index 93% rename from core/src/main/java/dev/cloudeko/zenei/infrastructure/repository/hibernate/entity/ExternalAccessTokenEntity.java rename to extensions/jdbc-panache/runtime/src/main/java/dev/cloudeko/zenei/extension/jdbc/panache/entity/ExternalAccessTokenEntity.java index 0aaba37..d5d40ee 100644 --- a/core/src/main/java/dev/cloudeko/zenei/infrastructure/repository/hibernate/entity/ExternalAccessTokenEntity.java +++ b/extensions/jdbc-panache/runtime/src/main/java/dev/cloudeko/zenei/extension/jdbc/panache/entity/ExternalAccessTokenEntity.java @@ -1,4 +1,4 @@ -package dev.cloudeko.zenei.infrastructure.repository.hibernate.entity; +package dev.cloudeko.zenei.extension.jdbc.panache.entity; import io.quarkus.hibernate.orm.panache.PanacheEntity; import jakarta.persistence.*; diff --git a/core/src/main/java/dev/cloudeko/zenei/infrastructure/repository/hibernate/entity/ExternalAccountEntity.java b/extensions/jdbc-panache/runtime/src/main/java/dev/cloudeko/zenei/extension/jdbc/panache/entity/ExternalAccountEntity.java similarity index 95% rename from core/src/main/java/dev/cloudeko/zenei/infrastructure/repository/hibernate/entity/ExternalAccountEntity.java rename to extensions/jdbc-panache/runtime/src/main/java/dev/cloudeko/zenei/extension/jdbc/panache/entity/ExternalAccountEntity.java index b04669a..088f745 100644 --- a/core/src/main/java/dev/cloudeko/zenei/infrastructure/repository/hibernate/entity/ExternalAccountEntity.java +++ b/extensions/jdbc-panache/runtime/src/main/java/dev/cloudeko/zenei/extension/jdbc/panache/entity/ExternalAccountEntity.java @@ -1,4 +1,4 @@ -package dev.cloudeko.zenei.infrastructure.repository.hibernate.entity; +package dev.cloudeko.zenei.extension.jdbc.panache.entity; import io.quarkus.hibernate.orm.panache.PanacheEntity; import jakarta.persistence.*; diff --git a/core/src/main/java/dev/cloudeko/zenei/infrastructure/repository/hibernate/entity/RefreshTokenEntity.java b/extensions/jdbc-panache/runtime/src/main/java/dev/cloudeko/zenei/extension/jdbc/panache/entity/RefreshTokenEntity.java similarity index 94% rename from core/src/main/java/dev/cloudeko/zenei/infrastructure/repository/hibernate/entity/RefreshTokenEntity.java rename to extensions/jdbc-panache/runtime/src/main/java/dev/cloudeko/zenei/extension/jdbc/panache/entity/RefreshTokenEntity.java index 41ee4e8..1f3a9aa 100644 --- a/core/src/main/java/dev/cloudeko/zenei/infrastructure/repository/hibernate/entity/RefreshTokenEntity.java +++ b/extensions/jdbc-panache/runtime/src/main/java/dev/cloudeko/zenei/extension/jdbc/panache/entity/RefreshTokenEntity.java @@ -1,4 +1,4 @@ -package dev.cloudeko.zenei.infrastructure.repository.hibernate.entity; +package dev.cloudeko.zenei.extension.jdbc.panache.entity; import jakarta.persistence.*; import lombok.Data; diff --git a/core/src/main/java/dev/cloudeko/zenei/infrastructure/repository/hibernate/entity/SessionEntity.java b/extensions/jdbc-panache/runtime/src/main/java/dev/cloudeko/zenei/extension/jdbc/panache/entity/SessionEntity.java similarity index 86% rename from core/src/main/java/dev/cloudeko/zenei/infrastructure/repository/hibernate/entity/SessionEntity.java rename to extensions/jdbc-panache/runtime/src/main/java/dev/cloudeko/zenei/extension/jdbc/panache/entity/SessionEntity.java index a3106d4..2982887 100644 --- a/core/src/main/java/dev/cloudeko/zenei/infrastructure/repository/hibernate/entity/SessionEntity.java +++ b/extensions/jdbc-panache/runtime/src/main/java/dev/cloudeko/zenei/extension/jdbc/panache/entity/SessionEntity.java @@ -1,4 +1,4 @@ -package dev.cloudeko.zenei.infrastructure.repository.hibernate.entity; +package dev.cloudeko.zenei.extension.jdbc.panache.entity; import io.quarkus.hibernate.orm.panache.PanacheEntity; import jakarta.persistence.Entity; diff --git a/core/src/main/java/dev/cloudeko/zenei/infrastructure/repository/hibernate/entity/UserEntity.java b/extensions/jdbc-panache/runtime/src/main/java/dev/cloudeko/zenei/extension/jdbc/panache/entity/UserEntity.java similarity index 97% rename from core/src/main/java/dev/cloudeko/zenei/infrastructure/repository/hibernate/entity/UserEntity.java rename to extensions/jdbc-panache/runtime/src/main/java/dev/cloudeko/zenei/extension/jdbc/panache/entity/UserEntity.java index 63da18d..1ce3968 100644 --- a/core/src/main/java/dev/cloudeko/zenei/infrastructure/repository/hibernate/entity/UserEntity.java +++ b/extensions/jdbc-panache/runtime/src/main/java/dev/cloudeko/zenei/extension/jdbc/panache/entity/UserEntity.java @@ -1,4 +1,4 @@ -package dev.cloudeko.zenei.infrastructure.repository.hibernate.entity; +package dev.cloudeko.zenei.extension.jdbc.panache.entity; import dev.cloudeko.zenei.extension.core.model.session.Strategy; import io.quarkus.hibernate.orm.panache.PanacheEntity; diff --git a/core/src/main/java/dev/cloudeko/zenei/infrastructure/repository/hibernate/entity/UserPasswordEntity.java b/extensions/jdbc-panache/runtime/src/main/java/dev/cloudeko/zenei/extension/jdbc/panache/entity/UserPasswordEntity.java similarity index 89% rename from core/src/main/java/dev/cloudeko/zenei/infrastructure/repository/hibernate/entity/UserPasswordEntity.java rename to extensions/jdbc-panache/runtime/src/main/java/dev/cloudeko/zenei/extension/jdbc/panache/entity/UserPasswordEntity.java index c365ebf..953ab6c 100644 --- a/core/src/main/java/dev/cloudeko/zenei/infrastructure/repository/hibernate/entity/UserPasswordEntity.java +++ b/extensions/jdbc-panache/runtime/src/main/java/dev/cloudeko/zenei/extension/jdbc/panache/entity/UserPasswordEntity.java @@ -1,4 +1,4 @@ -package dev.cloudeko.zenei.infrastructure.repository.hibernate.entity; +package dev.cloudeko.zenei.extension.jdbc.panache.entity; import io.quarkus.hibernate.orm.panache.PanacheEntity; import jakarta.persistence.*; diff --git a/core/src/main/java/dev/cloudeko/zenei/domain/mapping/EmailAddressMapper.java b/extensions/jdbc-panache/runtime/src/main/java/dev/cloudeko/zenei/extension/jdbc/panache/mapping/EmailAddressMapper.java similarity index 79% rename from core/src/main/java/dev/cloudeko/zenei/domain/mapping/EmailAddressMapper.java rename to extensions/jdbc-panache/runtime/src/main/java/dev/cloudeko/zenei/extension/jdbc/panache/mapping/EmailAddressMapper.java index eb5c9b4..63053f8 100644 --- a/core/src/main/java/dev/cloudeko/zenei/domain/mapping/EmailAddressMapper.java +++ b/extensions/jdbc-panache/runtime/src/main/java/dev/cloudeko/zenei/extension/jdbc/panache/mapping/EmailAddressMapper.java @@ -1,7 +1,7 @@ -package dev.cloudeko.zenei.domain.mapping; +package dev.cloudeko.zenei.extension.jdbc.panache.mapping; import dev.cloudeko.zenei.extension.core.model.email.EmailAddress; -import dev.cloudeko.zenei.infrastructure.repository.hibernate.entity.EmailAddressEntity; +import dev.cloudeko.zenei.extension.jdbc.panache.entity.EmailAddressEntity; import org.mapstruct.Mapper; import org.mapstruct.MappingTarget; diff --git a/core/src/main/java/dev/cloudeko/zenei/domain/mapping/ExternalAccessTokenMapper.java b/extensions/jdbc-panache/runtime/src/main/java/dev/cloudeko/zenei/extension/jdbc/panache/mapping/ExternalAccessTokenMapper.java similarity index 80% rename from core/src/main/java/dev/cloudeko/zenei/domain/mapping/ExternalAccessTokenMapper.java rename to extensions/jdbc-panache/runtime/src/main/java/dev/cloudeko/zenei/extension/jdbc/panache/mapping/ExternalAccessTokenMapper.java index 22b1ebe..7d29361 100644 --- a/core/src/main/java/dev/cloudeko/zenei/domain/mapping/ExternalAccessTokenMapper.java +++ b/extensions/jdbc-panache/runtime/src/main/java/dev/cloudeko/zenei/extension/jdbc/panache/mapping/ExternalAccessTokenMapper.java @@ -1,7 +1,7 @@ -package dev.cloudeko.zenei.domain.mapping; +package dev.cloudeko.zenei.extension.jdbc.panache.mapping; import dev.cloudeko.zenei.extension.core.model.account.ExternalAccessToken; -import dev.cloudeko.zenei.infrastructure.repository.hibernate.entity.ExternalAccessTokenEntity; +import dev.cloudeko.zenei.extension.jdbc.panache.entity.ExternalAccessTokenEntity; import org.mapstruct.Mapper; import org.mapstruct.MappingTarget; diff --git a/core/src/main/java/dev/cloudeko/zenei/domain/mapping/ExternalAccountMapper.java b/extensions/jdbc-panache/runtime/src/main/java/dev/cloudeko/zenei/extension/jdbc/panache/mapping/ExternalAccountMapper.java similarity index 86% rename from core/src/main/java/dev/cloudeko/zenei/domain/mapping/ExternalAccountMapper.java rename to extensions/jdbc-panache/runtime/src/main/java/dev/cloudeko/zenei/extension/jdbc/panache/mapping/ExternalAccountMapper.java index a574285..5de9025 100644 --- a/core/src/main/java/dev/cloudeko/zenei/domain/mapping/ExternalAccountMapper.java +++ b/extensions/jdbc-panache/runtime/src/main/java/dev/cloudeko/zenei/extension/jdbc/panache/mapping/ExternalAccountMapper.java @@ -1,7 +1,7 @@ -package dev.cloudeko.zenei.domain.mapping; +package dev.cloudeko.zenei.extension.jdbc.panache.mapping; import dev.cloudeko.zenei.extension.core.model.account.ExternalAccount; -import dev.cloudeko.zenei.infrastructure.repository.hibernate.entity.ExternalAccountEntity; +import dev.cloudeko.zenei.extension.jdbc.panache.entity.ExternalAccountEntity; import org.mapstruct.AfterMapping; import org.mapstruct.Mapper; import org.mapstruct.MappingTarget; diff --git a/core/src/main/java/dev/cloudeko/zenei/domain/mapping/QuarkusMappingConfig.java b/extensions/jdbc-panache/runtime/src/main/java/dev/cloudeko/zenei/extension/jdbc/panache/mapping/QuarkusMappingConfig.java similarity index 88% rename from core/src/main/java/dev/cloudeko/zenei/domain/mapping/QuarkusMappingConfig.java rename to extensions/jdbc-panache/runtime/src/main/java/dev/cloudeko/zenei/extension/jdbc/panache/mapping/QuarkusMappingConfig.java index d8fb4c5..26dc1b3 100644 --- a/core/src/main/java/dev/cloudeko/zenei/domain/mapping/QuarkusMappingConfig.java +++ b/extensions/jdbc-panache/runtime/src/main/java/dev/cloudeko/zenei/extension/jdbc/panache/mapping/QuarkusMappingConfig.java @@ -1,4 +1,4 @@ -package dev.cloudeko.zenei.domain.mapping; +package dev.cloudeko.zenei.extension.jdbc.panache.mapping; import org.mapstruct.CollectionMappingStrategy; import org.mapstruct.MapperConfig; diff --git a/core/src/main/java/dev/cloudeko/zenei/domain/mapping/RefreshTokenMapper.java b/extensions/jdbc-panache/runtime/src/main/java/dev/cloudeko/zenei/extension/jdbc/panache/mapping/RefreshTokenMapper.java similarity index 79% rename from core/src/main/java/dev/cloudeko/zenei/domain/mapping/RefreshTokenMapper.java rename to extensions/jdbc-panache/runtime/src/main/java/dev/cloudeko/zenei/extension/jdbc/panache/mapping/RefreshTokenMapper.java index 961e2ba..31be2f9 100644 --- a/core/src/main/java/dev/cloudeko/zenei/domain/mapping/RefreshTokenMapper.java +++ b/extensions/jdbc-panache/runtime/src/main/java/dev/cloudeko/zenei/extension/jdbc/panache/mapping/RefreshTokenMapper.java @@ -1,7 +1,7 @@ -package dev.cloudeko.zenei.domain.mapping; +package dev.cloudeko.zenei.extension.jdbc.panache.mapping; import dev.cloudeko.zenei.extension.core.model.session.SessionRefreshToken; -import dev.cloudeko.zenei.infrastructure.repository.hibernate.entity.RefreshTokenEntity; +import dev.cloudeko.zenei.extension.jdbc.panache.entity.RefreshTokenEntity; import org.mapstruct.Mapper; import org.mapstruct.MappingTarget; diff --git a/core/src/main/java/dev/cloudeko/zenei/domain/mapping/UserMapper.java b/extensions/jdbc-panache/runtime/src/main/java/dev/cloudeko/zenei/extension/jdbc/panache/mapping/UserMapper.java similarity index 81% rename from core/src/main/java/dev/cloudeko/zenei/domain/mapping/UserMapper.java rename to extensions/jdbc-panache/runtime/src/main/java/dev/cloudeko/zenei/extension/jdbc/panache/mapping/UserMapper.java index 8bf05a8..21d655f 100644 --- a/core/src/main/java/dev/cloudeko/zenei/domain/mapping/UserMapper.java +++ b/extensions/jdbc-panache/runtime/src/main/java/dev/cloudeko/zenei/extension/jdbc/panache/mapping/UserMapper.java @@ -1,10 +1,8 @@ -package dev.cloudeko.zenei.domain.mapping; +package dev.cloudeko.zenei.extension.jdbc.panache.mapping; -import dev.cloudeko.zenei.extension.core.model.account.ExternalAccount; import dev.cloudeko.zenei.extension.core.model.email.EmailAddress; import dev.cloudeko.zenei.extension.core.model.user.User; -import dev.cloudeko.zenei.infrastructure.repository.hibernate.entity.ExternalAccountEntity; -import dev.cloudeko.zenei.infrastructure.repository.hibernate.entity.UserEntity; +import dev.cloudeko.zenei.extension.jdbc.panache.entity.UserEntity; import org.mapstruct.AfterMapping; import org.mapstruct.Mapper; import org.mapstruct.MappingTarget; diff --git a/core/src/main/java/dev/cloudeko/zenei/domain/mapping/UserPasswordMapper.java b/extensions/jdbc-panache/runtime/src/main/java/dev/cloudeko/zenei/extension/jdbc/panache/mapping/UserPasswordMapper.java similarity index 78% rename from core/src/main/java/dev/cloudeko/zenei/domain/mapping/UserPasswordMapper.java rename to extensions/jdbc-panache/runtime/src/main/java/dev/cloudeko/zenei/extension/jdbc/panache/mapping/UserPasswordMapper.java index 876df52..16fbdd7 100644 --- a/core/src/main/java/dev/cloudeko/zenei/domain/mapping/UserPasswordMapper.java +++ b/extensions/jdbc-panache/runtime/src/main/java/dev/cloudeko/zenei/extension/jdbc/panache/mapping/UserPasswordMapper.java @@ -1,7 +1,7 @@ -package dev.cloudeko.zenei.domain.mapping; +package dev.cloudeko.zenei.extension.jdbc.panache.mapping; import dev.cloudeko.zenei.extension.core.model.user.UserPassword; -import dev.cloudeko.zenei.infrastructure.repository.hibernate.entity.UserPasswordEntity; +import dev.cloudeko.zenei.extension.jdbc.panache.entity.UserPasswordEntity; import org.mapstruct.Mapper; import org.mapstruct.MappingTarget; diff --git a/core/src/main/java/dev/cloudeko/zenei/infrastructure/repository/hibernate/panache/AbstractPanacheRepository.java b/extensions/jdbc-panache/runtime/src/main/java/dev/cloudeko/zenei/extension/jdbc/panache/repository/AbstractPanacheRepository.java similarity index 61% rename from core/src/main/java/dev/cloudeko/zenei/infrastructure/repository/hibernate/panache/AbstractPanacheRepository.java rename to extensions/jdbc-panache/runtime/src/main/java/dev/cloudeko/zenei/extension/jdbc/panache/repository/AbstractPanacheRepository.java index d5f2d6b..d5f3045 100644 --- a/core/src/main/java/dev/cloudeko/zenei/infrastructure/repository/hibernate/panache/AbstractPanacheRepository.java +++ b/extensions/jdbc-panache/runtime/src/main/java/dev/cloudeko/zenei/extension/jdbc/panache/repository/AbstractPanacheRepository.java @@ -1,4 +1,4 @@ -package dev.cloudeko.zenei.infrastructure.repository.hibernate.panache; +package dev.cloudeko.zenei.extension.jdbc.panache.repository; public abstract class AbstractPanacheRepository extends AbstractPanacheRepositoryBase { } diff --git a/core/src/main/java/dev/cloudeko/zenei/infrastructure/repository/hibernate/panache/AbstractPanacheRepositoryBase.java b/extensions/jdbc-panache/runtime/src/main/java/dev/cloudeko/zenei/extension/jdbc/panache/repository/AbstractPanacheRepositoryBase.java similarity index 69% rename from core/src/main/java/dev/cloudeko/zenei/infrastructure/repository/hibernate/panache/AbstractPanacheRepositoryBase.java rename to extensions/jdbc-panache/runtime/src/main/java/dev/cloudeko/zenei/extension/jdbc/panache/repository/AbstractPanacheRepositoryBase.java index 188f866..10f711b 100644 --- a/core/src/main/java/dev/cloudeko/zenei/infrastructure/repository/hibernate/panache/AbstractPanacheRepositoryBase.java +++ b/extensions/jdbc-panache/runtime/src/main/java/dev/cloudeko/zenei/extension/jdbc/panache/repository/AbstractPanacheRepositoryBase.java @@ -1,6 +1,6 @@ -package dev.cloudeko.zenei.infrastructure.repository.hibernate.panache; +package dev.cloudeko.zenei.extension.jdbc.panache.repository; -import dev.cloudeko.zenei.infrastructure.repository.hibernate.entity.UserEntity; +import dev.cloudeko.zenei.extension.jdbc.panache.entity.UserEntity; import io.quarkus.hibernate.orm.panache.PanacheRepositoryBase; import jakarta.persistence.NoResultException; @@ -8,8 +8,8 @@ public abstract class AbstractPanacheRepositoryBase implements PanacheRepositoryBase { - protected UserEntity findUserEntityById(Long id) { - return getEntityManager().find(UserEntity.class, id); + protected Optional findUserEntityById(Long id) { + return Optional.ofNullable(getEntityManager().find(UserEntity.class, id)); } protected Optional findUserEntityByEmail(String email) { diff --git a/core/src/main/java/dev/cloudeko/zenei/infrastructure/repository/hibernate/panache/EmailAddressRepositoryPanache.java b/extensions/jdbc-panache/runtime/src/main/java/dev/cloudeko/zenei/extension/jdbc/panache/repository/EmailAddressRepositoryPanache.java similarity index 65% rename from core/src/main/java/dev/cloudeko/zenei/infrastructure/repository/hibernate/panache/EmailAddressRepositoryPanache.java rename to extensions/jdbc-panache/runtime/src/main/java/dev/cloudeko/zenei/extension/jdbc/panache/repository/EmailAddressRepositoryPanache.java index 8e8eac6..74b9c76 100644 --- a/core/src/main/java/dev/cloudeko/zenei/infrastructure/repository/hibernate/panache/EmailAddressRepositoryPanache.java +++ b/extensions/jdbc-panache/runtime/src/main/java/dev/cloudeko/zenei/extension/jdbc/panache/repository/EmailAddressRepositoryPanache.java @@ -1,11 +1,10 @@ -package dev.cloudeko.zenei.infrastructure.repository.hibernate.panache; +package dev.cloudeko.zenei.extension.jdbc.panache.repository; -import dev.cloudeko.zenei.domain.exception.InvalidConfirmationTokenException; -import dev.cloudeko.zenei.domain.exception.UserNotFoundException; -import dev.cloudeko.zenei.domain.mapping.EmailAddressMapper; import dev.cloudeko.zenei.extension.core.model.email.EmailAddress; import dev.cloudeko.zenei.extension.core.repository.EmailAddressRepository; -import dev.cloudeko.zenei.infrastructure.repository.hibernate.entity.EmailAddressEntity; +import dev.cloudeko.zenei.extension.jdbc.panache.entity.EmailAddressEntity; +import dev.cloudeko.zenei.extension.jdbc.panache.entity.UserEntity; +import dev.cloudeko.zenei.extension.jdbc.panache.mapping.EmailAddressMapper; import io.quarkus.panache.common.Parameters; import jakarta.enterprise.context.ApplicationScoped; import lombok.AllArgsConstructor; @@ -21,12 +20,12 @@ public class EmailAddressRepositoryPanache extends AbstractPanacheRepository user = findUserEntityByEmail(emailAddress.getEmail()); if (user.isEmpty()) { - throw new UserNotFoundException(); + return; } - final var emailAddressEntity = emailAddressMapper.toEntity(emailAddress); + EmailAddressEntity emailAddressEntity = emailAddressMapper.toEntity(emailAddress); persist(emailAddressEntity); emailAddressMapper.updateDomainFromEntity(emailAddressEntity, emailAddress); @@ -49,10 +48,8 @@ public Optional findByEmailAddress(String emailAddress) { } @Override - public void confirmEmailAddress(String token) { + public boolean confirmEmailAddress(String token) { final var updated = update("#EmailAddressEntity.confirmEmail", Parameters.with("token", token)); - if (updated == 0) { - throw new InvalidConfirmationTokenException(); - } + return updated != 0; } } diff --git a/core/src/main/java/dev/cloudeko/zenei/infrastructure/repository/hibernate/panache/ExternalAccessTokenRepositoryPanache.java b/extensions/jdbc-panache/runtime/src/main/java/dev/cloudeko/zenei/extension/jdbc/panache/repository/ExternalAccessTokenRepositoryPanache.java similarity index 66% rename from core/src/main/java/dev/cloudeko/zenei/infrastructure/repository/hibernate/panache/ExternalAccessTokenRepositoryPanache.java rename to extensions/jdbc-panache/runtime/src/main/java/dev/cloudeko/zenei/extension/jdbc/panache/repository/ExternalAccessTokenRepositoryPanache.java index b126b4f..a2b1eb8 100644 --- a/core/src/main/java/dev/cloudeko/zenei/infrastructure/repository/hibernate/panache/ExternalAccessTokenRepositoryPanache.java +++ b/extensions/jdbc-panache/runtime/src/main/java/dev/cloudeko/zenei/extension/jdbc/panache/repository/ExternalAccessTokenRepositoryPanache.java @@ -1,9 +1,9 @@ -package dev.cloudeko.zenei.infrastructure.repository.hibernate.panache; +package dev.cloudeko.zenei.extension.jdbc.panache.repository; -import dev.cloudeko.zenei.domain.mapping.ExternalAccessTokenMapper; import dev.cloudeko.zenei.extension.core.model.account.ExternalAccessToken; import dev.cloudeko.zenei.extension.core.repository.ExternalAccessTokenRepository; -import dev.cloudeko.zenei.infrastructure.repository.hibernate.entity.ExternalAccessTokenEntity; +import dev.cloudeko.zenei.extension.jdbc.panache.entity.ExternalAccessTokenEntity; +import dev.cloudeko.zenei.extension.jdbc.panache.mapping.ExternalAccessTokenMapper; import jakarta.enterprise.context.ApplicationScoped; import lombok.AllArgsConstructor; @@ -20,7 +20,8 @@ public class ExternalAccessTokenRepositoryPanache extends AbstractPanacheReposit @Override public List listByProvider(long user, String provider) { - final var tokens = list("#ExternalAccessTokenEntity.listByProvider", with("user", user).and("provider", provider)); + List tokens = list("#ExternalAccessTokenEntity.listByProvider", + with("user", user).and("provider", provider)); return externalAccessTokenMapper.toDomainList(tokens); } diff --git a/core/src/main/java/dev/cloudeko/zenei/infrastructure/repository/hibernate/panache/ExternalAccountRepositoryPanache.java b/extensions/jdbc-panache/runtime/src/main/java/dev/cloudeko/zenei/extension/jdbc/panache/repository/ExternalAccountRepositoryPanache.java similarity index 54% rename from core/src/main/java/dev/cloudeko/zenei/infrastructure/repository/hibernate/panache/ExternalAccountRepositoryPanache.java rename to extensions/jdbc-panache/runtime/src/main/java/dev/cloudeko/zenei/extension/jdbc/panache/repository/ExternalAccountRepositoryPanache.java index 3c1b9f4..8f8a23c 100644 --- a/core/src/main/java/dev/cloudeko/zenei/infrastructure/repository/hibernate/panache/ExternalAccountRepositoryPanache.java +++ b/extensions/jdbc-panache/runtime/src/main/java/dev/cloudeko/zenei/extension/jdbc/panache/repository/ExternalAccountRepositoryPanache.java @@ -1,9 +1,9 @@ -package dev.cloudeko.zenei.infrastructure.repository.hibernate.panache; +package dev.cloudeko.zenei.extension.jdbc.panache.repository; -import dev.cloudeko.zenei.domain.mapping.ExternalAccountMapper; import dev.cloudeko.zenei.extension.core.model.account.ExternalAccount; import dev.cloudeko.zenei.extension.core.repository.ExternalAccountRepository; -import dev.cloudeko.zenei.infrastructure.repository.hibernate.entity.ExternalAccountEntity; +import dev.cloudeko.zenei.extension.jdbc.panache.entity.ExternalAccountEntity; +import dev.cloudeko.zenei.extension.jdbc.panache.mapping.ExternalAccountMapper; import jakarta.enterprise.context.ApplicationScoped; import lombok.AllArgsConstructor; @@ -20,13 +20,9 @@ public class ExternalAccountRepositoryPanache extends AbstractPanacheRepository< @Override public Optional findByProviderId(String providerId) { - final var accountEntity = find("#ExternalAccountEntity.findByProviderId", ExternalAccountEntity.class, with("providerId", providerId)) - .firstResult(); + ExternalAccountEntity accountEntity = find("#ExternalAccountEntity.findByProviderId", ExternalAccountEntity.class, + with("providerId", providerId)).firstResult(); - if (accountEntity == null) { - return Optional.empty(); - } - - return Optional.of(accountEntity).map(externalAccountMapper::toDomain); + return Optional.ofNullable(accountEntity).map(externalAccountMapper::toDomain); } } diff --git a/core/src/main/java/dev/cloudeko/zenei/infrastructure/repository/hibernate/panache/RefreshTokenRepositoryPanache.java b/extensions/jdbc-panache/runtime/src/main/java/dev/cloudeko/zenei/extension/jdbc/panache/repository/RefreshTokenRepositoryPanache.java similarity index 53% rename from core/src/main/java/dev/cloudeko/zenei/infrastructure/repository/hibernate/panache/RefreshTokenRepositoryPanache.java rename to extensions/jdbc-panache/runtime/src/main/java/dev/cloudeko/zenei/extension/jdbc/panache/repository/RefreshTokenRepositoryPanache.java index fc99d41..3d35112 100644 --- a/core/src/main/java/dev/cloudeko/zenei/infrastructure/repository/hibernate/panache/RefreshTokenRepositoryPanache.java +++ b/extensions/jdbc-panache/runtime/src/main/java/dev/cloudeko/zenei/extension/jdbc/panache/repository/RefreshTokenRepositoryPanache.java @@ -1,16 +1,17 @@ -package dev.cloudeko.zenei.infrastructure.repository.hibernate.panache; +package dev.cloudeko.zenei.extension.jdbc.panache.repository; -import dev.cloudeko.zenei.domain.exception.InvalidRefreshTokenException; -import dev.cloudeko.zenei.domain.mapping.RefreshTokenMapper; import dev.cloudeko.zenei.extension.core.model.session.SessionRefreshToken; import dev.cloudeko.zenei.extension.core.repository.RefreshTokenRepository; -import dev.cloudeko.zenei.infrastructure.repository.hibernate.entity.RefreshTokenEntity; +import dev.cloudeko.zenei.extension.jdbc.panache.entity.RefreshTokenEntity; +import dev.cloudeko.zenei.extension.jdbc.panache.entity.UserEntity; +import dev.cloudeko.zenei.extension.jdbc.panache.mapping.RefreshTokenMapper; import jakarta.enterprise.context.ApplicationScoped; -import jakarta.persistence.NoResultException; import lombok.AllArgsConstructor; import java.util.Optional; +import static io.quarkus.panache.common.Parameters.with; + @ApplicationScoped @AllArgsConstructor public class RefreshTokenRepositoryPanache extends AbstractPanacheRepository implements @@ -20,10 +21,15 @@ public class RefreshTokenRepositoryPanache extends AbstractPanacheRepository userEntity = findUserEntityById(sessionRefreshToken.getUser().getId()); + if (userEntity.isEmpty()) { + return null; + } + + RefreshTokenEntity refreshTokenEntity = new RefreshTokenEntity(); refreshTokenEntity.setToken(sessionRefreshToken.getToken()); - refreshTokenEntity.setUser(findUserEntityById(sessionRefreshToken.getUser().getId())); + refreshTokenEntity.setUser(userEntity.get()); refreshTokenEntity.setRevoked(sessionRefreshToken.isRevoked()); refreshTokenEntity.setExpiresAt(sessionRefreshToken.getExpiresAt()); @@ -36,20 +42,30 @@ public SessionRefreshToken createRefreshToken(SessionRefreshToken sessionRefresh } @Override - public SessionRefreshToken swapRefreshToken( - SessionRefreshToken currentSessionRefreshToken, SessionRefreshToken newSessionRefreshToken) { - final var currentRefreshTokenEntity = findRefreshTokenEntityByToken(currentSessionRefreshToken.getToken()) - .orElseThrow(InvalidRefreshTokenException::new); - final var newRefreshTokenEntity = new RefreshTokenEntity(); + public SessionRefreshToken swapRefreshToken(SessionRefreshToken currentSessionRefreshToken, + SessionRefreshToken newSessionRefreshToken) { + Optional currentRefreshTokenEntity = findRefreshTokenEntityByToken( + currentSessionRefreshToken.getToken()); + + if (currentRefreshTokenEntity.isEmpty()) { + return null; + } + + Optional userEntity = findUserEntityById(newSessionRefreshToken.getUser().getId()); + if (userEntity.isEmpty()) { + return null; + } + + RefreshTokenEntity newRefreshTokenEntity = new RefreshTokenEntity(); newRefreshTokenEntity.setToken(newSessionRefreshToken.getToken()); - newRefreshTokenEntity.setUser(findUserEntityById(newSessionRefreshToken.getUser().getId())); + newRefreshTokenEntity.setUser(userEntity.get()); newRefreshTokenEntity.setRevoked(newSessionRefreshToken.isRevoked()); newRefreshTokenEntity.setExpiresAt(newSessionRefreshToken.getExpiresAt()); - currentRefreshTokenEntity.setRevoked(true); + currentRefreshTokenEntity.get().setRevoked(true); - persist(newRefreshTokenEntity, currentRefreshTokenEntity); + persist(newRefreshTokenEntity, currentRefreshTokenEntity.get()); newSessionRefreshToken.setCreatedAt(newRefreshTokenEntity.getCreatedAt()); newSessionRefreshToken.setUpdatedAt(newRefreshTokenEntity.getUpdatedAt()); @@ -59,18 +75,10 @@ public SessionRefreshToken swapRefreshToken( @Override public Optional findRefreshTokenByToken(String token) { - final var refreshTokenResult = findRefreshTokenEntityByToken(token); - return refreshTokenResult.map(refreshTokenMapper::toDomain); + return findRefreshTokenEntityByToken(token).map(refreshTokenMapper::toDomain); } private Optional findRefreshTokenEntityByToken(String token) { - try { - return Optional.of( - getEntityManager().createNamedQuery("RefreshTokenEntity.findByValidToken", RefreshTokenEntity.class) - .setParameter("token", token) - .getSingleResult()); - } catch (NoResultException e) { - return Optional.empty(); - } + return find("#RefreshTokenEntity.findByValidToken", with("token", token)).firstResultOptional(); } } diff --git a/extensions/jdbc-panache/runtime/src/main/java/dev/cloudeko/zenei/extension/jdbc/panache/repository/SessionRepositoryPanache.java b/extensions/jdbc-panache/runtime/src/main/java/dev/cloudeko/zenei/extension/jdbc/panache/repository/SessionRepositoryPanache.java new file mode 100644 index 0000000..38eb3c0 --- /dev/null +++ b/extensions/jdbc-panache/runtime/src/main/java/dev/cloudeko/zenei/extension/jdbc/panache/repository/SessionRepositoryPanache.java @@ -0,0 +1,4 @@ +package dev.cloudeko.zenei.extension.jdbc.panache.repository; + +public class SessionRepositoryPanache { +} diff --git a/core/src/main/java/dev/cloudeko/zenei/infrastructure/repository/hibernate/panache/UserPasswordRepositoryPanache.java b/extensions/jdbc-panache/runtime/src/main/java/dev/cloudeko/zenei/extension/jdbc/panache/repository/UserPasswordRepositoryPanache.java similarity index 59% rename from core/src/main/java/dev/cloudeko/zenei/infrastructure/repository/hibernate/panache/UserPasswordRepositoryPanache.java rename to extensions/jdbc-panache/runtime/src/main/java/dev/cloudeko/zenei/extension/jdbc/panache/repository/UserPasswordRepositoryPanache.java index 2adbd40..6f7d091 100644 --- a/core/src/main/java/dev/cloudeko/zenei/infrastructure/repository/hibernate/panache/UserPasswordRepositoryPanache.java +++ b/extensions/jdbc-panache/runtime/src/main/java/dev/cloudeko/zenei/extension/jdbc/panache/repository/UserPasswordRepositoryPanache.java @@ -1,10 +1,11 @@ -package dev.cloudeko.zenei.infrastructure.repository.hibernate.panache; +package dev.cloudeko.zenei.extension.jdbc.panache.repository; -import dev.cloudeko.zenei.domain.mapping.UserMapper; -import dev.cloudeko.zenei.domain.mapping.UserPasswordMapper; import dev.cloudeko.zenei.extension.core.model.user.UserPassword; import dev.cloudeko.zenei.extension.core.repository.UserPasswordRepository; -import dev.cloudeko.zenei.infrastructure.repository.hibernate.entity.UserPasswordEntity; +import dev.cloudeko.zenei.extension.jdbc.panache.entity.UserEntity; +import dev.cloudeko.zenei.extension.jdbc.panache.entity.UserPasswordEntity; +import dev.cloudeko.zenei.extension.jdbc.panache.mapping.UserMapper; +import dev.cloudeko.zenei.extension.jdbc.panache.mapping.UserPasswordMapper; import jakarta.enterprise.context.ApplicationScoped; import lombok.AllArgsConstructor; @@ -24,10 +25,14 @@ public void createUserPassword(UserPassword userPassword) { throw new IllegalArgumentException("User reference cannot be null"); } - final var user = userPassword.getUser(); - final var userPasswordEntity = new UserPasswordEntity(); + Optional user = findUserEntityById(userPassword.getUser().getId()); + if (user.isEmpty()) { + return; + } + + UserPasswordEntity userPasswordEntity = new UserPasswordEntity(); - userPasswordEntity.setUser(findUserEntityById(user.getId())); + userPasswordEntity.setUser(user.get()); userPasswordEntity.setPasswordHash(userPassword.getPasswordHash()); persist(userPasswordEntity); @@ -35,7 +40,7 @@ public void createUserPassword(UserPassword userPassword) { @Override public void updateUserPassword(UserPassword userPassword) { - final var userPasswordEntity = find("user", userPassword.getUser().getId()).firstResult(); + UserPasswordEntity userPasswordEntity = find("user", userPassword.getUser().getId()).firstResult(); userPasswordEntity.setPasswordHash(userPassword.getPasswordHash()); @@ -44,12 +49,6 @@ public void updateUserPassword(UserPassword userPassword) { @Override public Optional getUserPasswordByEmail(String email) { - final var userPasswordEntity = find("user.primaryEmailAddress", email).firstResult(); - - if (userPasswordEntity == null) { - return Optional.empty(); - } - - return Optional.of(userPasswordMapper.toDomain(userPasswordEntity)); + return find("user.primaryEmailAddress", email).firstResultOptional().map(userPasswordMapper::toDomain); } } diff --git a/core/src/main/java/dev/cloudeko/zenei/infrastructure/repository/hibernate/panache/UserRepositoryPanache.java b/extensions/jdbc-panache/runtime/src/main/java/dev/cloudeko/zenei/extension/jdbc/panache/repository/UserRepositoryPanache.java similarity index 60% rename from core/src/main/java/dev/cloudeko/zenei/infrastructure/repository/hibernate/panache/UserRepositoryPanache.java rename to extensions/jdbc-panache/runtime/src/main/java/dev/cloudeko/zenei/extension/jdbc/panache/repository/UserRepositoryPanache.java index bb43b68..fae12d0 100644 --- a/core/src/main/java/dev/cloudeko/zenei/infrastructure/repository/hibernate/panache/UserRepositoryPanache.java +++ b/extensions/jdbc-panache/runtime/src/main/java/dev/cloudeko/zenei/extension/jdbc/panache/repository/UserRepositoryPanache.java @@ -1,9 +1,9 @@ -package dev.cloudeko.zenei.infrastructure.repository.hibernate.panache; +package dev.cloudeko.zenei.extension.jdbc.panache.repository; -import dev.cloudeko.zenei.domain.mapping.UserMapper; import dev.cloudeko.zenei.extension.core.model.user.User; import dev.cloudeko.zenei.extension.core.repository.UserRepository; -import dev.cloudeko.zenei.infrastructure.repository.hibernate.entity.UserEntity; +import dev.cloudeko.zenei.extension.jdbc.panache.entity.UserEntity; +import dev.cloudeko.zenei.extension.jdbc.panache.mapping.UserMapper; import jakarta.enterprise.context.ApplicationScoped; import lombok.AllArgsConstructor; @@ -20,14 +20,8 @@ public class UserRepositoryPanache extends AbstractPanacheRepository @Override public void createUser(User user) { - final var userEntity = userMapper.toEntity(user); + UserEntity userEntity = userMapper.toEntity(user); - /*userEntity.getEmailAddresses().forEach(emailAddressEntity -> emailAddressEntity.setUser(userEntity)); - userEntity.getAccounts().forEach(accountEntity -> accountEntity.setUser(userEntity)); - - userEntity.getAccounts().forEach(accountEntity -> accountEntity.getAccessTokens() - .forEach(accessTokenEntity -> accessTokenEntity.setAccount(accountEntity))); -*/ persistAndFlush(userEntity); userMapper.updateDomainFromEntity(userEntity, user); @@ -45,23 +39,17 @@ public boolean existsByUsername(String username) { @Override public Optional getUserById(Long id) { - final var userEntity = findUserEntityById(id); - if (userEntity == null) { - return Optional.empty(); - } - - return Optional.of(userMapper.toDomain(userEntity)); + return findUserEntityById(id).map(userMapper::toDomain); } @Override public Optional getUserByEmail(String email) { - final var userEntity = findUserEntityByEmail(email); - return userEntity.map(userMapper::toDomain); + return findUserEntityByEmail(email).map(userMapper::toDomain); } @Override public Optional getUserByUsername(String username) { - final var user = find("username", username).firstResult(); + UserEntity user = find("username", username).firstResult(); if (user == null) { return Optional.empty(); } @@ -71,7 +59,7 @@ public Optional getUserByUsername(String username) { @Override public Optional getByAccountProviderId(String providerId) { - final var user = find("#UserEntity.findByAccountProviderId", with("providerId", providerId)).firstResult(); + UserEntity user = find("#UserEntity.findByAccountProviderId", with("providerId", providerId)).firstResult(); if (user == null) { return Optional.empty(); } diff --git a/extensions/jdbc-panache/runtime/src/main/resources/META-INF/beans.xml b/extensions/jdbc-panache/runtime/src/main/resources/META-INF/beans.xml new file mode 100644 index 0000000..e69de29 diff --git a/extensions/jdbc-panache/runtime/src/main/resources/META-INF/quarkus-extension.yaml b/extensions/jdbc-panache/runtime/src/main/resources/META-INF/quarkus-extension.yaml new file mode 100644 index 0000000..14a9542 --- /dev/null +++ b/extensions/jdbc-panache/runtime/src/main/resources/META-INF/quarkus-extension.yaml @@ -0,0 +1,9 @@ +name: Zenei Quarkus JDBC Panache Extension +#description: Do something useful. +metadata: +# keywords: +# - "key-auth" +# guide: ... # To create and publish this guide, see https://github.com/quarkiverse/quarkiverse/wiki#documenting-your-extension +# categories: +# - "miscellaneous" +# status: "preview" diff --git a/extensions/pom.xml b/extensions/pom.xml index 260220c..283a472 100644 --- a/extensions/pom.xml +++ b/extensions/pom.xml @@ -15,8 +15,9 @@ pom - external-authentication core + jdbc-panache + external-authentication diff --git a/core/pom.xml b/platform/pom.xml similarity index 96% rename from core/pom.xml rename to platform/pom.xml index 92df747..51aaafb 100644 --- a/core/pom.xml +++ b/platform/pom.xml @@ -9,8 +9,8 @@ 0.0.1 - Zenei - Core - core + Zenei - Platform + platform @@ -20,7 +20,11 @@ dev.cloudeko - external-authentication + jdbc-panache-extension + + + dev.cloudeko + external-authentication-extension @@ -197,11 +201,6 @@ mapstruct-processor ${org.mapstruct.version} - - no.entur.mapstruct.spi - protobuf-spi-impl - 1.44 - org.projectlombok lombok-mapstruct-binding diff --git a/core/src/main/java/dev/cloudeko/zenei/application/web/model/request/CreateUserRequest.java b/platform/src/main/java/dev/cloudeko/zenei/application/web/model/request/CreateUserRequest.java similarity index 100% rename from core/src/main/java/dev/cloudeko/zenei/application/web/model/request/CreateUserRequest.java rename to platform/src/main/java/dev/cloudeko/zenei/application/web/model/request/CreateUserRequest.java diff --git a/core/src/main/java/dev/cloudeko/zenei/application/web/model/request/LoginRequest.java b/platform/src/main/java/dev/cloudeko/zenei/application/web/model/request/LoginRequest.java similarity index 100% rename from core/src/main/java/dev/cloudeko/zenei/application/web/model/request/LoginRequest.java rename to platform/src/main/java/dev/cloudeko/zenei/application/web/model/request/LoginRequest.java diff --git a/core/src/main/java/dev/cloudeko/zenei/application/web/model/request/RegisterRequest.java b/platform/src/main/java/dev/cloudeko/zenei/application/web/model/request/RegisterRequest.java similarity index 100% rename from core/src/main/java/dev/cloudeko/zenei/application/web/model/request/RegisterRequest.java rename to platform/src/main/java/dev/cloudeko/zenei/application/web/model/request/RegisterRequest.java diff --git a/core/src/main/java/dev/cloudeko/zenei/application/web/model/request/UpdateUserRequest.java b/platform/src/main/java/dev/cloudeko/zenei/application/web/model/request/UpdateUserRequest.java similarity index 100% rename from core/src/main/java/dev/cloudeko/zenei/application/web/model/request/UpdateUserRequest.java rename to platform/src/main/java/dev/cloudeko/zenei/application/web/model/request/UpdateUserRequest.java diff --git a/core/src/main/java/dev/cloudeko/zenei/application/web/model/response/EmailAddressResponse.java b/platform/src/main/java/dev/cloudeko/zenei/application/web/model/response/EmailAddressResponse.java similarity index 100% rename from core/src/main/java/dev/cloudeko/zenei/application/web/model/response/EmailAddressResponse.java rename to platform/src/main/java/dev/cloudeko/zenei/application/web/model/response/EmailAddressResponse.java diff --git a/core/src/main/java/dev/cloudeko/zenei/application/web/model/response/ErrorResponse.java b/platform/src/main/java/dev/cloudeko/zenei/application/web/model/response/ErrorResponse.java similarity index 100% rename from core/src/main/java/dev/cloudeko/zenei/application/web/model/response/ErrorResponse.java rename to platform/src/main/java/dev/cloudeko/zenei/application/web/model/response/ErrorResponse.java diff --git a/core/src/main/java/dev/cloudeko/zenei/application/web/model/response/ExternalAccessTokenResponse.java b/platform/src/main/java/dev/cloudeko/zenei/application/web/model/response/ExternalAccessTokenResponse.java similarity index 100% rename from core/src/main/java/dev/cloudeko/zenei/application/web/model/response/ExternalAccessTokenResponse.java rename to platform/src/main/java/dev/cloudeko/zenei/application/web/model/response/ExternalAccessTokenResponse.java diff --git a/core/src/main/java/dev/cloudeko/zenei/application/web/model/response/ExternalAccessTokensResponse.java b/platform/src/main/java/dev/cloudeko/zenei/application/web/model/response/ExternalAccessTokensResponse.java similarity index 100% rename from core/src/main/java/dev/cloudeko/zenei/application/web/model/response/ExternalAccessTokensResponse.java rename to platform/src/main/java/dev/cloudeko/zenei/application/web/model/response/ExternalAccessTokensResponse.java diff --git a/core/src/main/java/dev/cloudeko/zenei/application/web/model/response/PrivateUserResponse.java b/platform/src/main/java/dev/cloudeko/zenei/application/web/model/response/PrivateUserResponse.java similarity index 100% rename from core/src/main/java/dev/cloudeko/zenei/application/web/model/response/PrivateUserResponse.java rename to platform/src/main/java/dev/cloudeko/zenei/application/web/model/response/PrivateUserResponse.java diff --git a/core/src/main/java/dev/cloudeko/zenei/application/web/model/response/PrivateUsersResponse.java b/platform/src/main/java/dev/cloudeko/zenei/application/web/model/response/PrivateUsersResponse.java similarity index 100% rename from core/src/main/java/dev/cloudeko/zenei/application/web/model/response/PrivateUsersResponse.java rename to platform/src/main/java/dev/cloudeko/zenei/application/web/model/response/PrivateUsersResponse.java diff --git a/core/src/main/java/dev/cloudeko/zenei/application/web/model/response/PublicUserResponse.java b/platform/src/main/java/dev/cloudeko/zenei/application/web/model/response/PublicUserResponse.java similarity index 100% rename from core/src/main/java/dev/cloudeko/zenei/application/web/model/response/PublicUserResponse.java rename to platform/src/main/java/dev/cloudeko/zenei/application/web/model/response/PublicUserResponse.java diff --git a/core/src/main/java/dev/cloudeko/zenei/application/web/model/response/SessionTokenResponse.java b/platform/src/main/java/dev/cloudeko/zenei/application/web/model/response/SessionTokenResponse.java similarity index 100% rename from core/src/main/java/dev/cloudeko/zenei/application/web/model/response/SessionTokenResponse.java rename to platform/src/main/java/dev/cloudeko/zenei/application/web/model/response/SessionTokenResponse.java diff --git a/core/src/main/java/dev/cloudeko/zenei/application/web/resource/backend/AdminSettingsResource.java b/platform/src/main/java/dev/cloudeko/zenei/application/web/resource/backend/AdminSettingsResource.java similarity index 100% rename from core/src/main/java/dev/cloudeko/zenei/application/web/resource/backend/AdminSettingsResource.java rename to platform/src/main/java/dev/cloudeko/zenei/application/web/resource/backend/AdminSettingsResource.java diff --git a/core/src/main/java/dev/cloudeko/zenei/application/web/resource/backend/AdminUsersResource.java b/platform/src/main/java/dev/cloudeko/zenei/application/web/resource/backend/AdminUsersResource.java similarity index 100% rename from core/src/main/java/dev/cloudeko/zenei/application/web/resource/backend/AdminUsersResource.java rename to platform/src/main/java/dev/cloudeko/zenei/application/web/resource/backend/AdminUsersResource.java diff --git a/core/src/main/java/dev/cloudeko/zenei/application/web/resource/frontend/ExternalResource.java b/platform/src/main/java/dev/cloudeko/zenei/application/web/resource/frontend/ExternalResource.java similarity index 100% rename from core/src/main/java/dev/cloudeko/zenei/application/web/resource/frontend/ExternalResource.java rename to platform/src/main/java/dev/cloudeko/zenei/application/web/resource/frontend/ExternalResource.java diff --git a/core/src/main/java/dev/cloudeko/zenei/application/web/resource/frontend/IdentifierPasswordResource.java b/platform/src/main/java/dev/cloudeko/zenei/application/web/resource/frontend/IdentifierPasswordResource.java similarity index 100% rename from core/src/main/java/dev/cloudeko/zenei/application/web/resource/frontend/IdentifierPasswordResource.java rename to platform/src/main/java/dev/cloudeko/zenei/application/web/resource/frontend/IdentifierPasswordResource.java diff --git a/core/src/main/java/dev/cloudeko/zenei/application/web/resource/frontend/SessionResource.java b/platform/src/main/java/dev/cloudeko/zenei/application/web/resource/frontend/SessionResource.java similarity index 100% rename from core/src/main/java/dev/cloudeko/zenei/application/web/resource/frontend/SessionResource.java rename to platform/src/main/java/dev/cloudeko/zenei/application/web/resource/frontend/SessionResource.java diff --git a/core/src/main/java/dev/cloudeko/zenei/application/web/resource/frontend/UserResource.java b/platform/src/main/java/dev/cloudeko/zenei/application/web/resource/frontend/UserResource.java similarity index 92% rename from core/src/main/java/dev/cloudeko/zenei/application/web/resource/frontend/UserResource.java rename to platform/src/main/java/dev/cloudeko/zenei/application/web/resource/frontend/UserResource.java index e616ebe..b4a5ea3 100644 --- a/core/src/main/java/dev/cloudeko/zenei/application/web/resource/frontend/UserResource.java +++ b/platform/src/main/java/dev/cloudeko/zenei/application/web/resource/frontend/UserResource.java @@ -4,6 +4,7 @@ import dev.cloudeko.zenei.domain.feature.FindUserByIdentifier; import dev.cloudeko.zenei.infrastructure.config.ApplicationConfig; import io.quarkus.security.Authenticated; +import io.quarkus.security.identity.SecurityIdentity; import jakarta.ws.rs.GET; import jakarta.ws.rs.Path; import jakarta.ws.rs.Produces; @@ -22,6 +23,8 @@ public class UserResource { private final ApplicationConfig applicationConfig; private final FindUserByIdentifier findUserByIdentifier; + private final SecurityIdentity securityIdentity; + @GET @Authenticated @Produces(MediaType.APPLICATION_JSON) diff --git a/core/src/main/java/dev/cloudeko/zenei/domain/exception/BusinessException.java b/platform/src/main/java/dev/cloudeko/zenei/domain/exception/BusinessException.java similarity index 100% rename from core/src/main/java/dev/cloudeko/zenei/domain/exception/BusinessException.java rename to platform/src/main/java/dev/cloudeko/zenei/domain/exception/BusinessException.java diff --git a/core/src/main/java/dev/cloudeko/zenei/domain/exception/EmailAlreadyExistsException.java b/platform/src/main/java/dev/cloudeko/zenei/domain/exception/EmailAlreadyExistsException.java similarity index 100% rename from core/src/main/java/dev/cloudeko/zenei/domain/exception/EmailAlreadyExistsException.java rename to platform/src/main/java/dev/cloudeko/zenei/domain/exception/EmailAlreadyExistsException.java diff --git a/core/src/main/java/dev/cloudeko/zenei/domain/exception/EmailNotFoundException.java b/platform/src/main/java/dev/cloudeko/zenei/domain/exception/EmailNotFoundException.java similarity index 100% rename from core/src/main/java/dev/cloudeko/zenei/domain/exception/EmailNotFoundException.java rename to platform/src/main/java/dev/cloudeko/zenei/domain/exception/EmailNotFoundException.java diff --git a/core/src/main/java/dev/cloudeko/zenei/domain/exception/InvalidConfirmationTokenException.java b/platform/src/main/java/dev/cloudeko/zenei/domain/exception/InvalidConfirmationTokenException.java similarity index 100% rename from core/src/main/java/dev/cloudeko/zenei/domain/exception/InvalidConfirmationTokenException.java rename to platform/src/main/java/dev/cloudeko/zenei/domain/exception/InvalidConfirmationTokenException.java diff --git a/core/src/main/java/dev/cloudeko/zenei/domain/exception/InvalidExternalAuthProvider.java b/platform/src/main/java/dev/cloudeko/zenei/domain/exception/InvalidExternalAuthProvider.java similarity index 100% rename from core/src/main/java/dev/cloudeko/zenei/domain/exception/InvalidExternalAuthProvider.java rename to platform/src/main/java/dev/cloudeko/zenei/domain/exception/InvalidExternalAuthProvider.java diff --git a/core/src/main/java/dev/cloudeko/zenei/domain/exception/InvalidPasswordException.java b/platform/src/main/java/dev/cloudeko/zenei/domain/exception/InvalidPasswordException.java similarity index 100% rename from core/src/main/java/dev/cloudeko/zenei/domain/exception/InvalidPasswordException.java rename to platform/src/main/java/dev/cloudeko/zenei/domain/exception/InvalidPasswordException.java diff --git a/core/src/main/java/dev/cloudeko/zenei/domain/exception/InvalidRefreshTokenException.java b/platform/src/main/java/dev/cloudeko/zenei/domain/exception/InvalidRefreshTokenException.java similarity index 100% rename from core/src/main/java/dev/cloudeko/zenei/domain/exception/InvalidRefreshTokenException.java rename to platform/src/main/java/dev/cloudeko/zenei/domain/exception/InvalidRefreshTokenException.java diff --git a/core/src/main/java/dev/cloudeko/zenei/domain/exception/InvalidUserLoginException.java b/platform/src/main/java/dev/cloudeko/zenei/domain/exception/InvalidUserLoginException.java similarity index 100% rename from core/src/main/java/dev/cloudeko/zenei/domain/exception/InvalidUserLoginException.java rename to platform/src/main/java/dev/cloudeko/zenei/domain/exception/InvalidUserLoginException.java diff --git a/core/src/main/java/dev/cloudeko/zenei/domain/exception/ModelValidationException.java b/platform/src/main/java/dev/cloudeko/zenei/domain/exception/ModelValidationException.java similarity index 100% rename from core/src/main/java/dev/cloudeko/zenei/domain/exception/ModelValidationException.java rename to platform/src/main/java/dev/cloudeko/zenei/domain/exception/ModelValidationException.java diff --git a/core/src/main/java/dev/cloudeko/zenei/domain/exception/UserNotFoundException.java b/platform/src/main/java/dev/cloudeko/zenei/domain/exception/UserNotFoundException.java similarity index 100% rename from core/src/main/java/dev/cloudeko/zenei/domain/exception/UserNotFoundException.java rename to platform/src/main/java/dev/cloudeko/zenei/domain/exception/UserNotFoundException.java diff --git a/core/src/main/java/dev/cloudeko/zenei/domain/exception/UsernameAlreadyExistsException.java b/platform/src/main/java/dev/cloudeko/zenei/domain/exception/UsernameAlreadyExistsException.java similarity index 100% rename from core/src/main/java/dev/cloudeko/zenei/domain/exception/UsernameAlreadyExistsException.java rename to platform/src/main/java/dev/cloudeko/zenei/domain/exception/UsernameAlreadyExistsException.java diff --git a/core/src/main/java/dev/cloudeko/zenei/domain/feature/CreateDefaultUser.java b/platform/src/main/java/dev/cloudeko/zenei/domain/feature/CreateDefaultUser.java similarity index 100% rename from core/src/main/java/dev/cloudeko/zenei/domain/feature/CreateDefaultUser.java rename to platform/src/main/java/dev/cloudeko/zenei/domain/feature/CreateDefaultUser.java diff --git a/core/src/main/java/dev/cloudeko/zenei/domain/feature/CreateUser.java b/platform/src/main/java/dev/cloudeko/zenei/domain/feature/CreateUser.java similarity index 100% rename from core/src/main/java/dev/cloudeko/zenei/domain/feature/CreateUser.java rename to platform/src/main/java/dev/cloudeko/zenei/domain/feature/CreateUser.java diff --git a/core/src/main/java/dev/cloudeko/zenei/domain/feature/FindUserByIdentifier.java b/platform/src/main/java/dev/cloudeko/zenei/domain/feature/FindUserByIdentifier.java similarity index 100% rename from core/src/main/java/dev/cloudeko/zenei/domain/feature/FindUserByIdentifier.java rename to platform/src/main/java/dev/cloudeko/zenei/domain/feature/FindUserByIdentifier.java diff --git a/core/src/main/java/dev/cloudeko/zenei/domain/feature/ListExternalAccessTokens.java b/platform/src/main/java/dev/cloudeko/zenei/domain/feature/ListExternalAccessTokens.java similarity index 100% rename from core/src/main/java/dev/cloudeko/zenei/domain/feature/ListExternalAccessTokens.java rename to platform/src/main/java/dev/cloudeko/zenei/domain/feature/ListExternalAccessTokens.java diff --git a/core/src/main/java/dev/cloudeko/zenei/domain/feature/ListUsers.java b/platform/src/main/java/dev/cloudeko/zenei/domain/feature/ListUsers.java similarity index 100% rename from core/src/main/java/dev/cloudeko/zenei/domain/feature/ListUsers.java rename to platform/src/main/java/dev/cloudeko/zenei/domain/feature/ListUsers.java diff --git a/core/src/main/java/dev/cloudeko/zenei/domain/feature/LoginUserWithAuthorizationCode.java b/platform/src/main/java/dev/cloudeko/zenei/domain/feature/LoginUserWithAuthorizationCode.java similarity index 100% rename from core/src/main/java/dev/cloudeko/zenei/domain/feature/LoginUserWithAuthorizationCode.java rename to platform/src/main/java/dev/cloudeko/zenei/domain/feature/LoginUserWithAuthorizationCode.java diff --git a/core/src/main/java/dev/cloudeko/zenei/domain/feature/LoginUserWithPassword.java b/platform/src/main/java/dev/cloudeko/zenei/domain/feature/LoginUserWithPassword.java similarity index 100% rename from core/src/main/java/dev/cloudeko/zenei/domain/feature/LoginUserWithPassword.java rename to platform/src/main/java/dev/cloudeko/zenei/domain/feature/LoginUserWithPassword.java diff --git a/core/src/main/java/dev/cloudeko/zenei/domain/feature/RefreshAccessToken.java b/platform/src/main/java/dev/cloudeko/zenei/domain/feature/RefreshAccessToken.java similarity index 100% rename from core/src/main/java/dev/cloudeko/zenei/domain/feature/RefreshAccessToken.java rename to platform/src/main/java/dev/cloudeko/zenei/domain/feature/RefreshAccessToken.java diff --git a/core/src/main/java/dev/cloudeko/zenei/domain/feature/SendMagicLinkVerifyEmail.java b/platform/src/main/java/dev/cloudeko/zenei/domain/feature/SendMagicLinkVerifyEmail.java similarity index 100% rename from core/src/main/java/dev/cloudeko/zenei/domain/feature/SendMagicLinkVerifyEmail.java rename to platform/src/main/java/dev/cloudeko/zenei/domain/feature/SendMagicLinkVerifyEmail.java diff --git a/core/src/main/java/dev/cloudeko/zenei/domain/feature/VerifyMagicLink.java b/platform/src/main/java/dev/cloudeko/zenei/domain/feature/VerifyMagicLink.java similarity index 100% rename from core/src/main/java/dev/cloudeko/zenei/domain/feature/VerifyMagicLink.java rename to platform/src/main/java/dev/cloudeko/zenei/domain/feature/VerifyMagicLink.java diff --git a/core/src/main/java/dev/cloudeko/zenei/domain/feature/impl/CreateDefaultUserImpl.java b/platform/src/main/java/dev/cloudeko/zenei/domain/feature/impl/CreateDefaultUserImpl.java similarity index 100% rename from core/src/main/java/dev/cloudeko/zenei/domain/feature/impl/CreateDefaultUserImpl.java rename to platform/src/main/java/dev/cloudeko/zenei/domain/feature/impl/CreateDefaultUserImpl.java diff --git a/core/src/main/java/dev/cloudeko/zenei/domain/feature/impl/CreateUserImpl.java b/platform/src/main/java/dev/cloudeko/zenei/domain/feature/impl/CreateUserImpl.java similarity index 100% rename from core/src/main/java/dev/cloudeko/zenei/domain/feature/impl/CreateUserImpl.java rename to platform/src/main/java/dev/cloudeko/zenei/domain/feature/impl/CreateUserImpl.java diff --git a/core/src/main/java/dev/cloudeko/zenei/domain/feature/impl/FindUserByIdentifierImpl.java b/platform/src/main/java/dev/cloudeko/zenei/domain/feature/impl/FindUserByIdentifierImpl.java similarity index 100% rename from core/src/main/java/dev/cloudeko/zenei/domain/feature/impl/FindUserByIdentifierImpl.java rename to platform/src/main/java/dev/cloudeko/zenei/domain/feature/impl/FindUserByIdentifierImpl.java diff --git a/core/src/main/java/dev/cloudeko/zenei/domain/feature/impl/ListExternalAccessTokensImpl.java b/platform/src/main/java/dev/cloudeko/zenei/domain/feature/impl/ListExternalAccessTokensImpl.java similarity index 84% rename from core/src/main/java/dev/cloudeko/zenei/domain/feature/impl/ListExternalAccessTokensImpl.java rename to platform/src/main/java/dev/cloudeko/zenei/domain/feature/impl/ListExternalAccessTokensImpl.java index b9b1873..9e96b92 100644 --- a/core/src/main/java/dev/cloudeko/zenei/domain/feature/impl/ListExternalAccessTokensImpl.java +++ b/platform/src/main/java/dev/cloudeko/zenei/domain/feature/impl/ListExternalAccessTokensImpl.java @@ -1,7 +1,6 @@ package dev.cloudeko.zenei.domain.feature.impl; import dev.cloudeko.zenei.domain.feature.ListExternalAccessTokens; -import dev.cloudeko.zenei.domain.mapping.ExternalAccessTokenMapper; import dev.cloudeko.zenei.extension.core.model.account.ExternalAccessToken; import dev.cloudeko.zenei.extension.core.repository.ExternalAccessTokenRepository; import jakarta.enterprise.context.ApplicationScoped; @@ -13,7 +12,6 @@ @AllArgsConstructor public class ListExternalAccessTokensImpl implements ListExternalAccessTokens { - private final ExternalAccessTokenMapper externalAccessTokenMapper; private final ExternalAccessTokenRepository externalAccessTokenRepository; @Override diff --git a/core/src/main/java/dev/cloudeko/zenei/domain/feature/impl/ListUsersImpl.java b/platform/src/main/java/dev/cloudeko/zenei/domain/feature/impl/ListUsersImpl.java similarity index 100% rename from core/src/main/java/dev/cloudeko/zenei/domain/feature/impl/ListUsersImpl.java rename to platform/src/main/java/dev/cloudeko/zenei/domain/feature/impl/ListUsersImpl.java diff --git a/core/src/main/java/dev/cloudeko/zenei/domain/feature/impl/LoginUserWithAuthorizationCodeImpl.java b/platform/src/main/java/dev/cloudeko/zenei/domain/feature/impl/LoginUserWithAuthorizationCodeImpl.java similarity index 100% rename from core/src/main/java/dev/cloudeko/zenei/domain/feature/impl/LoginUserWithAuthorizationCodeImpl.java rename to platform/src/main/java/dev/cloudeko/zenei/domain/feature/impl/LoginUserWithAuthorizationCodeImpl.java diff --git a/core/src/main/java/dev/cloudeko/zenei/domain/feature/impl/LoginUserWithPasswordImpl.java b/platform/src/main/java/dev/cloudeko/zenei/domain/feature/impl/LoginUserWithPasswordImpl.java similarity index 100% rename from core/src/main/java/dev/cloudeko/zenei/domain/feature/impl/LoginUserWithPasswordImpl.java rename to platform/src/main/java/dev/cloudeko/zenei/domain/feature/impl/LoginUserWithPasswordImpl.java diff --git a/core/src/main/java/dev/cloudeko/zenei/domain/feature/impl/RefreshAccessTokenImpl.java b/platform/src/main/java/dev/cloudeko/zenei/domain/feature/impl/RefreshAccessTokenImpl.java similarity index 94% rename from core/src/main/java/dev/cloudeko/zenei/domain/feature/impl/RefreshAccessTokenImpl.java rename to platform/src/main/java/dev/cloudeko/zenei/domain/feature/impl/RefreshAccessTokenImpl.java index f135c13..fe1592a 100644 --- a/core/src/main/java/dev/cloudeko/zenei/domain/feature/impl/RefreshAccessTokenImpl.java +++ b/platform/src/main/java/dev/cloudeko/zenei/domain/feature/impl/RefreshAccessTokenImpl.java @@ -36,6 +36,9 @@ public SessionToken handle(String token) { final var newRefreshToken = TokenUtil.createRefreshToken(user, refreshTokenData); final var newToken = refreshTokenRepository.swapRefreshToken(refreshToken.get(), newRefreshToken); + if (newToken == null) { + throw new InvalidRefreshTokenException(); + } return TokenUtil.createToken(user, accessTokenData, newRefreshToken); } diff --git a/core/src/main/java/dev/cloudeko/zenei/domain/feature/impl/SendMagicLinkVerifyEmailImpl.java b/platform/src/main/java/dev/cloudeko/zenei/domain/feature/impl/SendMagicLinkVerifyEmailImpl.java similarity index 100% rename from core/src/main/java/dev/cloudeko/zenei/domain/feature/impl/SendMagicLinkVerifyEmailImpl.java rename to platform/src/main/java/dev/cloudeko/zenei/domain/feature/impl/SendMagicLinkVerifyEmailImpl.java diff --git a/core/src/main/java/dev/cloudeko/zenei/domain/feature/impl/VerifyMagicLinkImpl.java b/platform/src/main/java/dev/cloudeko/zenei/domain/feature/impl/VerifyMagicLinkImpl.java similarity index 74% rename from core/src/main/java/dev/cloudeko/zenei/domain/feature/impl/VerifyMagicLinkImpl.java rename to platform/src/main/java/dev/cloudeko/zenei/domain/feature/impl/VerifyMagicLinkImpl.java index c96e00c..12dcaa6 100644 --- a/core/src/main/java/dev/cloudeko/zenei/domain/feature/impl/VerifyMagicLinkImpl.java +++ b/platform/src/main/java/dev/cloudeko/zenei/domain/feature/impl/VerifyMagicLinkImpl.java @@ -1,5 +1,6 @@ package dev.cloudeko.zenei.domain.feature.impl; +import dev.cloudeko.zenei.domain.exception.InvalidConfirmationTokenException; import dev.cloudeko.zenei.domain.feature.VerifyMagicLink; import dev.cloudeko.zenei.extension.core.model.email.VerifyMagicLinkInput; import dev.cloudeko.zenei.extension.core.repository.EmailAddressRepository; @@ -16,6 +17,8 @@ public class VerifyMagicLinkImpl implements VerifyMagicLink { @Override public void handle(VerifyMagicLinkInput input) { - emailAddressRepository.confirmEmailAddress(input.getToken()); + if (!emailAddressRepository.confirmEmailAddress(input.getToken())) { + throw new InvalidConfirmationTokenException(); + } } } diff --git a/core/src/main/java/dev/cloudeko/zenei/domain/feature/util/TokenUtil.java b/platform/src/main/java/dev/cloudeko/zenei/domain/feature/util/TokenUtil.java similarity index 100% rename from core/src/main/java/dev/cloudeko/zenei/domain/feature/util/TokenUtil.java rename to platform/src/main/java/dev/cloudeko/zenei/domain/feature/util/TokenUtil.java diff --git a/core/src/main/java/dev/cloudeko/zenei/domain/provider/HashProvider.java b/platform/src/main/java/dev/cloudeko/zenei/domain/provider/HashProvider.java similarity index 100% rename from core/src/main/java/dev/cloudeko/zenei/domain/provider/HashProvider.java rename to platform/src/main/java/dev/cloudeko/zenei/domain/provider/HashProvider.java diff --git a/core/src/main/java/dev/cloudeko/zenei/domain/provider/MailTemplateProvider.java b/platform/src/main/java/dev/cloudeko/zenei/domain/provider/MailTemplateProvider.java similarity index 100% rename from core/src/main/java/dev/cloudeko/zenei/domain/provider/MailTemplateProvider.java rename to platform/src/main/java/dev/cloudeko/zenei/domain/provider/MailTemplateProvider.java diff --git a/core/src/main/java/dev/cloudeko/zenei/domain/provider/RefreshTokenProvider.java b/platform/src/main/java/dev/cloudeko/zenei/domain/provider/RefreshTokenProvider.java similarity index 100% rename from core/src/main/java/dev/cloudeko/zenei/domain/provider/RefreshTokenProvider.java rename to platform/src/main/java/dev/cloudeko/zenei/domain/provider/RefreshTokenProvider.java diff --git a/core/src/main/java/dev/cloudeko/zenei/domain/provider/StringTokenProvider.java b/platform/src/main/java/dev/cloudeko/zenei/domain/provider/StringTokenProvider.java similarity index 100% rename from core/src/main/java/dev/cloudeko/zenei/domain/provider/StringTokenProvider.java rename to platform/src/main/java/dev/cloudeko/zenei/domain/provider/StringTokenProvider.java diff --git a/core/src/main/java/dev/cloudeko/zenei/domain/provider/TokenProvider.java b/platform/src/main/java/dev/cloudeko/zenei/domain/provider/TokenProvider.java similarity index 100% rename from core/src/main/java/dev/cloudeko/zenei/domain/provider/TokenProvider.java rename to platform/src/main/java/dev/cloudeko/zenei/domain/provider/TokenProvider.java diff --git a/core/src/main/java/dev/cloudeko/zenei/infrastructure/config/ApplicationConfig.java b/platform/src/main/java/dev/cloudeko/zenei/infrastructure/config/ApplicationConfig.java similarity index 100% rename from core/src/main/java/dev/cloudeko/zenei/infrastructure/config/ApplicationConfig.java rename to platform/src/main/java/dev/cloudeko/zenei/infrastructure/config/ApplicationConfig.java diff --git a/core/src/main/java/dev/cloudeko/zenei/infrastructure/config/ApplicationStartupConfiguration.java b/platform/src/main/java/dev/cloudeko/zenei/infrastructure/config/ApplicationStartupConfiguration.java similarity index 100% rename from core/src/main/java/dev/cloudeko/zenei/infrastructure/config/ApplicationStartupConfiguration.java rename to platform/src/main/java/dev/cloudeko/zenei/infrastructure/config/ApplicationStartupConfiguration.java diff --git a/core/src/main/java/dev/cloudeko/zenei/infrastructure/config/ConfigFallbackInterceptor.java b/platform/src/main/java/dev/cloudeko/zenei/infrastructure/config/ConfigFallbackInterceptor.java similarity index 100% rename from core/src/main/java/dev/cloudeko/zenei/infrastructure/config/ConfigFallbackInterceptor.java rename to platform/src/main/java/dev/cloudeko/zenei/infrastructure/config/ConfigFallbackInterceptor.java diff --git a/core/src/main/java/dev/cloudeko/zenei/infrastructure/config/DefaultUserConfig.java b/platform/src/main/java/dev/cloudeko/zenei/infrastructure/config/DefaultUserConfig.java similarity index 100% rename from core/src/main/java/dev/cloudeko/zenei/infrastructure/config/DefaultUserConfig.java rename to platform/src/main/java/dev/cloudeko/zenei/infrastructure/config/DefaultUserConfig.java diff --git a/core/src/main/java/dev/cloudeko/zenei/infrastructure/config/DefaultUsersConfig.java b/platform/src/main/java/dev/cloudeko/zenei/infrastructure/config/DefaultUsersConfig.java similarity index 100% rename from core/src/main/java/dev/cloudeko/zenei/infrastructure/config/DefaultUsersConfig.java rename to platform/src/main/java/dev/cloudeko/zenei/infrastructure/config/DefaultUsersConfig.java diff --git a/core/src/main/java/dev/cloudeko/zenei/infrastructure/provider/BCryptHashProvider.java b/platform/src/main/java/dev/cloudeko/zenei/infrastructure/provider/BCryptHashProvider.java similarity index 100% rename from core/src/main/java/dev/cloudeko/zenei/infrastructure/provider/BCryptHashProvider.java rename to platform/src/main/java/dev/cloudeko/zenei/infrastructure/provider/BCryptHashProvider.java diff --git a/core/src/main/java/dev/cloudeko/zenei/infrastructure/provider/BCryptRefreshTokenProvider.java b/platform/src/main/java/dev/cloudeko/zenei/infrastructure/provider/BCryptRefreshTokenProvider.java similarity index 100% rename from core/src/main/java/dev/cloudeko/zenei/infrastructure/provider/BCryptRefreshTokenProvider.java rename to platform/src/main/java/dev/cloudeko/zenei/infrastructure/provider/BCryptRefreshTokenProvider.java diff --git a/core/src/main/java/dev/cloudeko/zenei/infrastructure/provider/BCryptStringTokenProvider.java b/platform/src/main/java/dev/cloudeko/zenei/infrastructure/provider/BCryptStringTokenProvider.java similarity index 100% rename from core/src/main/java/dev/cloudeko/zenei/infrastructure/provider/BCryptStringTokenProvider.java rename to platform/src/main/java/dev/cloudeko/zenei/infrastructure/provider/BCryptStringTokenProvider.java diff --git a/core/src/main/java/dev/cloudeko/zenei/infrastructure/provider/DefaultMailTemplateProvider.java b/platform/src/main/java/dev/cloudeko/zenei/infrastructure/provider/DefaultMailTemplateProvider.java similarity index 100% rename from core/src/main/java/dev/cloudeko/zenei/infrastructure/provider/DefaultMailTemplateProvider.java rename to platform/src/main/java/dev/cloudeko/zenei/infrastructure/provider/DefaultMailTemplateProvider.java diff --git a/core/src/main/java/dev/cloudeko/zenei/infrastructure/provider/JwtTokenProvider.java b/platform/src/main/java/dev/cloudeko/zenei/infrastructure/provider/JwtTokenProvider.java similarity index 100% rename from core/src/main/java/dev/cloudeko/zenei/infrastructure/provider/JwtTokenProvider.java rename to platform/src/main/java/dev/cloudeko/zenei/infrastructure/provider/JwtTokenProvider.java diff --git a/core/src/main/java/dev/cloudeko/zenei/infrastructure/web/mapper/BusinessExceptionMapper.java b/platform/src/main/java/dev/cloudeko/zenei/infrastructure/web/mapper/BusinessExceptionMapper.java similarity index 100% rename from core/src/main/java/dev/cloudeko/zenei/infrastructure/web/mapper/BusinessExceptionMapper.java rename to platform/src/main/java/dev/cloudeko/zenei/infrastructure/web/mapper/BusinessExceptionMapper.java diff --git a/core/src/main/resources/META-INF/services/io.smallrye.config.ConfigSourceInterceptor b/platform/src/main/resources/META-INF/services/io.smallrye.config.ConfigSourceInterceptor similarity index 100% rename from core/src/main/resources/META-INF/services/io.smallrye.config.ConfigSourceInterceptor rename to platform/src/main/resources/META-INF/services/io.smallrye.config.ConfigSourceInterceptor diff --git a/core/src/main/resources/application-common.properties b/platform/src/main/resources/application-common.properties similarity index 100% rename from core/src/main/resources/application-common.properties rename to platform/src/main/resources/application-common.properties diff --git a/core/src/main/resources/application-dev.properties b/platform/src/main/resources/application-dev.properties similarity index 100% rename from core/src/main/resources/application-dev.properties rename to platform/src/main/resources/application-dev.properties diff --git a/core/src/main/resources/application-providers.properties b/platform/src/main/resources/application-providers.properties similarity index 100% rename from core/src/main/resources/application-providers.properties rename to platform/src/main/resources/application-providers.properties diff --git a/core/src/main/resources/application-test.properties b/platform/src/main/resources/application-test.properties similarity index 100% rename from core/src/main/resources/application-test.properties rename to platform/src/main/resources/application-test.properties diff --git a/core/src/main/resources/application.properties b/platform/src/main/resources/application.properties similarity index 100% rename from core/src/main/resources/application.properties rename to platform/src/main/resources/application.properties diff --git a/core/src/main/resources/zenei_banner.txt b/platform/src/main/resources/zenei_banner.txt similarity index 100% rename from core/src/main/resources/zenei_banner.txt rename to platform/src/main/resources/zenei_banner.txt diff --git a/core/src/test/java/dev/cloudeko/zenei/auth/AuthenticationFlowWithAdminUserTest.java b/platform/src/test/java/dev/cloudeko/zenei/auth/AuthenticationFlowWithAdminUserTest.java similarity index 100% rename from core/src/test/java/dev/cloudeko/zenei/auth/AuthenticationFlowWithAdminUserTest.java rename to platform/src/test/java/dev/cloudeko/zenei/auth/AuthenticationFlowWithAdminUserTest.java diff --git a/core/src/test/java/dev/cloudeko/zenei/auth/AuthenticationFlowWithDisabledMailingTest.java b/platform/src/test/java/dev/cloudeko/zenei/auth/AuthenticationFlowWithDisabledMailingTest.java similarity index 100% rename from core/src/test/java/dev/cloudeko/zenei/auth/AuthenticationFlowWithDisabledMailingTest.java rename to platform/src/test/java/dev/cloudeko/zenei/auth/AuthenticationFlowWithDisabledMailingTest.java diff --git a/core/src/test/java/dev/cloudeko/zenei/auth/AuthenticationFlowWithDisabledSignupTest.java b/platform/src/test/java/dev/cloudeko/zenei/auth/AuthenticationFlowWithDisabledSignupTest.java similarity index 100% rename from core/src/test/java/dev/cloudeko/zenei/auth/AuthenticationFlowWithDisabledSignupTest.java rename to platform/src/test/java/dev/cloudeko/zenei/auth/AuthenticationFlowWithDisabledSignupTest.java diff --git a/core/src/test/java/dev/cloudeko/zenei/auth/AuthenticationFlowWithEnabledMailingTest.java b/platform/src/test/java/dev/cloudeko/zenei/auth/AuthenticationFlowWithEnabledMailingTest.java similarity index 100% rename from core/src/test/java/dev/cloudeko/zenei/auth/AuthenticationFlowWithEnabledMailingTest.java rename to platform/src/test/java/dev/cloudeko/zenei/auth/AuthenticationFlowWithEnabledMailingTest.java diff --git a/core/src/test/java/dev/cloudeko/zenei/auth/AuthenticationFlowWithExternalProviderTest.java b/platform/src/test/java/dev/cloudeko/zenei/auth/AuthenticationFlowWithExternalProviderTest.java similarity index 100% rename from core/src/test/java/dev/cloudeko/zenei/auth/AuthenticationFlowWithExternalProviderTest.java rename to platform/src/test/java/dev/cloudeko/zenei/auth/AuthenticationFlowWithExternalProviderTest.java diff --git a/core/src/test/java/dev/cloudeko/zenei/profile/DefaultAdminUserProfile.java b/platform/src/test/java/dev/cloudeko/zenei/profile/DefaultAdminUserProfile.java similarity index 100% rename from core/src/test/java/dev/cloudeko/zenei/profile/DefaultAdminUserProfile.java rename to platform/src/test/java/dev/cloudeko/zenei/profile/DefaultAdminUserProfile.java diff --git a/core/src/test/java/dev/cloudeko/zenei/profile/MailingDisabledProfile.java b/platform/src/test/java/dev/cloudeko/zenei/profile/MailingDisabledProfile.java similarity index 100% rename from core/src/test/java/dev/cloudeko/zenei/profile/MailingDisabledProfile.java rename to platform/src/test/java/dev/cloudeko/zenei/profile/MailingDisabledProfile.java diff --git a/core/src/test/java/dev/cloudeko/zenei/profile/MailingEnabledProfile.java b/platform/src/test/java/dev/cloudeko/zenei/profile/MailingEnabledProfile.java similarity index 100% rename from core/src/test/java/dev/cloudeko/zenei/profile/MailingEnabledProfile.java rename to platform/src/test/java/dev/cloudeko/zenei/profile/MailingEnabledProfile.java diff --git a/core/src/test/java/dev/cloudeko/zenei/profile/RestrictedAuthenticationProfile.java b/platform/src/test/java/dev/cloudeko/zenei/profile/RestrictedAuthenticationProfile.java similarity index 100% rename from core/src/test/java/dev/cloudeko/zenei/profile/RestrictedAuthenticationProfile.java rename to platform/src/test/java/dev/cloudeko/zenei/profile/RestrictedAuthenticationProfile.java diff --git a/core/src/test/java/dev/cloudeko/zenei/resource/AbstractMockAuthorizationServerTestResource.java b/platform/src/test/java/dev/cloudeko/zenei/resource/AbstractMockAuthorizationServerTestResource.java similarity index 100% rename from core/src/test/java/dev/cloudeko/zenei/resource/AbstractMockAuthorizationServerTestResource.java rename to platform/src/test/java/dev/cloudeko/zenei/resource/AbstractMockAuthorizationServerTestResource.java diff --git a/core/src/test/java/dev/cloudeko/zenei/resource/MockDiscordAuthorizationServerTestResource.java b/platform/src/test/java/dev/cloudeko/zenei/resource/MockDiscordAuthorizationServerTestResource.java similarity index 100% rename from core/src/test/java/dev/cloudeko/zenei/resource/MockDiscordAuthorizationServerTestResource.java rename to platform/src/test/java/dev/cloudeko/zenei/resource/MockDiscordAuthorizationServerTestResource.java diff --git a/core/src/test/java/dev/cloudeko/zenei/resource/MockGithubAuthorizationServerTestResource.java b/platform/src/test/java/dev/cloudeko/zenei/resource/MockGithubAuthorizationServerTestResource.java similarity index 100% rename from core/src/test/java/dev/cloudeko/zenei/resource/MockGithubAuthorizationServerTestResource.java rename to platform/src/test/java/dev/cloudeko/zenei/resource/MockGithubAuthorizationServerTestResource.java diff --git a/core/src/test/java/dev/cloudeko/zenei/resource/MockGoogleAuthorizationServerTestResource.java b/platform/src/test/java/dev/cloudeko/zenei/resource/MockGoogleAuthorizationServerTestResource.java similarity index 100% rename from core/src/test/java/dev/cloudeko/zenei/resource/MockGoogleAuthorizationServerTestResource.java rename to platform/src/test/java/dev/cloudeko/zenei/resource/MockGoogleAuthorizationServerTestResource.java diff --git a/core/src/test/java/dev/cloudeko/zenei/resource/MockServerResource.java b/platform/src/test/java/dev/cloudeko/zenei/resource/MockServerResource.java similarity index 100% rename from core/src/test/java/dev/cloudeko/zenei/resource/MockServerResource.java rename to platform/src/test/java/dev/cloudeko/zenei/resource/MockServerResource.java diff --git a/core/src/test/java/dev/cloudeko/zenei/resource/TestProviderFeature.java b/platform/src/test/java/dev/cloudeko/zenei/resource/TestProviderFeature.java similarity index 100% rename from core/src/test/java/dev/cloudeko/zenei/resource/TestProviderFeature.java rename to platform/src/test/java/dev/cloudeko/zenei/resource/TestProviderFeature.java diff --git a/pom.xml b/pom.xml index 251992f..873dc21 100644 --- a/pom.xml +++ b/pom.xml @@ -13,7 +13,7 @@ extensions - core + platform @@ -52,19 +52,34 @@ dev.cloudeko - external-authentication + core-extension + ${project.version} + + + dev.cloudeko + core-extension-deployment ${project.version} dev.cloudeko - core-extension + jdbc-panache-extension + ${project.version} + + + dev.cloudeko + jdbc-panache-extension-deployment ${project.version} dev.cloudeko - external-authentication-deployment + external-authentication-extension + ${project.version} + + + dev.cloudeko + external-authentication-extension-deployment ${project.version}