From 13fd73a09e41930d6dbfaa06ac994a1eb3b5e3a8 Mon Sep 17 00:00:00 2001 From: Pekka Helenius Date: Wed, 7 Oct 2020 11:10:32 +0300 Subject: [PATCH] Enable BCryptPasswordEncoder Signed-off-by: Pekka Helenius --- .../com/fjordtek/bookstore/config/WebSecurityConfig.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/bookstore/src/main/java/com/fjordtek/bookstore/config/WebSecurityConfig.java b/bookstore/src/main/java/com/fjordtek/bookstore/config/WebSecurityConfig.java index fb3f699..b4c06d7 100644 --- a/bookstore/src/main/java/com/fjordtek/bookstore/config/WebSecurityConfig.java +++ b/bookstore/src/main/java/com/fjordtek/bookstore/config/WebSecurityConfig.java @@ -4,6 +4,7 @@ package com.fjordtek.bookstore.config; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.MessageSource; +import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.core.annotation.Order; import org.springframework.core.env.Environment; @@ -13,6 +14,7 @@ import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; import org.springframework.security.config.http.SessionCreationPolicy; +import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; import com.fjordtek.bookstore.service.session.BookStoreAccessDeniedHandler; import com.fjordtek.bookstore.service.session.BookStoreAuthenticationFailureHandler; @@ -54,16 +56,15 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter { public void configureGlobal(AuthenticationManagerBuilder authManagerBuilder) throws Exception { authManagerBuilder.userDetailsService(userDetailService) -// .passwordEncoder(bCryptPasswordEncoder) + .passwordEncoder(bCryptPasswordEncoder()) ; } -/* @Bean public BCryptPasswordEncoder bCryptPasswordEncoder() { return new BCryptPasswordEncoder(); } -*/ + /* * Have different HTTP security policies for: