2
Hello. I need some help. I am configuring Spring Security in a JSF Project 2.2. Using Annotation. I’ve been able to configure the filters. But I don’t understand how to configure login Managedbean to search the database and log in to JSF. Below is my Spring Security configuration class
@Configuration
@Enablewebsecurity public class Securityconfig extends Websecurityconfigureradapter {
@Autowired
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
auth.inMemoryAuthentication().withUser("zezinho").password("123456").roles(Constantes.PERMISSAO_USER);
}
@Override
protected void configure(HttpSecurity http) throws Exception {
http.csrf().disable();
http.authorizeRequests()
.antMatchers(Constantes.RESOURCES).permitAll()
.antMatchers(Constantes.PUBLIC + Constantes.URL_ALL).permitAll()
.antMatchers(Constantes.PRIVATE).hasRole(Constantes.PERMISSAO_USER).anyRequest().authenticated()
.and()
.formLogin()
.loginPage(Constantes.PAGE_PUBLIC_URL_LOGIN)
.successForwardUrl(Constantes.PAGE_PRIVATE_URL_PRINCIPAL)
.permitAll();
}
@Override
public void configure(WebSecurity web) throws Exception {
// web.ignoring(). antMatchers("/Resources/**");; }
}
Important to remember that I use Hibernate and a User Table. So. I want to make the user query in Managedbean. and then log in if it exists. Can someone help me?
Thank you very much friend! Helped me a lot!
– Lucas Kulik Chropacz
Hugs! Have a great week :)
– Lucas Kulik Chropacz