Initial commit with basic CRUD functionality:
* GET all properties * GET one property by id * CREATE one property * DELETE one property by id
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
package de.iwomm.propify_api.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.config.annotation.web.configuration.EnableWebSecurity;
|
||||
import org.springframework.security.web.SecurityFilterChain;
|
||||
|
||||
@Configuration
|
||||
@EnableWebSecurity
|
||||
public class SecurityConfig {
|
||||
|
||||
@Bean
|
||||
public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
|
||||
http
|
||||
.csrf(csrf -> csrf.disable()) // CSRF deaktivieren für APIs
|
||||
.authorizeHttpRequests(auth -> auth
|
||||
.requestMatchers("/api/**").permitAll() // API ist offen
|
||||
.anyRequest().permitAll() // Alles andere auch offen
|
||||
)
|
||||
.httpBasic(httpBasic -> httpBasic.disable()) // Kein Basic Auth
|
||||
.formLogin(form -> form.disable()); // Kein Login-Formular
|
||||
|
||||
return http.build();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user