Search in sources :

Example 1 with UserInfo

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);
}
Also used : AuthInfo(com.google.ce.media.contentuploader.message.AuthInfo) ResponseEntity(org.springframework.http.ResponseEntity) UserInfo(com.google.ce.media.contentuploader.message.UserInfo) AnalyticsMessage(com.google.ce.media.contentuploader.message.AnalyticsMessage)

Aggregations

AnalyticsMessage (com.google.ce.media.contentuploader.message.AnalyticsMessage)1 AuthInfo (com.google.ce.media.contentuploader.message.AuthInfo)1 UserInfo (com.google.ce.media.contentuploader.message.UserInfo)1 ResponseEntity (org.springframework.http.ResponseEntity)1