Commit ca64fb08 by Patryk Czarnik

formLogin

parent d045b505
......@@ -2,6 +2,7 @@ package sklep.security;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.Customizer;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.web.SecurityFilterChain;
......@@ -10,11 +11,17 @@ import org.springframework.security.web.SecurityFilterChain;
@EnableWebSecurity
public class SecurityConfig {
// Metoda odpowiedzialna za ogólną konfigurację security aplikacj webowej, w tym:
// - reguły autoryzacji, czyli kot może wykonywać jakie zapytania
// - sposób uwierzytelniania
// (czy tradycyjny formularz logowania, czy HttpBasic, czy OAuth2, ...)
// W tej wersji jawnie wpisujemy takie ustawienia, które są ustawieniami domyślnymi.
@Bean
SecurityFilterChain configHttpSecurity(HttpSecurity httpSecurity) throws Exception {
httpSecurity.authorizeHttpRequests(authz -> authz
.anyRequest().permitAll()
)
.anyRequest().authenticated()
).formLogin(Customizer.withDefaults())
;
return httpSecurity.build();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment