Skip to content

Commit

Permalink
feat(core): moved the logic into a core
Browse files Browse the repository at this point in the history
  • Loading branch information
zZHorizonZz committed Aug 20, 2024
1 parent 6572058 commit e8515e7
Show file tree
Hide file tree
Showing 55 changed files with 152 additions and 108 deletions.
25 changes: 25 additions & 0 deletions extensions/core/deployment/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,35 @@
<artifactId>core-extension-deployment</artifactId>

<dependencies>
<dependency>
<groupId>dev.cloudeko</groupId>
<artifactId>external-authentication-extension-deployment</artifactId>
</dependency>

<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-arc-deployment</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-mailer-deployment</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-smallrye-jwt-deployment</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-smallrye-jwt-build-deployment</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-security-deployment</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-elytron-security-common-deployment</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-rest-jackson-deployment</artifactId>
Expand Down
25 changes: 25 additions & 0 deletions extensions/core/runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,35 @@
<artifactId>core-extension</artifactId>

<dependencies>
<dependency>
<groupId>dev.cloudeko</groupId>
<artifactId>external-authentication-extension</artifactId>
</dependency>

<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-arc</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-mailer</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-smallrye-jwt</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-smallrye-jwt-build</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-security</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-elytron-security-common</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-rest-jackson</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dev.cloudeko.zenei.infrastructure.config;
package dev.cloudeko.zenei.extension.core.config;

import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dev.cloudeko.zenei.infrastructure.config;
package dev.cloudeko.zenei.extension.core.config;

import java.util.Optional;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dev.cloudeko.zenei.infrastructure.config;
package dev.cloudeko.zenei.extension.core.config;

import io.smallrye.config.ConfigMapping;
import io.smallrye.config.WithParentName;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dev.cloudeko.zenei.domain.exception;
package dev.cloudeko.zenei.extension.core.exception;

import lombok.Data;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dev.cloudeko.zenei.domain.exception;
package dev.cloudeko.zenei.extension.core.exception;

public class EmailAlreadyExistsException extends BusinessException {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dev.cloudeko.zenei.domain.exception;
package dev.cloudeko.zenei.extension.core.exception;

public class EmailNotFoundException extends BusinessException {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dev.cloudeko.zenei.domain.exception;
package dev.cloudeko.zenei.extension.core.exception;

public class InvalidConfirmationTokenException extends BusinessException {
public InvalidConfirmationTokenException() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dev.cloudeko.zenei.domain.exception;
package dev.cloudeko.zenei.extension.core.exception;

public class InvalidExternalAuthProvider extends BusinessException {
public InvalidExternalAuthProvider() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dev.cloudeko.zenei.domain.exception;
package dev.cloudeko.zenei.extension.core.exception;

public class InvalidPasswordException extends BusinessException {
public InvalidPasswordException() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dev.cloudeko.zenei.domain.exception;
package dev.cloudeko.zenei.extension.core.exception;

public class InvalidRefreshTokenException extends BusinessException {
public InvalidRefreshTokenException() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dev.cloudeko.zenei.domain.exception;
package dev.cloudeko.zenei.extension.core.exception;

public class InvalidUserLoginException extends BusinessException {
public InvalidUserLoginException() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
package dev.cloudeko.zenei.domain.exception;
package dev.cloudeko.zenei.extension.core.exception;

import java.util.List;

public class ModelValidationException extends BusinessException {

public ModelValidationException(List<String> messages) {
super(8, messages);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package dev.cloudeko.zenei.domain.exception;
package dev.cloudeko.zenei.extension.core.exception;

public class UserNotFoundException extends BusinessException {

public UserNotFoundException() {
super(1, "user not found");
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dev.cloudeko.zenei.domain.exception;
package dev.cloudeko.zenei.extension.core.exception;

public class UsernameAlreadyExistsException extends BusinessException {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package dev.cloudeko.zenei.domain.feature;
package dev.cloudeko.zenei.extension.core.feature;

import dev.cloudeko.zenei.infrastructure.config.DefaultUserConfig;
import dev.cloudeko.zenei.extension.core.config.DefaultUserConfig;

/**
* The {@code CreateDefaultUser} interface represents a contract for creating a default user based on a configuration. It
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dev.cloudeko.zenei.domain.feature;
package dev.cloudeko.zenei.extension.core.feature;

import dev.cloudeko.zenei.extension.core.model.user.CreateUserInput;
import dev.cloudeko.zenei.extension.core.model.user.User;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dev.cloudeko.zenei.domain.feature;
package dev.cloudeko.zenei.extension.core.feature;

import dev.cloudeko.zenei.extension.core.model.user.User;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dev.cloudeko.zenei.domain.feature;
package dev.cloudeko.zenei.extension.core.feature;

import dev.cloudeko.zenei.extension.core.model.account.ExternalAccessToken;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dev.cloudeko.zenei.domain.feature;
package dev.cloudeko.zenei.extension.core.feature;

import dev.cloudeko.zenei.extension.core.model.user.User;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dev.cloudeko.zenei.domain.feature;
package dev.cloudeko.zenei.extension.core.feature;

import dev.cloudeko.zenei.extension.core.model.session.SessionToken;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dev.cloudeko.zenei.domain.feature;
package dev.cloudeko.zenei.extension.core.feature;

import dev.cloudeko.zenei.extension.core.model.session.SessionToken;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dev.cloudeko.zenei.domain.feature;
package dev.cloudeko.zenei.extension.core.feature;

import dev.cloudeko.zenei.extension.core.model.session.SessionToken;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dev.cloudeko.zenei.domain.feature;
package dev.cloudeko.zenei.extension.core.feature;

import dev.cloudeko.zenei.extension.core.model.email.EmailAddressInput;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dev.cloudeko.zenei.domain.feature;
package dev.cloudeko.zenei.extension.core.feature;

import dev.cloudeko.zenei.extension.core.model.email.VerifyMagicLinkInput;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package dev.cloudeko.zenei.domain.feature.impl;
package dev.cloudeko.zenei.extension.core.feature.impl;

import dev.cloudeko.zenei.domain.feature.CreateDefaultUser;
import dev.cloudeko.zenei.domain.provider.HashProvider;
import dev.cloudeko.zenei.extension.core.config.DefaultUserConfig;
import dev.cloudeko.zenei.extension.core.feature.CreateDefaultUser;
import dev.cloudeko.zenei.extension.core.provider.HashProvider;
import dev.cloudeko.zenei.extension.core.model.email.EmailAddress;
import dev.cloudeko.zenei.extension.core.model.user.User;
import dev.cloudeko.zenei.extension.core.model.user.UserPassword;
import dev.cloudeko.zenei.extension.core.repository.UserPasswordRepository;
import dev.cloudeko.zenei.extension.core.repository.UserRepository;
import dev.cloudeko.zenei.infrastructure.config.DefaultUserConfig;
import jakarta.enterprise.context.ApplicationScoped;
import lombok.AllArgsConstructor;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
package dev.cloudeko.zenei.domain.feature.impl;

import dev.cloudeko.zenei.domain.exception.EmailAlreadyExistsException;
import dev.cloudeko.zenei.domain.exception.UsernameAlreadyExistsException;
import dev.cloudeko.zenei.domain.feature.CreateUser;
import dev.cloudeko.zenei.domain.provider.HashProvider;
import dev.cloudeko.zenei.domain.provider.StringTokenProvider;
package dev.cloudeko.zenei.extension.core.feature.impl;

import dev.cloudeko.zenei.extension.core.config.ApplicationConfig;
import dev.cloudeko.zenei.extension.core.exception.EmailAlreadyExistsException;
import dev.cloudeko.zenei.extension.core.exception.UsernameAlreadyExistsException;
import dev.cloudeko.zenei.extension.core.feature.CreateUser;
import dev.cloudeko.zenei.extension.core.provider.HashProvider;
import dev.cloudeko.zenei.extension.core.provider.StringTokenProvider;
import dev.cloudeko.zenei.extension.core.model.email.EmailAddress;
import dev.cloudeko.zenei.extension.core.model.user.CreateUserInput;
import dev.cloudeko.zenei.extension.core.model.user.User;
import dev.cloudeko.zenei.extension.core.model.user.UserPassword;
import dev.cloudeko.zenei.extension.core.repository.UserPasswordRepository;
import dev.cloudeko.zenei.extension.core.repository.UserRepository;
import dev.cloudeko.zenei.infrastructure.config.ApplicationConfig;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.transaction.Transactional;
import lombok.AllArgsConstructor;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package dev.cloudeko.zenei.domain.feature.impl;
package dev.cloudeko.zenei.extension.core.feature.impl;

import dev.cloudeko.zenei.domain.exception.UserNotFoundException;
import dev.cloudeko.zenei.domain.feature.FindUserByIdentifier;
import dev.cloudeko.zenei.extension.core.exception.UserNotFoundException;
import dev.cloudeko.zenei.extension.core.feature.FindUserByIdentifier;
import dev.cloudeko.zenei.extension.core.model.user.User;
import dev.cloudeko.zenei.extension.core.repository.UserRepository;
import jakarta.enterprise.context.ApplicationScoped;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package dev.cloudeko.zenei.domain.feature.impl;
package dev.cloudeko.zenei.extension.core.feature.impl;

import dev.cloudeko.zenei.domain.feature.ListExternalAccessTokens;
import dev.cloudeko.zenei.extension.core.feature.ListExternalAccessTokens;
import dev.cloudeko.zenei.extension.core.model.account.ExternalAccessToken;
import dev.cloudeko.zenei.extension.core.repository.ExternalAccessTokenRepository;
import jakarta.enterprise.context.ApplicationScoped;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package dev.cloudeko.zenei.domain.feature.impl;
package dev.cloudeko.zenei.extension.core.feature.impl;

import dev.cloudeko.zenei.domain.feature.ListUsers;
import dev.cloudeko.zenei.extension.core.feature.ListUsers;
import dev.cloudeko.zenei.extension.core.model.user.User;
import dev.cloudeko.zenei.extension.core.repository.UserRepository;
import jakarta.enterprise.context.ApplicationScoped;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
package dev.cloudeko.zenei.domain.feature.impl;

import dev.cloudeko.zenei.domain.exception.EmailAlreadyExistsException;
import dev.cloudeko.zenei.domain.exception.EmailNotFoundException;
import dev.cloudeko.zenei.domain.exception.InvalidExternalAuthProvider;
import dev.cloudeko.zenei.domain.exception.UsernameAlreadyExistsException;
import dev.cloudeko.zenei.domain.feature.LoginUserWithAuthorizationCode;
import dev.cloudeko.zenei.domain.feature.util.TokenUtil;
import dev.cloudeko.zenei.domain.provider.HashProvider;
import dev.cloudeko.zenei.domain.provider.RefreshTokenProvider;
import dev.cloudeko.zenei.domain.provider.TokenProvider;
package dev.cloudeko.zenei.extension.core.feature.impl;

import dev.cloudeko.zenei.extension.core.config.ApplicationConfig;
import dev.cloudeko.zenei.extension.core.exception.EmailAlreadyExistsException;
import dev.cloudeko.zenei.extension.core.exception.EmailNotFoundException;
import dev.cloudeko.zenei.extension.core.exception.InvalidExternalAuthProvider;
import dev.cloudeko.zenei.extension.core.exception.UsernameAlreadyExistsException;
import dev.cloudeko.zenei.extension.core.feature.LoginUserWithAuthorizationCode;
import dev.cloudeko.zenei.extension.core.feature.util.TokenUtil;
import dev.cloudeko.zenei.extension.core.provider.HashProvider;
import dev.cloudeko.zenei.extension.core.provider.RefreshTokenProvider;
import dev.cloudeko.zenei.extension.core.provider.TokenProvider;
import dev.cloudeko.zenei.extension.core.model.account.ExternalAccessToken;
import dev.cloudeko.zenei.extension.core.model.account.ExternalAccount;
import dev.cloudeko.zenei.extension.core.model.email.EmailAddress;
Expand All @@ -23,7 +24,6 @@
import dev.cloudeko.zenei.extension.external.providers.AvailableProvider;
import dev.cloudeko.zenei.extension.external.web.client.ExternalProviderAccessToken;
import dev.cloudeko.zenei.extension.external.web.client.LoginOAuthClient;
import dev.cloudeko.zenei.infrastructure.config.ApplicationConfig;
import io.quarkus.rest.client.reactive.QuarkusRestClientBuilder;
import jakarta.enterprise.context.ApplicationScoped;
import lombok.AllArgsConstructor;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package dev.cloudeko.zenei.domain.feature.impl;

import dev.cloudeko.zenei.domain.exception.InvalidPasswordException;
import dev.cloudeko.zenei.domain.exception.UserNotFoundException;
import dev.cloudeko.zenei.domain.feature.LoginUserWithPassword;
import dev.cloudeko.zenei.domain.feature.util.TokenUtil;
import dev.cloudeko.zenei.domain.provider.HashProvider;
import dev.cloudeko.zenei.domain.provider.RefreshTokenProvider;
import dev.cloudeko.zenei.domain.provider.TokenProvider;
package dev.cloudeko.zenei.extension.core.feature.impl;

import dev.cloudeko.zenei.extension.core.exception.InvalidPasswordException;
import dev.cloudeko.zenei.extension.core.exception.UserNotFoundException;
import dev.cloudeko.zenei.extension.core.feature.LoginUserWithPassword;
import dev.cloudeko.zenei.extension.core.feature.util.TokenUtil;
import dev.cloudeko.zenei.extension.core.provider.HashProvider;
import dev.cloudeko.zenei.extension.core.provider.RefreshTokenProvider;
import dev.cloudeko.zenei.extension.core.provider.TokenProvider;
import dev.cloudeko.zenei.extension.core.model.session.SessionToken;
import dev.cloudeko.zenei.extension.core.repository.RefreshTokenRepository;
import dev.cloudeko.zenei.extension.core.repository.UserPasswordRepository;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package dev.cloudeko.zenei.domain.feature.impl;
package dev.cloudeko.zenei.extension.core.feature.impl;

import dev.cloudeko.zenei.domain.exception.InvalidRefreshTokenException;
import dev.cloudeko.zenei.domain.feature.RefreshAccessToken;
import dev.cloudeko.zenei.domain.feature.util.TokenUtil;
import dev.cloudeko.zenei.domain.provider.RefreshTokenProvider;
import dev.cloudeko.zenei.domain.provider.TokenProvider;
import dev.cloudeko.zenei.extension.core.exception.InvalidRefreshTokenException;
import dev.cloudeko.zenei.extension.core.feature.RefreshAccessToken;
import dev.cloudeko.zenei.extension.core.feature.util.TokenUtil;
import dev.cloudeko.zenei.extension.core.provider.RefreshTokenProvider;
import dev.cloudeko.zenei.extension.core.provider.TokenProvider;
import dev.cloudeko.zenei.extension.core.model.session.SessionToken;
import dev.cloudeko.zenei.extension.core.repository.RefreshTokenRepository;
import dev.cloudeko.zenei.extension.core.repository.UserRepository;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package dev.cloudeko.zenei.domain.feature.impl;
package dev.cloudeko.zenei.extension.core.feature.impl;

import dev.cloudeko.zenei.domain.feature.SendMagicLinkVerifyEmail;
import dev.cloudeko.zenei.domain.provider.MailTemplateProvider;
import dev.cloudeko.zenei.domain.provider.StringTokenProvider;
import dev.cloudeko.zenei.extension.core.feature.SendMagicLinkVerifyEmail;
import dev.cloudeko.zenei.extension.core.provider.MailTemplateProvider;
import dev.cloudeko.zenei.extension.core.provider.StringTokenProvider;
import dev.cloudeko.zenei.extension.core.model.email.EmailAddressInput;
import dev.cloudeko.zenei.extension.core.repository.EmailAddressRepository;
import dev.cloudeko.zenei.extension.core.repository.UserRepository;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package dev.cloudeko.zenei.domain.feature.impl;
package dev.cloudeko.zenei.extension.core.feature.impl;

import dev.cloudeko.zenei.domain.exception.InvalidConfirmationTokenException;
import dev.cloudeko.zenei.domain.feature.VerifyMagicLink;
import dev.cloudeko.zenei.extension.core.exception.InvalidConfirmationTokenException;
import dev.cloudeko.zenei.extension.core.feature.VerifyMagicLink;
import dev.cloudeko.zenei.extension.core.model.email.VerifyMagicLinkInput;
import dev.cloudeko.zenei.extension.core.repository.EmailAddressRepository;
import jakarta.enterprise.context.ApplicationScoped;
Expand Down
Loading

0 comments on commit e8515e7

Please sign in to comment.