I am making social network login with simple username and password login. Simple login works correctly, Google login also works, but I want to connect users from both logins together. For example if I have a user that logged in with simple login it must be saved in local database, now with Google login I would like to do something similar which would be if user already exists (checking by email in database) I just take all of the info that there is in database, but if user does not exists I would like to take google users information and save it to database. Is there any way of doing it?
public SecurityWebFilterChain configure(ServerHttpSecurity http) {
return http.authorizeExchange()
.anyExchange().authenticated()
.and().oauth2Login()
.and().build();
}
I was thinking maybe there is a way of adding a filter after login is completed to do this. Also I am using webflux for this project. Using 5.1.1 spring version