registration-login-spring-hsql icon indicating copy to clipboard operation
registration-login-spring-hsql copied to clipboard

Email or Password invalid, please verify

Open bantibaghel opened this issue 7 years ago • 3 comments

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.

Thanks, Banti kumar

@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/**");
}

bantibaghel avatar Nov 20 '17 12:11 bantibaghel

Greetings! You've mentioned: "I am using jdbcauthentication. Email and password are available in db and both users-query and roles-query are working perfectly"

In what type does password stores in your database (plain-style password(e.g "abcdefg") or encrypted?)

reborne avatar Nov 30 '17 14:11 reborne

Thanks for your precious response. My problem has been resolved.

Regards, Banti Kumar

On Nov 30, 2017 19:53, "Artyom Ulanchik" [email protected] wrote:

Greetings! You've mentioned: "I am using jdbcauthentication. Email and password are available in db and both users-query and roles-query are working perfectly"

In what type does password stores in your database (plain-style password(e.g "abcdefg") or encrypted?)

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/hellokoding/registration-login-spring-hsql/issues/5#issuecomment-348201893, or mute the thread https://github.com/notifications/unsubscribe-auth/AO9SEfEPFBhQaRFsKNMhjSYT6KhdP17xks5s7rpPgaJpZM4QkMm8 .

bantibaghel avatar Nov 30 '17 14:11 bantibaghel

how to mute the thread i have also same problem

Rajborwade12 avatar Aug 31 '18 08:08 Rajborwade12