use of com.google.ce.media.contentuploader.message.UserInfo in project gcs-uploader by GoogleCloudPlatform.
the class TokenController method swapCode.
@RequestMapping(value = "/swap", method = RequestMethod.GET)
@ResponseBody
public ResponseEntity<UserInfo> swapCode(@RequestHeader(value = "x-content-upload-offline-code") String offlineCode, @RequestHeader(value = "host") String host, HttpServletRequest request) throws URISyntaxException {
AuthInfo authInfo = authConfig.swapToken(offlineCode, host);
uiMasterController.validateAuthorization();
UserInfo userInfo = new UserInfo();
userInfo.setPictureUrl(authInfo.getPictureUrl());
userInfo.setEmail(authInfo.getEmail());
userInfo.setUserId(authInfo.getUserId());
userInfo.setName(authInfo.getName());
AnalyticsMessage m1 = AnalyticsMessage.from(authInfo, AnalyticsMessage.Event.LOGIN, "Login");
AnalyticsService.getInstance().enqueue(authInfo, m1);
return new ResponseEntity<>(userInfo, HttpStatus.OK);
}
Aggregations