cleanup finalize jwt auth
- Add sample login page
This commit is contained in:
@@ -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);
|
||||
|
Reference in New Issue
Block a user