Return token.
parent
12d67d42ea
commit
3daebd149a
|
@ -57,8 +57,10 @@ public class OAuth2Controller extends BaseController {
|
||||||
@ResponseStatus(value = HttpStatus.OK)
|
@ResponseStatus(value = HttpStatus.OK)
|
||||||
public RestOath2CallbackResponse processGoogleCallback(@NotNull @RequestParam String code, @NotNull HttpServletResponse response, @NotNull HttpServletRequest request) throws WiseMappingException {
|
public RestOath2CallbackResponse processGoogleCallback(@NotNull @RequestParam String code, @NotNull HttpServletResponse response, @NotNull HttpServletRequest request) throws WiseMappingException {
|
||||||
final Account user = userService.createAndAuthUserFromGoogle(code);
|
final Account user = userService.createAndAuthUserFromGoogle(code);
|
||||||
|
|
||||||
|
String jwtToken = null;
|
||||||
if (user.getGoogleSync()) {
|
if (user.getGoogleSync()) {
|
||||||
jwtTokenUtil.doLogin(response, user.getEmail());
|
jwtToken = jwtTokenUtil.doLogin(response, user.getEmail());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Response ...
|
// Response ...
|
||||||
|
@ -66,6 +68,7 @@ public class OAuth2Controller extends BaseController {
|
||||||
result.setEmail(user.getEmail());
|
result.setEmail(user.getEmail());
|
||||||
result.setGoogleSync(user.getGoogleSync());
|
result.setGoogleSync(user.getGoogleSync());
|
||||||
result.setSyncCode(user.getSyncCode());
|
result.setSyncCode(user.getSyncCode());
|
||||||
|
result.setJwtToken(jwtToken);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,21 @@
|
||||||
package com.wisemapping.rest.model;
|
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 {
|
public class RestOath2CallbackResponse {
|
||||||
|
|
||||||
private String email;
|
private String email;
|
||||||
private Boolean googleSync;
|
private Boolean googleSync;
|
||||||
private String syncCode;
|
private String syncCode;
|
||||||
|
private String jwtToken;
|
||||||
|
|
||||||
public String getEmail() {
|
public String getEmail() {
|
||||||
return email;
|
return email;
|
||||||
|
@ -30,4 +41,11 @@ public class RestOath2CallbackResponse {
|
||||||
this.syncCode = syncCode;
|
this.syncCode = syncCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getJwtToken() {
|
||||||
|
return jwtToken;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setJwtToken(String jwtToken) {
|
||||||
|
this.jwtToken = jwtToken;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue