예제 #1
0
        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,
            });
        }
예제 #2
0
        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");
        }