WIP
authorKai Moritz <kai@juplo.de>
Sun, 14 Mar 2021 12:23:26 +0000 (13:23 +0100)
committerKai Moritz <kai@juplo.de>
Sun, 14 Mar 2021 12:23:26 +0000 (13:23 +0100)
12 files changed:
pwreset/src/main/java/de/juplo/demos/pwreset/adapters/in/WebController.java
pwreset/src/main/java/de/juplo/demos/pwreset/adapters/out/RemoteUsersServiceConsumer.java
pwreset/src/main/java/de/juplo/demos/pwreset/api/domain/PasswordResetRequest.java [deleted file]
pwreset/src/main/java/de/juplo/demos/pwreset/api/domain/PasswordResetRequestProgress.java [deleted file]
pwreset/src/main/java/de/juplo/demos/pwreset/api/domain/PasswordRestService.java [deleted file]
pwreset/src/main/java/de/juplo/demos/pwreset/api/out/MessagingService.java [deleted file]
pwreset/src/main/java/de/juplo/demos/pwreset/api/out/UsersService.java [deleted file]
pwreset/src/main/java/de/juplo/demos/pwreset/domain/internal/PasswordResetRequest.java [new file with mode: 0644]
pwreset/src/main/java/de/juplo/demos/pwreset/domain/ports/in/PasswordResetService.java [new file with mode: 0644]
pwreset/src/main/java/de/juplo/demos/pwreset/domain/ports/in/ResetRequestProgress.java [new file with mode: 0644]
pwreset/src/main/java/de/juplo/demos/pwreset/domain/ports/out/MessagingService.java [new file with mode: 0644]
pwreset/src/main/java/de/juplo/demos/pwreset/domain/ports/out/UsersService.java [new file with mode: 0644]

index b535a27..2d6b089 100644 (file)
@@ -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);
index 78c5548..7a2ac77 100644 (file)
@@ -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/PasswordResetRequest.java b/pwreset/src/main/java/de/juplo/demos/pwreset/api/domain/PasswordResetRequest.java
deleted file mode 100644 (file)
index d0ed22f..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-package de.juplo.demos.pwreset.api.domain;
-
-import lombok.Data;
-
-import java.time.ZonedDateTime;
-import java.util.Optional;
-import java.util.UUID;
-
-
-@Data
-public class PasswordResetRequest
-{
-  public enum Status
-  {
-    CREATED,
-    CONFIRMED,
-    ACCOMPLISHED
-  }
-
-  private final UUID id;
-  private final Optional<UUID> userId;
-  private String code;
-  private String password;
-  private Status status;
-  private ZonedDateTime created;
-  private ZonedDateTime confirmed;
-  private ZonedDateTime accomplihed;
-}
diff --git a/pwreset/src/main/java/de/juplo/demos/pwreset/api/domain/PasswordResetRequestProgress.java b/pwreset/src/main/java/de/juplo/demos/pwreset/api/domain/PasswordResetRequestProgress.java
deleted file mode 100644 (file)
index 6cb27f3..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-package de.juplo.demos.pwreset.api.domain;
-
-import lombok.Builder;
-import lombok.Getter;
-import lombok.ToString;
-
-import java.time.ZonedDateTime;
-import java.util.Optional;
-import java.util.UUID;
-
-
-@Builder
-@Getter
-@ToString
-public class PasswordResetRequestProgress
-{
-  private final UUID requestId;
-  private final boolean accepted;
-  private final String message;
-  private final Optional<ZonedDateTime> created;
-  private final Optional<ZonedDateTime> confirmed;
-  private final Optional<ZonedDateTime> accomplished;
-}
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 (file)
index e30ce8d..0000000
+++ /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/out/MessagingService.java b/pwreset/src/main/java/de/juplo/demos/pwreset/api/out/MessagingService.java
deleted file mode 100644 (file)
index 460af93..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-package de.juplo.demos.pwreset.api.out;
-
-import java.util.UUID;
-
-
-public interface MessagingService
-{
-  void sendRestCode(UUID userId, String code);
-}
diff --git a/pwreset/src/main/java/de/juplo/demos/pwreset/api/out/UsersService.java b/pwreset/src/main/java/de/juplo/demos/pwreset/api/out/UsersService.java
deleted file mode 100644 (file)
index 212b816..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-package de.juplo.demos.pwreset.api.out;
-
-import java.util.Optional;
-import java.util.UUID;
-
-
-public interface UsersService
-{
-  Optional<UUID> getUserByEmail(String email);
-  void setPassword(UUID userId, String password);
-}
diff --git a/pwreset/src/main/java/de/juplo/demos/pwreset/domain/internal/PasswordResetRequest.java b/pwreset/src/main/java/de/juplo/demos/pwreset/domain/internal/PasswordResetRequest.java
new file mode 100644 (file)
index 0000000..9a79b25
--- /dev/null
@@ -0,0 +1,28 @@
+package de.juplo.demos.pwreset.domain.internal;
+
+import lombok.Data;
+
+import java.time.ZonedDateTime;
+import java.util.Optional;
+import java.util.UUID;
+
+
+@Data
+public class PasswordResetRequest
+{
+  public enum Status
+  {
+    CREATED,
+    CONFIRMED,
+    ACCOMPLISHED
+  }
+
+  private final UUID id;
+  private final Optional<UUID> userId;
+  private String code;
+  private String password;
+  private Status status;
+  private ZonedDateTime created;
+  private ZonedDateTime confirmed;
+  private ZonedDateTime accomplihed;
+}
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 (file)
index 0000000..833edd8
--- /dev/null
@@ -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/domain/ports/in/ResetRequestProgress.java b/pwreset/src/main/java/de/juplo/demos/pwreset/domain/ports/in/ResetRequestProgress.java
new file mode 100644 (file)
index 0000000..5e70f5e
--- /dev/null
@@ -0,0 +1,23 @@
+package de.juplo.demos.pwreset.domain.ports.in;
+
+import lombok.Builder;
+import lombok.Getter;
+import lombok.ToString;
+
+import java.time.ZonedDateTime;
+import java.util.Optional;
+import java.util.UUID;
+
+
+@Builder
+@Getter
+@ToString
+public class ResetRequestProgress
+{
+  private final UUID requestId;
+  private final boolean accepted;
+  private final String message;
+  private final Optional<ZonedDateTime> created;
+  private final Optional<ZonedDateTime> confirmed;
+  private final Optional<ZonedDateTime> accomplished;
+}
diff --git a/pwreset/src/main/java/de/juplo/demos/pwreset/domain/ports/out/MessagingService.java b/pwreset/src/main/java/de/juplo/demos/pwreset/domain/ports/out/MessagingService.java
new file mode 100644 (file)
index 0000000..b05411f
--- /dev/null
@@ -0,0 +1,9 @@
+package de.juplo.demos.pwreset.domain.ports.out;
+
+import java.util.UUID;
+
+
+public interface MessagingService
+{
+  void sendRestCode(UUID userId, String code);
+}
diff --git a/pwreset/src/main/java/de/juplo/demos/pwreset/domain/ports/out/UsersService.java b/pwreset/src/main/java/de/juplo/demos/pwreset/domain/ports/out/UsersService.java
new file mode 100644 (file)
index 0000000..b314c86
--- /dev/null
@@ -0,0 +1,11 @@
+package de.juplo.demos.pwreset.domain.ports.out;
+
+import java.util.Optional;
+import java.util.UUID;
+
+
+public interface UsersService
+{
+  Optional<UUID> getUserByEmail(String email);
+  void setPassword(UUID userId, String password);
+}