Browse Source

Enable BCryptPasswordEncoder

Signed-off-by: Pekka Helenius <fincer89@hotmail.com>
v0.0.3-alpha
Pekka Helenius 4 years ago
parent
commit
13fd73a09e
1 changed files with 4 additions and 3 deletions
  1. +4
    -3
      bookstore/src/main/java/com/fjordtek/bookstore/config/WebSecurityConfig.java

+ 4
- 3
bookstore/src/main/java/com/fjordtek/bookstore/config/WebSecurityConfig.java View File

@ -4,6 +4,7 @@ package com.fjordtek.bookstore.config;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.MessageSource; import org.springframework.context.MessageSource;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.core.annotation.Order; import org.springframework.core.annotation.Order;
import org.springframework.core.env.Environment; 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.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.config.http.SessionCreationPolicy; 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.BookStoreAccessDeniedHandler;
import com.fjordtek.bookstore.service.session.BookStoreAuthenticationFailureHandler; import com.fjordtek.bookstore.service.session.BookStoreAuthenticationFailureHandler;
@ -54,16 +56,15 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
public void configureGlobal(AuthenticationManagerBuilder authManagerBuilder) public void configureGlobal(AuthenticationManagerBuilder authManagerBuilder)
throws Exception { throws Exception {
authManagerBuilder.userDetailsService(userDetailService) authManagerBuilder.userDetailsService(userDetailService)
// .passwordEncoder(bCryptPasswordEncoder)
.passwordEncoder(bCryptPasswordEncoder())
; ;
} }
/*
@Bean @Bean
public BCryptPasswordEncoder bCryptPasswordEncoder() { public BCryptPasswordEncoder bCryptPasswordEncoder() {
return new BCryptPasswordEncoder(); return new BCryptPasswordEncoder();
} }
*/
/* /*
* Have different HTTP security policies for: * Have different HTTP security policies for:


Loading…
Cancel
Save