Rev 226 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 226 | Rev 230 | ||
|---|---|---|---|
| Line 44... | Line 44... | ||
| 44 | @Override |
44 | @Override |
| 45 | protected void configure(HttpSecurity http) throws Exception { |
45 | protected void configure(HttpSecurity http) throws Exception { |
| 46 | http.authorizeRequests() |
46 | http.authorizeRequests() |
| 47 | .antMatchers("/sistema/login**").permitAll() |
47 | .antMatchers("/sistema/login**").permitAll() |
| 48 | .antMatchers("/sistema/**").authenticated() |
48 | .antMatchers("/sistema/**").authenticated() |
| 49 | // .anyRequest().authenticated()
|
- | |
| 50 | // .anyRequest().hasAnyRole("ADMIN", "USER")
|
- | |
| 51 | .and().authorizeRequests() |
49 | .and().authorizeRequests() |
| 52 | .and() |
50 | .and() |
| 53 | .formLogin() |
51 | .formLogin() |
| 54 | .loginPage("/sistema/login.xhtml") |
52 | .loginPage("/sistema/login.xhtml") |
| 55 | .defaultSuccessUrl("/sistema/pagina_inicial.xhtml") |
53 | .defaultSuccessUrl("/sistema/pagina_inicial.xhtml") |
| 56 | .failureUrl("/sistema/login.xhtml?login_error=1") |
54 | .failureUrl("/sistema/login.xhtml?login_error=1") |
| 57 | .loginProcessingUrl("/login").permitAll() |
55 | .loginProcessingUrl("/login").permitAll() |
| 58 | .and() |
56 | .and() |
| 59 | .logout().logoutUrl("/sistema_security_logout").logoutSuccessUrl("/sistema/login.xhtml?logout=true").invalidateHttpSession(true).permitAll() |
57 | .logout().logoutUrl("/sistema_security_logout").logoutSuccessUrl("/sistema/login.xhtml?logout=true").invalidateHttpSession(true).permitAll() |
| 60 | .and().csrf().disable(); |
58 | .and().csrf().disable(); |
| 61 | // <logout logout-url="/sistema_security_logout" logout-success-url="/sistema/index.xhtml"/>
|
- | |
| 62 | /*
|
- | |
| 63 | http.authorizeRequests()
|
- | |
| 64 | .antMatchers("/sistema/mega").permitAll()
|
- | |
| 65 | .antMatchers("/sistema/home").permitAll()
|
- | |
| 66 | .antMatchers("/sistema/login").permitAll()
|
- | |
| 67 | .antMatchers("/sistema/**").hasAnyRole("ADMIN", "USER")
|
- | |
| 68 | //.antMatchers("/sistema/**").authenticated()
|
- | |
| 69 | .and()
|
- | |
| 70 | .formLogin()
|
- | |
| 71 | .loginPage("/sistema/login.xhtml")
|
- | |
| 72 | .defaultSuccessUrl("/sistema/home.xhtml")
|
- | |
| 73 | .failureUrl("/sistema/login.xhtml?error=true")
|
- | |
| 74 | .permitAll()
|
- | |
| 75 | .and()
|
- | |
| 76 | .logout()
|
- | |
| 77 | .logoutSuccessUrl("/sistema/login.xhtml?logout=true")
|
- | |
| 78 | .invalidateHttpSession(true)
|
- | |
| 79 | .permitAll()
|
- | |
| 80 | .and()
|
- | |
| 81 | .csrf()
|
- | |
| 82 | .disable();
|
- | |
| 83 | */
|
- | |
| 84 | }
|
59 | }
|
| 85 | 60 | ||
| 86 | }
|
61 | }
|