Skip to content

Commit d6f644e

Browse files
Merge pull request #53 from qbicsoftware/development
Prepare Release 0.4.0
2 parents 0b92b76 + 49ba2ba commit d6f644e

File tree

105 files changed

+1980
-710
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

105 files changed

+1980
-710
lines changed

.github/workflows/create-release.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
run: mvn versions:set -DnewVersion=${{ github.event.inputs.versionTag }}
3434

3535
- name: Build with Maven
36-
run: mvn -B package --file pom.xml
36+
run: mvn -B package -Pproduction --file pom.xml
3737

3838
- name: Create Release Notes
3939
if: ${{ !startsWith(github.ref, 'refs/tags/')

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,5 @@ drivers/
2525
# Error screenshots generated by TestBench for failed integration tests
2626
error-screenshots/
2727
webapp/webpack.generated.js
28+
/webapp/frontend/generated/theme.d.ts
29+
/target/

core/pom.xml

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<parent>
6+
<artifactId>datamanager</artifactId>
7+
<groupId>life.qbic</groupId>
8+
<version>0.3.0</version>
9+
</parent>
10+
<modelVersion>4.0.0</modelVersion>
11+
12+
<artifactId>datamanagement-core</artifactId>
13+
<name>Data Manager Core</name>
14+
15+
<dependencyManagement>
16+
<dependencies>
17+
<dependency>
18+
<groupId>javax.persistence</groupId>
19+
<artifactId>javax.persistence-api</artifactId>
20+
<version>2.2</version>
21+
</dependency>
22+
</dependencies>
23+
</dependencyManagement>
24+
<dependencies>
25+
<!-- https://mvnrepository.com/artifact/javax.persistence/javax.persistence-api -->
26+
<dependency>
27+
<groupId>javax.persistence</groupId>
28+
<artifactId>javax.persistence-api</artifactId>
29+
</dependency>
30+
<dependency>
31+
<groupId>org.spockframework</groupId>
32+
<artifactId>spock-core</artifactId>
33+
<scope>test</scope>
34+
</dependency>
35+
<dependency>
36+
<groupId>org.slf4j</groupId>
37+
<artifactId>slf4j-api</artifactId>
38+
</dependency>
39+
<dependency>
40+
<groupId>ch.qos.logback</groupId>
41+
<artifactId>logback-classic</artifactId>
42+
</dependency>
43+
</dependencies>
44+
</project>

domain/src/main/java/life/qbic/apps/datamanager/ApplicationException.java core/src/main/java/life/qbic/identityaccess/application/ApplicationException.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package life.qbic.apps.datamanager;
1+
package life.qbic.identityaccess.application;
22

33
/**
44
* <b><class short description - 1 Line!></b>

domain/src/main/java/life/qbic/apps/datamanager/services/ServiceException.java core/src/main/java/life/qbic/identityaccess/application/ServiceException.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package life.qbic.apps.datamanager.services;
1+
package life.qbic.identityaccess.application;
22

33
/**
44
* <b><class short description - 1 Line!></b>

domain/src/main/java/life/qbic/domain/usermanagement/registration/ConfirmEmailInput.java core/src/main/java/life/qbic/identityaccess/application/user/ConfirmEmailInput.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package life.qbic.domain.usermanagement.registration;
1+
package life.qbic.identityaccess.application.user;
22

33
/**
44
* <b>Confirm Email use case input</b>

domain/src/main/java/life/qbic/domain/usermanagement/registration/ConfirmEmailOutput.java core/src/main/java/life/qbic/identityaccess/application/user/ConfirmEmailOutput.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package life.qbic.domain.usermanagement.registration;
1+
package life.qbic.identityaccess.application.user;
22

33
/**
44
* <b>Confirm Email use case output</b>

domain/src/main/java/life/qbic/domain/usermanagement/registration/EmailAddressConfirmation.java core/src/main/java/life/qbic/identityaccess/application/user/EmailAddressConfirmation.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
package life.qbic.domain.usermanagement.registration;
1+
package life.qbic.identityaccess.application.user;
22

33
import java.util.Objects;
4-
import life.qbic.apps.datamanager.services.UserRegistrationService;
4+
import life.qbic.identityaccess.domain.user.UserNotFoundException;
55

66
/**
77
* <b>Email Address Confirmation use case</b>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
package life.qbic.identityaccess.application.user;
2+
3+
import life.qbic.identityaccess.domain.user.EncryptedPassword.PasswordValidationException;
4+
import life.qbic.shared.application.ApplicationResponse;
5+
6+
/**
7+
* <b>New password use case</b>
8+
* <p>
9+
* Set's a new password for a user.
10+
*
11+
* @since 1.0.0
12+
*/
13+
public class NewPassword implements NewPasswordInput {
14+
15+
private static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(NewPassword.class);
16+
private final UserRegistrationService userRegistrationService;
17+
private NewPasswordOutput useCaseOutput;
18+
19+
public NewPassword(UserRegistrationService userRegistrationService) {
20+
super();
21+
this.userRegistrationService = userRegistrationService;
22+
}
23+
24+
public void setUseCaseOutput(NewPasswordOutput useCaseOutput) {
25+
this.useCaseOutput = useCaseOutput;
26+
}
27+
28+
@Override
29+
public void setNewUserPassword(String userId, char[] newRawPassword) {
30+
if (useCaseOutput == null) {
31+
log.error("No use case output was set");
32+
return;
33+
}
34+
35+
ApplicationResponse response = userRegistrationService.newUserPassword(userId, newRawPassword);
36+
37+
response.ifSuccessOrElse(ignored -> {
38+
log.info(String.format("Successful password reset for user %s", userId));
39+
useCaseOutput.onSuccessfulNewPassword();
40+
},
41+
it -> it.failures().stream().filter(e -> e instanceof PasswordValidationException).findAny()
42+
.ifPresentOrElse(ignored -> {
43+
log.error(String.format("Could not set new password for user: %s", userId));
44+
useCaseOutput.onPasswordValidationFailure();
45+
},
46+
() -> {
47+
log.error(String.format("Unexpected failure on password reset for user: %s", userId));
48+
useCaseOutput.onUnexpectedFailure();
49+
}));
50+
51+
}
52+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package life.qbic.identityaccess.application.user;
2+
3+
/**
4+
* New Password use case input
5+
*
6+
* @since 1.0.0
7+
*/
8+
public interface NewPasswordInput {
9+
10+
/**
11+
* Sets a new password for a given user.
12+
*
13+
* @param userId the user's id
14+
* @param newRawPassword the new raw password
15+
* @since 1.0.0
16+
*/
17+
void setNewUserPassword(String userId, char[] newRawPassword);
18+
19+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package life.qbic.identityaccess.application.user;
2+
3+
/**
4+
* New Password use case output
5+
*
6+
* @since 1.0.0
7+
*/
8+
public interface NewPasswordOutput {
9+
10+
/**
11+
* Called when the new password has been saved successfully
12+
*
13+
* @since 1.0.0
14+
*/
15+
void onSuccessfulNewPassword();
16+
17+
/**
18+
* Called, when the password did not meet the requirements
19+
*
20+
* @since 1.0.0
21+
*/
22+
void onPasswordValidationFailure();
23+
24+
/**
25+
* Called, when an unexpected failure occurred.
26+
*
27+
* @since 1.0.0
28+
*/
29+
void onUnexpectedFailure();
30+
31+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package life.qbic.identityaccess.application.user;
2+
3+
/**
4+
* <b>Password Reset Use Case Input</b>
5+
*
6+
* <p>Requests a user password reset.</p>
7+
*
8+
* @since 1.0.0
9+
*/
10+
public interface PasswordResetInput {
11+
12+
/**
13+
* Requests a password reset for a user identified by the user id.
14+
*
15+
* @param emailAddress the user's email address
16+
* @since 1.0.0
17+
*/
18+
void resetPassword(String emailAddress);
19+
20+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package life.qbic.identityaccess.application.user;
2+
3+
/**
4+
* <b>Password Reset Use Case Output</b>
5+
*
6+
* <p>Defines call back methods for different use case outcomes.</p>
7+
*
8+
* @since 1.0.0
9+
*/
10+
public interface PasswordResetOutput {
11+
12+
/**
13+
* Called by the use case, when the password reset was successful.
14+
*
15+
* @since 1.0.0
16+
*/
17+
void onPasswordResetSucceeded();
18+
19+
/**
20+
* Called by the use case, when the password reset failed.
21+
*
22+
* @since 1.0.0
23+
*/
24+
void onPasswordResetFailed();
25+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
package life.qbic.identityaccess.application.user;
2+
3+
import java.util.Objects;
4+
import life.qbic.shared.application.ApplicationResponse;
5+
6+
/**
7+
* <b>Password Reset Use Case</b>
8+
*
9+
* <p>Handles a user's password reset request.</p>
10+
*
11+
* @since 1.0.0
12+
*/
13+
public class PasswordResetRequest implements PasswordResetInput {
14+
15+
private PasswordResetOutput output;
16+
17+
private final UserRegistrationService registrationService;
18+
19+
public PasswordResetRequest(UserRegistrationService registrationService) {
20+
super();
21+
this.registrationService = registrationService;
22+
}
23+
24+
@Override
25+
public void resetPassword(String emailAddress) {
26+
Objects.requireNonNull(output, "No use case output was set");
27+
ApplicationResponse response = registrationService.requestPasswordReset(emailAddress);
28+
response.ifSuccessOrElse(success -> output.onPasswordResetSucceeded(),
29+
failure -> output.onPasswordResetFailed());
30+
}
31+
32+
public void setUseCaseOutput(PasswordResetOutput output) {
33+
this.output = output;
34+
}
35+
36+
37+
}

domain/src/main/java/life/qbic/domain/usermanagement/registration/RegisterUserInput.java core/src/main/java/life/qbic/identityaccess/application/user/RegisterUserInput.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package life.qbic.domain.usermanagement.registration;
1+
package life.qbic.identityaccess.application.user;
22

33
/**
44
* Input interface to register a new user in the application.

domain/src/main/java/life/qbic/domain/usermanagement/registration/RegisterUserOutput.java core/src/main/java/life/qbic/identityaccess/application/user/RegisterUserOutput.java

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
package life.qbic.domain.usermanagement.registration;
2-
3-
import life.qbic.apps.datamanager.services.UserRegistrationException;
1+
package life.qbic.identityaccess.application.user;
42

53
/**
64
* Output interface for the user registration use case

domain/src/main/java/life/qbic/domain/usermanagement/registration/Registration.java core/src/main/java/life/qbic/identityaccess/application/user/Registration.java

+10-12
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1-
package life.qbic.domain.usermanagement.registration;
1+
package life.qbic.identityaccess.application.user;
22

3-
import life.qbic.apps.datamanager.services.UserRegistrationException;
4-
import life.qbic.apps.datamanager.services.UserRegistrationService;
5-
import life.qbic.apps.datamanager.services.UserRegistrationService.RegistrationResponse;
6-
import life.qbic.apps.datamanager.services.UserRegistrationService.UserExistsException;
7-
import life.qbic.domain.user.EmailAddress.EmailValidationException;
8-
import life.qbic.domain.user.EncryptedPassword.PasswordValidationException;
9-
import life.qbic.domain.user.FullName.FullNameValidationException;
3+
import life.qbic.shared.application.ApplicationResponse;
4+
import life.qbic.identityaccess.application.user.UserRegistrationService.UserExistsException;
5+
import life.qbic.identityaccess.domain.user.EmailAddress.EmailValidationException;
6+
import life.qbic.identityaccess.domain.user.EncryptedPassword.PasswordValidationException;
7+
import life.qbic.identityaccess.domain.user.FullName.FullNameValidationException;
108

119
/**
1210
* <b>User Registration use case</b>
@@ -61,26 +59,26 @@ public void setRegisterUserOutput(RegisterUserOutput registerUserOutput) {
6159
public void register(String fullName, String email, char[] rawPassword) {
6260
if (registerUserOutput == null) {
6361
log.error("No use case output set.");
64-
registerUserOutput.onUnexpectedFailure("Unexpected error occurred.");
6562
return;
6663
}
6764
try {
6865
userRegistrationService.registerUser(fullName, email, rawPassword)
6966
.ifSuccessOrElse(this::reportSuccess,
7067
response -> registerUserOutput.onUnexpectedFailure(build(response)));
7168
} catch (Exception e) {
69+
log.error("User registration failed", e.getCause());
7270
registerUserOutput.onUnexpectedFailure("Unexpected error occurred.");
7371
}
7472
}
7573

76-
private void reportSuccess(RegistrationResponse registrationResponse) {
74+
private void reportSuccess(ApplicationResponse applicationResponse) {
7775
registerUserOutput.onUserRegistrationSucceeded();
7876
}
7977

80-
private UserRegistrationException build(RegistrationResponse registrationResponse) {
78+
private UserRegistrationException build(ApplicationResponse applicationResponse) {
8179
var builder = UserRegistrationException.builder();
8280

83-
for (RuntimeException e : registrationResponse.failures()) {
81+
for (RuntimeException e : applicationResponse.failures()) {
8482
if (e instanceof EmailValidationException) {
8583
builder.withEmailFormatException((EmailValidationException) e);
8684
} else if (e instanceof PasswordValidationException) {

domain/src/main/java/life/qbic/apps/datamanager/services/UserRegistrationException.java core/src/main/java/life/qbic/identityaccess/application/user/UserRegistrationException.java

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
package life.qbic.apps.datamanager.services;
1+
package life.qbic.identityaccess.application.user;
22

33
import java.io.Serial;
44
import java.util.Optional;
5-
import life.qbic.apps.datamanager.ApplicationException;
6-
import life.qbic.apps.datamanager.services.UserRegistrationService.UserExistsException;
7-
import life.qbic.domain.user.EmailAddress.EmailValidationException;
8-
import life.qbic.domain.user.EncryptedPassword.PasswordValidationException;
9-
import life.qbic.domain.user.FullName.FullNameValidationException;
5+
import life.qbic.identityaccess.application.ApplicationException;
6+
import life.qbic.identityaccess.application.user.UserRegistrationService.UserExistsException;
7+
import life.qbic.identityaccess.domain.user.EmailAddress.EmailValidationException;
8+
import life.qbic.identityaccess.domain.user.EncryptedPassword.PasswordValidationException;
9+
import life.qbic.identityaccess.domain.user.FullName.FullNameValidationException;
1010

1111
/**
1212
* <h1>Exception that indicates violations during the user registration process</h1>

0 commit comments

Comments
 (0)