Change sign-up url, Add whoami endpoint
This commit is contained in:
parent
6abdab2cf6
commit
f186a89bb8
@ -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";
|
||||
}
|
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user