From 4356061f7d4ce078b66b1dc0fe346af04dbf1b8f Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Sun, 14 Mar 2021 13:23:26 +0100 Subject: [PATCH] WIP --- .../demos/pwreset/adapters/in/WebController.java | 16 ++++++++-------- .../adapters/out/RemoteUsersServiceConsumer.java | 2 +- .../pwreset/api/domain/PasswordRestService.java | 11 ----------- .../internal}/PasswordResetRequest.java | 2 +- .../domain/ports/in/PasswordResetService.java | 11 +++++++++++ .../ports/in/ResetRequestProgress.java} | 4 ++-- .../ports}/out/MessagingService.java | 2 +- .../{api => domain/ports}/out/UsersService.java | 2 +- 8 files changed, 25 insertions(+), 25 deletions(-) delete mode 100644 pwreset/src/main/java/de/juplo/demos/pwreset/api/domain/PasswordRestService.java rename pwreset/src/main/java/de/juplo/demos/pwreset/{api/domain => domain/internal}/PasswordResetRequest.java (90%) create mode 100644 pwreset/src/main/java/de/juplo/demos/pwreset/domain/ports/in/PasswordResetService.java rename pwreset/src/main/java/de/juplo/demos/pwreset/{api/domain/PasswordResetRequestProgress.java => domain/ports/in/ResetRequestProgress.java} (83%) rename pwreset/src/main/java/de/juplo/demos/pwreset/{api => domain/ports}/out/MessagingService.java (69%) rename pwreset/src/main/java/de/juplo/demos/pwreset/{api => domain/ports}/out/UsersService.java (78%) diff --git a/pwreset/src/main/java/de/juplo/demos/pwreset/adapters/in/WebController.java b/pwreset/src/main/java/de/juplo/demos/pwreset/adapters/in/WebController.java index b535a27..2d6b089 100644 --- a/pwreset/src/main/java/de/juplo/demos/pwreset/adapters/in/WebController.java +++ b/pwreset/src/main/java/de/juplo/demos/pwreset/adapters/in/WebController.java @@ -1,7 +1,7 @@ package de.juplo.demos.pwreset.adapters.in; -import de.juplo.demos.pwreset.api.domain.PasswordResetRequestProgress; -import de.juplo.demos.pwreset.api.domain.PasswordRestService; +import de.juplo.demos.pwreset.domain.ports.in.ResetRequestProgress; +import de.juplo.demos.pwreset.domain.ports.in.PasswordResetService; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.*; @@ -16,7 +16,7 @@ import java.util.UUID; @RequiredArgsConstructor public class WebController { - private final PasswordRestService passwordRestService; + private final PasswordResetService passwordResetService; @GetMapping("/") @@ -32,14 +32,14 @@ public class WebController throws IOException { - PasswordResetRequestProgress progress = passwordRestService.request(email); + ResetRequestProgress progress = passwordResetService.request(email); httpServletResponse.sendRedirect(progress.getRequestId().toString()); } @GetMapping("/{id}") public ModelAndView getResetRequest(@PathVariable UUID id) { - PasswordResetRequestProgress progress = passwordRestService.get(id); + ResetRequestProgress progress = passwordResetService.get(id); return createModelAndView(progress); } @@ -49,8 +49,8 @@ public class WebController @RequestParam String code, @RequestParam String password) { - PasswordResetRequestProgress progress = - passwordRestService.confirm( + ResetRequestProgress progress = + passwordResetService.confirm( id, code, password); @@ -63,7 +63,7 @@ public class WebController return mav; } - ModelAndView createModelAndView(PasswordResetRequestProgress progress) + ModelAndView createModelAndView(ResetRequestProgress progress) { ModelAndView mav = new ModelAndView(); mav.addObject("progress", progress); diff --git a/pwreset/src/main/java/de/juplo/demos/pwreset/adapters/out/RemoteUsersServiceConsumer.java b/pwreset/src/main/java/de/juplo/demos/pwreset/adapters/out/RemoteUsersServiceConsumer.java index 78c5548..7a2ac77 100644 --- a/pwreset/src/main/java/de/juplo/demos/pwreset/adapters/out/RemoteUsersServiceConsumer.java +++ b/pwreset/src/main/java/de/juplo/demos/pwreset/adapters/out/RemoteUsersServiceConsumer.java @@ -1,6 +1,6 @@ package de.juplo.demos.pwreset.adapters.out; -import de.juplo.demos.pwreset.api.out.UsersService; +import de.juplo.demos.pwreset.domain.ports.out.UsersService; import lombok.RequiredArgsConstructor; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; diff --git a/pwreset/src/main/java/de/juplo/demos/pwreset/api/domain/PasswordRestService.java b/pwreset/src/main/java/de/juplo/demos/pwreset/api/domain/PasswordRestService.java deleted file mode 100644 index e30ce8d..0000000 --- a/pwreset/src/main/java/de/juplo/demos/pwreset/api/domain/PasswordRestService.java +++ /dev/null @@ -1,11 +0,0 @@ -package de.juplo.demos.pwreset.api.domain; - -import java.util.UUID; - - -public interface PasswordRestService -{ - PasswordResetRequestProgress request(String email); - PasswordResetRequestProgress get(UUID requestId); - PasswordResetRequestProgress confirm(UUID requestId, String code, String password); -} diff --git a/pwreset/src/main/java/de/juplo/demos/pwreset/api/domain/PasswordResetRequest.java b/pwreset/src/main/java/de/juplo/demos/pwreset/domain/internal/PasswordResetRequest.java similarity index 90% rename from pwreset/src/main/java/de/juplo/demos/pwreset/api/domain/PasswordResetRequest.java rename to pwreset/src/main/java/de/juplo/demos/pwreset/domain/internal/PasswordResetRequest.java index d0ed22f..9a79b25 100644 --- a/pwreset/src/main/java/de/juplo/demos/pwreset/api/domain/PasswordResetRequest.java +++ b/pwreset/src/main/java/de/juplo/demos/pwreset/domain/internal/PasswordResetRequest.java @@ -1,4 +1,4 @@ -package de.juplo.demos.pwreset.api.domain; +package de.juplo.demos.pwreset.domain.internal; import lombok.Data; diff --git a/pwreset/src/main/java/de/juplo/demos/pwreset/domain/ports/in/PasswordResetService.java b/pwreset/src/main/java/de/juplo/demos/pwreset/domain/ports/in/PasswordResetService.java new file mode 100644 index 0000000..833edd8 --- /dev/null +++ b/pwreset/src/main/java/de/juplo/demos/pwreset/domain/ports/in/PasswordResetService.java @@ -0,0 +1,11 @@ +package de.juplo.demos.pwreset.domain.ports.in; + +import java.util.UUID; + + +public interface PasswordResetService +{ + ResetRequestProgress request(String email); + ResetRequestProgress get(UUID requestId); + ResetRequestProgress confirm(UUID requestId, String code, String password); +} diff --git a/pwreset/src/main/java/de/juplo/demos/pwreset/api/domain/PasswordResetRequestProgress.java b/pwreset/src/main/java/de/juplo/demos/pwreset/domain/ports/in/ResetRequestProgress.java similarity index 83% rename from pwreset/src/main/java/de/juplo/demos/pwreset/api/domain/PasswordResetRequestProgress.java rename to pwreset/src/main/java/de/juplo/demos/pwreset/domain/ports/in/ResetRequestProgress.java index 6cb27f3..5e70f5e 100644 --- a/pwreset/src/main/java/de/juplo/demos/pwreset/api/domain/PasswordResetRequestProgress.java +++ b/pwreset/src/main/java/de/juplo/demos/pwreset/domain/ports/in/ResetRequestProgress.java @@ -1,4 +1,4 @@ -package de.juplo.demos.pwreset.api.domain; +package de.juplo.demos.pwreset.domain.ports.in; import lombok.Builder; import lombok.Getter; @@ -12,7 +12,7 @@ import java.util.UUID; @Builder @Getter @ToString -public class PasswordResetRequestProgress +public class ResetRequestProgress { private final UUID requestId; private final boolean accepted; diff --git a/pwreset/src/main/java/de/juplo/demos/pwreset/api/out/MessagingService.java b/pwreset/src/main/java/de/juplo/demos/pwreset/domain/ports/out/MessagingService.java similarity index 69% rename from pwreset/src/main/java/de/juplo/demos/pwreset/api/out/MessagingService.java rename to pwreset/src/main/java/de/juplo/demos/pwreset/domain/ports/out/MessagingService.java index 460af93..b05411f 100644 --- a/pwreset/src/main/java/de/juplo/demos/pwreset/api/out/MessagingService.java +++ b/pwreset/src/main/java/de/juplo/demos/pwreset/domain/ports/out/MessagingService.java @@ -1,4 +1,4 @@ -package de.juplo.demos.pwreset.api.out; +package de.juplo.demos.pwreset.domain.ports.out; import java.util.UUID; diff --git a/pwreset/src/main/java/de/juplo/demos/pwreset/api/out/UsersService.java b/pwreset/src/main/java/de/juplo/demos/pwreset/domain/ports/out/UsersService.java similarity index 78% rename from pwreset/src/main/java/de/juplo/demos/pwreset/api/out/UsersService.java rename to pwreset/src/main/java/de/juplo/demos/pwreset/domain/ports/out/UsersService.java index 212b816..b314c86 100644 --- a/pwreset/src/main/java/de/juplo/demos/pwreset/api/out/UsersService.java +++ b/pwreset/src/main/java/de/juplo/demos/pwreset/domain/ports/out/UsersService.java @@ -1,4 +1,4 @@ -package de.juplo.demos.pwreset.api.out; +package de.juplo.demos.pwreset.domain.ports.out; import java.util.Optional; import java.util.UUID; -- 2.20.1