问题
I have a following tables
User table
-username
-password
-mobile
OTP
-mobile
-otpCode
-expiry
WebSecurityConfig
http.authorizeRequests().anyRequest().hasAnyRole("ADMIN", "USER")
.and()
.authorizeRequests().antMatchers("/login**").permitAll()
.and()
.formLogin().loginPage("/login").loginProcessingUrl("/loginAction").permitAll()
.and()
.logout().logoutSuccessUrl("/login").permitAll()
.and()
.csrf().disable();
When I attempt login. Spring Security checks User table for username and password. My Use-case is login screen is customised to send otp and Authentication should happen in this flow
- Check Username from User table
- Check otpCode for corresponding user's mobile in OTP table
- If matches flow should complete successful authentication.
来源:https://stackoverflow.com/questions/61804081/replace-spring-security-login-with-otp-verification