public AuthorizationService() { _pelicanContext = PelicanContext.CreateFromApplicationSettings(); var cloudStorageAccount = new CloudStorageAccount(new StorageCredentials(_pelicanContext.StorageAccount, _pelicanContext.StorageAccountKey), true); var configuration = new ApiConfiguration(_pelicanContext.ClientKey, _pelicanContext.ClientSecret, _pelicanContext.RedirectUrl); _oauthService = new OAuthService(configuration); _authorizedUserAndFileTable = new AuthorizedUserAndFileTable(cloudStorageAccount, "PelicanConfiguration"); _authorizedUserAndCompanyFile = _authorizedUserAndFileTable.RetrieveInstanceByRowKey("John Azariah"); }
public void SaveToken(string code, IPrincipal user) { var tokens = _oauthService.GetTokens(code); _authorizedUserAndCompanyFile = _authorizedUserAndFileTable.EnsureInstance(new AuthorizedUserAndCompanyFile { UserId = user.Identity.Name, UserName = user.Identity.Name, OAuthToken = JsonConvert.SerializeObject(tokens), CompanyFileId = _pelicanContext.CompanyFileId, }); }