From 12d67d42ea6c76e5205a90a411cc326b929a0ada Mon Sep 17 00:00:00 2001 From: Paulo Gustavo Veiga Date: Sat, 23 Mar 2024 23:07:14 -0700 Subject: [PATCH] Add login. --- wise-api/src/main/java/com/wisemapping/model/Account.java | 3 ++- .../src/main/java/com/wisemapping/rest/OAuth2Controller.java | 2 +- .../src/main/java/com/wisemapping/security/JwtTokenUtil.java | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/wise-api/src/main/java/com/wisemapping/model/Account.java b/wise-api/src/main/java/com/wisemapping/model/Account.java index 166920a4..18e040d8 100644 --- a/wise-api/src/main/java/com/wisemapping/model/Account.java +++ b/wise-api/src/main/java/com/wisemapping/model/Account.java @@ -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) { diff --git a/wise-api/src/main/java/com/wisemapping/rest/OAuth2Controller.java b/wise-api/src/main/java/com/wisemapping/rest/OAuth2Controller.java index dbcc4489..4a7131a7 100644 --- a/wise-api/src/main/java/com/wisemapping/rest/OAuth2Controller.java +++ b/wise-api/src/main/java/com/wisemapping/rest/OAuth2Controller.java @@ -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()); } diff --git a/wise-api/src/main/java/com/wisemapping/security/JwtTokenUtil.java b/wise-api/src/main/java/com/wisemapping/security/JwtTokenUtil.java index ef710352..20841163 100644 --- a/wise-api/src/main/java/com/wisemapping/security/JwtTokenUtil.java +++ b/wise-api/src/main/java/com/wisemapping/security/JwtTokenUtil.java @@ -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 ...