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 4a7131a7..06b8766c 100644 --- a/wise-api/src/main/java/com/wisemapping/rest/OAuth2Controller.java +++ b/wise-api/src/main/java/com/wisemapping/rest/OAuth2Controller.java @@ -57,8 +57,10 @@ public class OAuth2Controller extends BaseController { @ResponseStatus(value = HttpStatus.OK) public RestOath2CallbackResponse processGoogleCallback(@NotNull @RequestParam String code, @NotNull HttpServletResponse response, @NotNull HttpServletRequest request) throws WiseMappingException { final Account user = userService.createAndAuthUserFromGoogle(code); + + String jwtToken = null; if (user.getGoogleSync()) { - jwtTokenUtil.doLogin(response, user.getEmail()); + jwtToken = jwtTokenUtil.doLogin(response, user.getEmail()); } // Response ... @@ -66,6 +68,7 @@ public class OAuth2Controller extends BaseController { result.setEmail(user.getEmail()); result.setGoogleSync(user.getGoogleSync()); result.setSyncCode(user.getSyncCode()); + result.setJwtToken(jwtToken); return result; } diff --git a/wise-api/src/main/java/com/wisemapping/rest/model/RestOath2CallbackResponse.java b/wise-api/src/main/java/com/wisemapping/rest/model/RestOath2CallbackResponse.java index f8b040f3..3e10259d 100644 --- a/wise-api/src/main/java/com/wisemapping/rest/model/RestOath2CallbackResponse.java +++ b/wise-api/src/main/java/com/wisemapping/rest/model/RestOath2CallbackResponse.java @@ -1,33 +1,51 @@ package com.wisemapping.rest.model; +import com.fasterxml.jackson.annotation.JsonAutoDetect; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; + +@JsonAutoDetect( + fieldVisibility = JsonAutoDetect.Visibility.NONE, + setterVisibility = JsonAutoDetect.Visibility.PUBLIC_ONLY, + isGetterVisibility = JsonAutoDetect.Visibility.NONE, + getterVisibility = JsonAutoDetect.Visibility.PUBLIC_ONLY +) +@JsonIgnoreProperties(ignoreUnknown = true) public class RestOath2CallbackResponse { - private String email; - private Boolean googleSync; - private String syncCode; + private String email; + private Boolean googleSync; + private String syncCode; + private String jwtToken; - public String getEmail() { - return email; - } + public String getEmail() { + return email; + } - public void setEmail(String email) { - this.email = email; - } + public void setEmail(String email) { + this.email = email; + } - public Boolean getGoogleSync() { - return googleSync; - } + public Boolean getGoogleSync() { + return googleSync; + } - public void setGoogleSync(Boolean googleSync) { - this.googleSync = googleSync; - } + public void setGoogleSync(Boolean googleSync) { + this.googleSync = googleSync; + } - public String getSyncCode() { - return syncCode; - } + public String getSyncCode() { + return syncCode; + } - public void setSyncCode(String syncCode) { - this.syncCode = syncCode; - } + public void setSyncCode(String syncCode) { + this.syncCode = syncCode; + } + public String getJwtToken() { + return jwtToken; + } + + public void setJwtToken(String jwtToken) { + this.jwtToken = jwtToken; + } }