private static AuthData GetEncodedAccesToken(AuthData authData, string providerName)
        {
            var prName = (nSupportedCloudConfigurations) Enum.Parse(typeof (nSupportedCloudConfigurations), providerName, true);
            if (prName != nSupportedCloudConfigurations.Google)
                return authData;

            var tokenSecret = ImportConfiguration.GoogleTokenManager.GetTokenSecret(authData.Token);
            var consumerKey = ImportConfiguration.GoogleTokenManager.ConsumerKey;
            var consumerSecret = ImportConfiguration.GoogleTokenManager.ConsumerSecret;

            var accessToken = GoogleDocsAuthorizationHelper.BuildToken(authData.Token, tokenSecret, consumerKey, consumerSecret);
            var storage = new CloudStorage();

            authData.Token = storage.SerializeSecurityTokenToBase64Ex(accessToken, typeof (GoogleDocsConfiguration), null);
            return authData;
        }
        private static AuthData GetEncodedAccesToken(AuthData authData, ProviderTypes provider)
        {
            switch (provider)
            {
            case ProviderTypes.Google:
            case ProviderTypes.GoogleDrive:

                var tokenSecret    = ImportConfiguration.GoogleTokenManager.GetTokenSecret(authData.Token);
                var consumerKey    = ImportConfiguration.GoogleTokenManager.ConsumerKey;
                var consumerSecret = ImportConfiguration.GoogleTokenManager.ConsumerSecret;

                var accessToken = GoogleDocsAuthorizationHelper.BuildToken(authData.Token, tokenSecret, consumerKey, consumerSecret);
                var storage     = new CloudStorage();

                authData.Token = storage.SerializeSecurityTokenToBase64Ex(accessToken, typeof(GoogleDocsConfiguration), null);

                break;
            }

            return(authData);
        }
Esempio n. 3
0
 protected override ICloudStorageAccessToken GetAccessToken()
 {
     return(GoogleDocsAuthorizationHelper.BuildToken("1/wARng6YXxNKBtSwCgCZSGac9G2kjSffXIhS92_gnr-w", "_lvJSY84FIZ0mwWEF65K9Eu6", "auth.teamlab.info", "Vb4PZr05O3Czdyyn0ItMENOj"));
 }