add log out

This commit is contained in:
Konstantin 2025-02-20 12:05:47 +03:00
parent 4b2787344a
commit 06eb2e8b12
2 changed files with 6 additions and 1 deletions

View File

@ -49,6 +49,7 @@ public class SecurityConfig {
return http.csrf(AbstractHttpConfigurer::disable) return http.csrf(AbstractHttpConfigurer::disable)
.authorizeHttpRequests(auth -> auth.requestMatchers(new AntPathRequestMatcher("/api/auth")).permitAll() .authorizeHttpRequests(auth -> auth.requestMatchers(new AntPathRequestMatcher("/api/auth")).permitAll()
.anyRequest().authenticated()) .anyRequest().authenticated())
.logout((logout) -> logout.logoutUrl("/api/logout"))
.httpBasic(Customizer.withDefaults()) .httpBasic(Customizer.withDefaults())
.build(); .build();
} }

View File

@ -15,7 +15,11 @@ public class EmployeeController {
private final EmployeeService employeeService; private final EmployeeService employeeService;
@GetMapping("/auth") @GetMapping("/auth")
public void EmployeeExists(@RequestParam final String login) { public void authEmployee(@RequestParam final String login) {
employeeService.employeeExists(login);
}
@GetMapping("/logout")
public void logoutEmployee(@RequestParam final String login) {
employeeService.employeeExists(login); employeeService.employeeExists(login);
} }
@GetMapping("/info") @GetMapping("/info")