half auth

This commit is contained in:
truettwo 2025-02-19 15:00:06 +03:00
parent f13c0767c7
commit eefdf4a072

View File

@ -20,17 +20,9 @@ public class EmployeeController {
this.employeeService = employeeService;
}
@PostMapping("/auth") // Аутентификация
public ResponseEntity<?> authenticate(@RequestBody Map<String, String> payload) {
String login = payload.get("login");
String password = payload.get("password");
Optional<Employee> employee = employeeService.findByLogin(login);
if (employee.isPresent() && employee.get().getPassword().equals(password)) {
return ResponseEntity.ok("Valid login");
} else {
return ResponseEntity.status(HttpStatus.UNAUTHORIZED).body("Invalid login or password");
}
@GetMapping("/auth") // Проверка аутентификации
public ResponseEntity<?> authenticate() {
return ResponseEntity.ok("Authenticated successfully");
}
@GetMapping("/{login}/info") // Получение информации о сотруднике