From 7963542c9b14665b90820ffee41422153bd3a116 Mon Sep 17 00:00:00 2001 From: djmil Date: Sun, 23 Jul 2023 14:50:20 +0200 Subject: [PATCH] SpringSecurity: minimal do-nothing implementtaion - add SpringSecurity dependancie - Minimal do-nothing SecurityConfig.java --- build.gradle | 2 ++ .../java/djmil/cashcard/SecurityConfig.java | 26 +++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 src/main/java/djmil/cashcard/SecurityConfig.java diff --git a/build.gradle b/build.gradle index 57368e1..72050b4 100644 --- a/build.gradle +++ b/build.gradle @@ -21,6 +21,8 @@ dependencies { implementation 'org.springframework.data:spring-data-jdbc' testImplementation 'com.h2database:h2' + + implementation 'org.springframework.boot:spring-boot-starter-security' } tasks.named('test') { diff --git a/src/main/java/djmil/cashcard/SecurityConfig.java b/src/main/java/djmil/cashcard/SecurityConfig.java new file mode 100644 index 0000000..eac111c --- /dev/null +++ b/src/main/java/djmil/cashcard/SecurityConfig.java @@ -0,0 +1,26 @@ +package djmil.cashcard; + +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.core.userdetails.User; +import org.springframework.security.core.userdetails.UserDetails; +import org.springframework.security.core.userdetails.UserDetailsService; +import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; +import org.springframework.security.crypto.password.PasswordEncoder; +import org.springframework.security.provisioning.InMemoryUserDetailsManager; +import org.springframework.security.web.SecurityFilterChain; + +@Configuration +public class SecurityConfig { + + @Bean + public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { + return http.build(); + } + + @Bean + public PasswordEncoder passwordEncoder() { + return new BCryptPasswordEncoder(); + } +} \ No newline at end of file