cleanup finalize jwt auth

- Add sample login page
This commit is contained in:
Max W.
2025-01-17 01:14:59 +01:00
parent b3762373d4
commit e7961576ca
4 changed files with 111 additions and 7 deletions

View File

@@ -29,14 +29,16 @@ public class AuthenticationController {
log.debug("Received AuthenticationRequest for username: " + authenticationRequest.getUsername());
String token = authenticationService.authenticate(authenticationRequest.getUsername(), authenticationRequest.getPassword(), request.getRemoteAddr());
Map<String, Object> response = new HashMap<>();
if(token == null) {
log.debug("Authentication failed for username: " + authenticationRequest.getUsername());
return new ResponseEntity<>(HttpStatus.UNAUTHORIZED);
response.put("error", "Authentication failed. Username or password incorrect.");
return new ResponseEntity<>(response, HttpStatus.UNAUTHORIZED);
}
Map<String, Object> response = new HashMap<>();
response.put("token", token);
response.put("token", token);
if(token == null) {
log.debug("Authentication failed for username: " + authenticationRequest.getUsername());
return new ResponseEntity<>(response, HttpStatus.UNAUTHORIZED);