Olá!! por favor, poderiam me auxiliar referente ao Login e Logout? Obrigada!
quando faço o Login aparece o seguinte erro:
HTTP Status 404 - /projetocuidandodaatencao/jquery/jquery.js
type Status report
message /projetocuidandodaatencao/jquery/jquery.js
description The requested resource is not available.
Apache Tomcat/7.0.69
a linha que foi adicionada a classe SecurityConfiguration(abaixo) está acusando erro: está pedindo para criar o metodo and() que não está sendo reconhecido.
.and().logout().logoutRequestMatcher(new AntPathRequestMatcher("/logout"));
classe SecurityConfiguration
package br.com.projeto.cuidandodaatencao.conf;
import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.http.HttpMethod;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
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.WebSecurityConfigurerAdapter;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
//import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
import br.com.projeto.cuidandodaatencao.dao.UsuarioDAO;
@EnableWebSecurity
public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
@Autowired
private UsuarioDAO usuarioDao;
@Override
protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests()
.antMatchers("/alunos/form").hasRole("ADMIN")
.antMatchers("/alunos/CadastroAluno").hasRole("ADMIN")
.antMatchers("/alunos").hasRole("ADMIN")
.antMatchers("/alunos/**").permitAll()
.antMatchers("/resources/**").permitAll()
.antMatchers("/").permitAll()
.anyRequest().authenticated()
.and().formLogin().loginPage("/login").permitAll();
.and().logout().logoutRequestMatcher(new AntPathRequestMatcher("/logout"));
}
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth.userDetailsService(usuarioDao)
.passwordEncoder(new BCryptPasswordEncoder());
}
}