[9ff45d6] | 1 | //package parkup.configs.webConfigs;
|
---|
| 2 | //
|
---|
| 3 | //import org.springframework.context.annotation.Bean;
|
---|
| 4 | //import org.springframework.context.annotation.Configuration;
|
---|
| 5 | //import org.springframework.core.annotation.Order;
|
---|
| 6 | //import org.springframework.security.authentication.dao.DaoAuthenticationProvider;
|
---|
| 7 | //import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
|
---|
| 8 | //import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
---|
| 9 | //import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
|
---|
| 10 | //import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
|
---|
| 11 | //import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
---|
| 12 | //import parkup.services.AdministratorService;
|
---|
| 13 | //
|
---|
| 14 | //@EnableWebSecurity
|
---|
| 15 | //@Order(101)
|
---|
| 16 | //@Configuration
|
---|
| 17 | //public class WebSecurityConfigAdministrator extends WebSecurityConfigurerAdapter {
|
---|
| 18 | // private final AdministratorService administratorService;
|
---|
| 19 | // private final BCryptPasswordEncoder bCryptPasswordEncoder;
|
---|
| 20 | //
|
---|
| 21 | // public WebSecurityConfigAdministrator(AdministratorService administratorService, BCryptPasswordEncoder bCryptPasswordEncoder) {
|
---|
| 22 | // this.administratorService = administratorService;
|
---|
| 23 | // this.bCryptPasswordEncoder = bCryptPasswordEncoder;
|
---|
| 24 | // }
|
---|
| 25 | //
|
---|
| 26 | // @Override
|
---|
| 27 | // protected void configure(HttpSecurity http) throws Exception {
|
---|
| 28 | // http
|
---|
| 29 | // .csrf().disable()
|
---|
| 30 | // .authorizeRequests()
|
---|
| 31 | // .antMatchers("/administrator/registration/**")
|
---|
| 32 | // .permitAll()
|
---|
| 33 | // .anyRequest()
|
---|
| 34 | // .authenticated().and().formLogin();//ruta na viktor
|
---|
| 35 | // }
|
---|
| 36 | //
|
---|
| 37 | // @Override
|
---|
| 38 | // protected void configure(AuthenticationManagerBuilder auth) throws Exception {
|
---|
| 39 | // auth.authenticationProvider(daoAuthenticationProviderA());
|
---|
| 40 | // }
|
---|
| 41 | //
|
---|
| 42 | // @Bean
|
---|
| 43 | // public DaoAuthenticationProvider daoAuthenticationProviderA() {
|
---|
| 44 | // DaoAuthenticationProvider provider = new DaoAuthenticationProvider();
|
---|
| 45 | // provider.setPasswordEncoder(bCryptPasswordEncoder);
|
---|
| 46 | // provider.setUserDetailsService(administratorService);
|
---|
| 47 | // return provider;
|
---|
| 48 | // }
|
---|
| 49 | //}
|
---|