initial Release request #1
4
pom.xml
4
pom.xml
@@ -38,6 +38,10 @@
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-security</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-oauth2-client</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
package de.zendric.app.xpensely_server.controller;
|
||||
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
class HomeController {
|
||||
|
||||
@GetMapping("/")
|
||||
public String getAll() {
|
||||
return "Welcome";
|
||||
}
|
||||
}
|
||||
@@ -2,31 +2,19 @@ package de.zendric.app.xpensely_server.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;
|
||||
|
||||
@Configuration
|
||||
@EnableWebSecurity
|
||||
public class SecurityConfig {
|
||||
|
||||
@Bean
|
||||
public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
|
||||
http
|
||||
.authorizeHttpRequests(authorize -> authorize
|
||||
.anyRequest().permitAll() // Allow all requests without authentication
|
||||
)
|
||||
.csrf().disable(); // Disable CSRF for development purposes
|
||||
http.authorizeHttpRequests(auth -> auth
|
||||
.anyRequest().authenticated()).oauth2Login(Customizer.withDefaults());
|
||||
|
||||
return http.build();
|
||||
}
|
||||
|
||||
// @Bean
|
||||
// public SecurityFilterChain securityFilterChain(HttpSecurity http) throws
|
||||
// Exception {
|
||||
// return http.authorizeHttpRequests(auth -> {
|
||||
// auth.requestMatchers("/").permitAll();
|
||||
// auth.anyRequest().permitAll();
|
||||
// // auth.anyRequest().authenticated();
|
||||
// }).oauth2Login(Customizer.withDefaults())
|
||||
// .build();
|
||||
// }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user