Exemple #1
0
 public IAuthorizationState GetAuthorization(Credentials credentials, string authCode)
 {
     var state = GetState();
       var provider = new NativeApplicationClient(GoogleAuthenticationServer.Description, credentials.ClientID, credentials.ClientSecret);
       provider.ProcessUserAuthorization(authCode, state);
       return state;
 }
Exemple #2
0
        public void TestValuesCanBeInlaidCorrectly()
        {
            var credentials = new Credentials {ClientID = "123", ClientSecret = "456"};

              Assert.That(credentials.ClientID, Is.EqualTo("123"));
              Assert.That(credentials.ClientSecret, Is.EqualTo("456"));
        }
Exemple #3
0
 public DriveService GetService(Credentials credentials, RefreshToken refreshToken)
 {
     var provider = GetAppClient(credentials);
       var auth = new OAuth2Authenticator<NativeApplicationClient>(provider, GetAuthorization);
       var service = new DriveService(new BaseClientService.Initializer {Authenticator = auth});
       mRefreshToken = refreshToken;
       return service;
 }
Exemple #4
0
 public static NativeApplicationClient BuildNativeAppClient(Credentials credentials)
 {
     return new NativeApplicationClient(GoogleAuthenticationServer.Description, credentials.ClientID, credentials.ClientSecret);
 }
Exemple #5
0
 public FolderManager(Credentials credentials, RefreshToken refreshToken)
 {
     mService = new GetDriveService().GetService(credentials, refreshToken);
 }
Exemple #6
0
 public void TestDefaultsToNull()
 {
     var credentials = new Credentials();
       Assert.Null(credentials.ClientID);
       Assert.Null(credentials.ClientSecret);
 }
Exemple #7
0
 public GDriveFileManager(Credentials credentials, RefreshToken refreshToken)
 {
     mService = new GetDriveService().GetService(credentials, refreshToken);
       mFileEnum = new FileEnumerator(mService);
 }
Exemple #8
0
 public void Update(Credentials credentials)
 {
     mFile.WriteAllText(mPath, string.Format("{0}{1}{2}", credentials.ClientID, Environment.NewLine, credentials.ClientSecret));
 }
Exemple #9
0
 public string CreateRefreshToken(Credentials credentials, string code)
 {
     return new GetAuthorizationState().GetAuthorization(credentials, code).RefreshToken;
 }
Exemple #10
0
 public void UploadFileWithFolder(string file, string fileTitle, string[] foldersToUpload, Credentials credentials, RefreshToken refreshToken)
 {
     var uploader = new Uploader(credentials, refreshToken);
       uploader.UploadFileWithFolderSet(file, fileTitle, foldersToUpload);
 }
Exemple #11
0
 public string GetAuthUrl(Credentials credentials)
 {
     var result = GetAuthorizationUrl.GetAuthorization(GetAuthorizationUrl.BuildNativeAppClient(credentials));
       return result.ToString();
 }
Exemple #12
0
 public Uploader(Credentials credentials, RefreshToken refreshToken)
 {
     mService = new GetDriveService().GetService(credentials, refreshToken);
 }