Commit d39ab7e6 by Patryk Czarnik

Konfiguracja security taka, że każdy ma dostęp do całej strony.

parent 0e0d0857
...@@ -9,6 +9,12 @@ public class RootController { ...@@ -9,6 +9,12 @@ public class RootController {
@GetMapping("/") @GetMapping("/")
@ResponseBody @ResponseBody
public String index() {
return "Strona główna";
}
@GetMapping("/hello")
@ResponseBody
public String hello() { public String hello() {
return "Hello Spring!"; return "Hello Spring!";
} }
......
package sklep.security;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.web.SecurityFilterChain;
@Configuration
public class SecurityConfig {
// Uproszczona konfiguracja zabezpieczeń HTTP.
// Określamy bardzo liberalną politykę autoryzacji - każdy do dostęp do każdego elementu aplikacji.
@Bean
SecurityFilterChain configureHttpSecurity(HttpSecurity httpSecurity) throws Exception {
httpSecurity.authorizeHttpRequests(authz -> authz.anyRequest().permitAll());
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