From f186a89bb8870bd89cfa2506b17e23d31831c724 Mon Sep 17 00:00:00 2001 From: Marcel Schwarz Date: Sat, 9 May 2020 19:20:35 +0200 Subject: [PATCH] Change sign-up url, Add whoami endpoint --- .../main/java/de/hft/geotime/security/SecurityConstants.java | 2 +- backend/src/main/java/de/hft/geotime/user/UserController.java | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/backend/src/main/java/de/hft/geotime/security/SecurityConstants.java b/backend/src/main/java/de/hft/geotime/security/SecurityConstants.java index d568748..f977cf3 100644 --- a/backend/src/main/java/de/hft/geotime/security/SecurityConstants.java +++ b/backend/src/main/java/de/hft/geotime/security/SecurityConstants.java @@ -5,5 +5,5 @@ public class SecurityConstants { public static final long EXPIRATION_TIME = 864_000_000; // 10 days public static final String TOKEN_PREFIX = "Bearer "; public static final String HEADER_STRING = "Authorization"; - public static final String SIGN_UP_URL = "/user/sign-up"; + public static final String SIGN_UP_URL = "/sign-up"; } \ No newline at end of file diff --git a/backend/src/main/java/de/hft/geotime/user/UserController.java b/backend/src/main/java/de/hft/geotime/user/UserController.java index d467ea8..723dde1 100644 --- a/backend/src/main/java/de/hft/geotime/user/UserController.java +++ b/backend/src/main/java/de/hft/geotime/user/UserController.java @@ -7,7 +7,6 @@ import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; import org.springframework.web.bind.annotation.*; @RestController -@RequestMapping("/user") public class UserController { private final TimetrackUserRepository userRepository; @@ -18,7 +17,7 @@ public class UserController { this.bCryptPasswordEncoder = bCryptPasswordEncoder; } - @GetMapping + @GetMapping("/whoami") public String getUsername(Authentication authentication) { TimetrackUser timetrackUser = userRepository.findFirstByUsername(authentication.getName()); return "Welcome back " + timetrackUser.getFirstname() + " " + timetrackUser.getLastname();