Rev 230 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 230 | Rev 242 | ||
|---|---|---|---|
| Line 1... | Line 1... | ||
| 1 | package br.com.ec.controller.seguranca; |
1 | package br.com.ec.controller.seguranca; |
| 2 | 2 | ||
| 3 | import org.springframework.beans.factory.annotation.Autowired; |
3 | import org.springframework.beans.factory.annotation.Autowired; |
| 4 | import org.springframework.context.annotation.Bean; |
4 | import org.springframework.context.annotation.Bean; |
| 5 | import org.springframework.context.annotation.Configuration; |
5 | import org.springframework.context.annotation.Configuration; |
| 6 | import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; |
- | |
| 7 | import org.springframework.security.config.annotation.web.builders.HttpSecurity; |
- | |
| 8 | import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; |
- | |
| 9 | import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; |
- | |
| - | 6 | //import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
|
|
| - | 7 | //import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
|
| - | 8 | //import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
|
|
| - | 9 | //import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
|
|
| 10 | import org.springframework.security.core.userdetails.UserDetailsService; |
10 | import org.springframework.security.core.userdetails.UserDetailsService; |
| 11 | import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; |
- | |
| 12 | import org.springframework.security.crypto.password.PasswordEncoder; |
- | |
| - | 11 | //import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
|
| - | 12 | //import org.springframework.security.crypto.password.PasswordEncoder;
|
|
| 13 | 13 | ||
| 14 | @Configuration |
- | |
| 15 | @EnableWebSecurity |
- | |
| 16 | public class SecurityConfig extends WebSecurityConfigurerAdapter { |
- | |
| - | 14 | //@Configuration
|
|
| - | 15 | //@EnableWebSecurity
|
|
| - | 16 | public class SecurityConfig /*extends WebSecurityConfigurerAdapter */{ |
|
| 17 | 17 | ||
| 18 | // @Autowired
|
18 | // @Autowired
|
| 19 | // private UserDetailsService userDetailsService;
|
19 | // private UserDetailsService userDetailsService;
|
| 20 | 20 | ||
| 21 | // @Autowired
|
21 | // @Autowired
|
| Line 33... | Line 33... | ||
| 33 | .withUser("admin").password(passwordEncoder().encode("123456")).roles("USER", "ADMIN")
|
33 | .withUser("admin").password(passwordEncoder().encode("123456")).roles("USER", "ADMIN")
|
| 34 | .and()
|
34 | .and()
|
| 35 | .withUser("bruno").password(passwordEncoder().encode("brunolp0910")).roles("USER", "ADMIN");
|
35 | .withUser("bruno").password(passwordEncoder().encode("brunolp0910")).roles("USER", "ADMIN");
|
| 36 | */
|
36 | */
|
| 37 | // }
|
37 | // }
|
| 38 | - | ||
| - | 38 | ||
| - | 39 | /*
|
|
| 39 | @Bean |
40 | @Bean
|
| 40 | public PasswordEncoder passwordEncoder() { |
41 | public PasswordEncoder passwordEncoder() {
|
| 41 | return new BCryptPasswordEncoder(); |
42 | return new BCryptPasswordEncoder();
|
| 42 | }
|
43 | }
|
| 43 | 44 |
|
|
| Line 55... | Line 56... | ||
| 55 | .loginProcessingUrl("/login").permitAll() |
56 | .loginProcessingUrl("/login").permitAll()
|
| 56 | .and() |
57 | .and()
|
| 57 | .logout().logoutUrl("/sistema_security_logout").logoutSuccessUrl("/sistema/login.xhtml?logout=true").invalidateHttpSession(true).permitAll() |
58 | .logout().logoutUrl("/sistema_security_logout").logoutSuccessUrl("/sistema/login.xhtml?logout=true").invalidateHttpSession(true).permitAll()
|
| 58 | .and().csrf().disable(); |
59 | .and().csrf().disable();
|
| 59 | }
|
60 | }
|
| 60 | - | ||
| - | 61 | */
|
|
| 61 | }
|
62 | }
|