コード例 #1
0
 public static ICloudStorageAccessToken ExchangeGoogleDocsRequestTokenIntoAccessToken(GoogleDocsConfiguration configuration, String consumerKey, String consumerSecret, GoogleDocsRequestToken requestToken, String oAuthVerifier)
 {
     var consumerContext = new OAuthConsumerContext(consumerKey, consumerSecret);
     var serviceContext = new OAuthServiceContext(configuration.OAuthGetRequestTokenUrl.ToString(),
                                                  configuration.OAuthAuthorizeTokenUrl.ToString(),
                                                  configuration.AuthorizationCallBack.ToString(),
                                                  GetAccessTokenUrl(configuration, oAuthVerifier));
     var service = new OAuthService();
     var accessToken = service.GetAccessToken(serviceContext, consumerContext, requestToken.RealToken);
     if (accessToken == null) throw new UnauthorizedAccessException();
     return new GoogleDocsToken(accessToken, consumerKey, consumerSecret);
 }
        public static ICloudStorageAccessToken ExchangeGoogleDocsRequestTokenIntoAccessToken(GoogleDocsConfiguration configuration, String consumerKey, String consumerSecret, GoogleDocsRequestToken requestToken, String oAuthVerifier)
        {
            var consumerContext = new OAuthConsumerContext(consumerKey, consumerSecret);
            var serviceContext  = new OAuthServiceContext(configuration.OAuthGetRequestTokenUrl.ToString(),
                                                          configuration.OAuthAuthorizeTokenUrl.ToString(),
                                                          configuration.AuthorizationCallBack.ToString(),
                                                          GetAccessTokenUrl(configuration, oAuthVerifier));
            var service     = new OAuthService();
            var accessToken = service.GetAccessToken(serviceContext, consumerContext, requestToken.RealToken);

            if (accessToken == null)
            {
                throw new UnauthorizedAccessException();
            }
            return(new GoogleDocsToken(accessToken, consumerKey, consumerSecret));
        }
 public static String GetGoogleDocsAuthorizationUrl(GoogleDocsConfiguration configuration, GoogleDocsRequestToken token)
 {
     return(OAuthUrlGenerator.GenerateAuthorizationUrl(configuration.OAuthAuthorizeTokenUrl.ToString(),
                                                       configuration.AuthorizationCallBack.ToString(),
                                                       token.RealToken));
 }
コード例 #4
0
 public static String GetGoogleDocsAuthorizationUrl(GoogleDocsConfiguration configuration, GoogleDocsRequestToken token)
 {
     return OAuthUrlGenerator.GenerateAuthorizationUrl(configuration.OAuthAuthorizeTokenUrl.ToString(),
                                                       configuration.AuthorizationCallBack.ToString(),
                                                       token.RealToken);
 }