Add login.

main
Paulo Gustavo Veiga 2024-03-23 23:07:14 -07:00
parent 16e2829598
commit 12d67d42ea
3 changed files with 4 additions and 2 deletions

View File

@ -22,6 +22,7 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import jakarta.persistence.*;
import java.io.Serializable;
import java.util.Calendar;
@ -164,7 +165,7 @@ public class Account
}
public Boolean getGoogleSync() {
return googleSync!=null && googleSync;
return googleSync != null && googleSync;
}
public void setGoogleSync(Boolean googleSync) {

View File

@ -56,7 +56,7 @@ public class OAuth2Controller extends BaseController {
@RequestMapping(method = RequestMethod.POST, value = "googlecallback", produces = {"application/json"})
@ResponseStatus(value = HttpStatus.OK)
public RestOath2CallbackResponse processGoogleCallback(@NotNull @RequestParam String code, @NotNull HttpServletResponse response, @NotNull HttpServletRequest request) throws WiseMappingException {
Account user = userService.createAndAuthUserFromGoogle(code);
final Account user = userService.createAndAuthUserFromGoogle(code);
if (user.getGoogleSync()) {
jwtTokenUtil.doLogin(response, user.getEmail());
}

View File

@ -75,6 +75,7 @@ public class JwtTokenUtil implements Serializable {
@NotNull
public String doLogin(@NotNull HttpServletResponse response, @NotNull String email) {
logger.debug("Performing login:" + email);
final UserDetails userDetails = userDetailsService.loadUserByUsername(email);
// Add JWT in the HTTP header ...