Skip to content

Email or Password invalid, please verify spring boot error #8

Description

@Rajborwade12

Hi,
I am facing authentication issue at login time. I am using jdbcauthentication. Email and password are available in db and both users-query and roles-query are working perfectly but email and password does not get match or I think not get from login page. I do not know how it is authenticate. Please help me as soon as possible.

@value("${spring.queries.users-query}")
private String usersQuery;

@value("${spring.queries.roles-query}")
private String rolesQuery;

@OverRide
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
// TODO Auto-generated method stub
auth.jdbcAuthentication()
.usersByUsernameQuery(usersQuery)
.authoritiesByUsernameQuery(rolesQuery)
.dataSource(dataSource)
.passwordEncoder(bCryptPasswordEncoder);
}

@OverRide
protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests()
.antMatchers("/").permitAll()
.antMatchers("/login").permitAll()
.antMatchers("/registration").permitAll()
.antMatchers("/admin/**").hasAnyAuthority("ADMIN").anyRequest()
.authenticated().and().csrf().disable().formLogin()
.loginPage("/login").failureUrl("/login?error=true")
.defaultSuccessUrl("/admin/home")
.usernameParameter("email")
.passwordParameter("password")
.and().logout()
.logoutRequestMatcher(new AntPathRequestMatcher("/logout"))
.logoutUrl("/").and().exceptionHandling()
.accessDeniedPage("/beacon/user/access-denied");

}

@OverRide
public void configure(WebSecurity web) throws Exception {
web.ignoring()
.antMatchers("/resources/","/static/","/css/","/js/","/images/**");
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions