Начата работа над basic авторизацией. Идем обдедать)

This commit is contained in:
Daniil Makeev 2025-02-19 12:59:54 +03:00
parent e071807ecf
commit 5423b45470
4 changed files with 49 additions and 0 deletions

View File

@ -9,6 +9,7 @@ import com.example.onomatopoeiaback.service.EmployeeService;
import com.example.onomatopoeiaback.service.VisitService;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import java.util.List;

View File

@ -0,0 +1,19 @@
package com.example.onomatopoeiaback.security;
import org.springframework.security.authentication.AuthenticationProvider;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.AuthenticationException;
import org.springframework.stereotype.Component;
@Component
public class CustomAuthenticationProvider implements AuthenticationProvider {
@Override
public Authentication authenticate(Authentication authentication) throws AuthenticationException {
return null;
}
@Override
public boolean supports(Class<?> authentication) {
return false;
}
}

View File

@ -0,0 +1,16 @@
package com.example.onomatopoeiaback.security;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Configurable;
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.core.userdetails.UserDetailsService;
@Configurable
@EnableWebSecurity
public class SecurityConfig {
@Autowired
private UserDetailsService userDetailsService;
}

View File

@ -0,0 +1,13 @@
package com.example.onomatopoeiaback.security;
import io.swagger.v3.oas.annotations.enums.SecuritySchemeType;
import io.swagger.v3.oas.annotations.security.SecurityScheme;
import org.springframework.context.annotation.Configuration;
@Configuration
@SecurityScheme(
type = SecuritySchemeType.HTTP,
name = "basicAuth",
scheme = "basic")
public class SwaggerConfig {
}