public override IStorageProviderSession CreateSession(ICloudStorageAccessToken token, ICloudStorageConfiguration configuration) { var skydriveToken = token as OAuth20Token; if (skydriveToken == null) throw new ArgumentException("Cannot create skydrive session with given token", "token"); if (skydriveToken.IsExpired) token = SkyDriveAuthorizationHelper.RefreshToken(skydriveToken); return new SkyDriveStorageProviderSession(token, this, configuration); }
/// <summary> /// finishes the token exchange process /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void webBrowser_DocumentTitleChanged(object sender, EventArgs e) { if (_GeneratedToken == null && wcAuthenticate.Source.ToString().StartsWith(_UsedConfig.AuthorizationCallBack.ToString())) { // 5. try to get the real token _GeneratedToken = DropBoxStorageProviderTools.ExchangeDropBoxRequestTokenIntoAccessToken(_UsedConfig, appKey, appSecret, _CurrentRequestToken); // 6. store the real token to file var cs = new CloudStorage(); if(!Directory.Exists("auth")) { Directory.CreateDirectory("auth"); } cs.SerializeSecurityTokenEx(_GeneratedToken, _UsedConfig.GetType(), null, "auth/token.xml"); // 7. show message box Console.WriteLine(@"ConnectWindow>>> Authentication token stored."); //Show main window var mainWindow = new MainWindowSimple(); mainWindow.Show(); Close(); //System.Windows.Forms.MessageBox.Show(@"Stored token into " + @"auth/token.xml"); } }
public GoogleDocsStorageProviderSession(IStorageProviderService service, ICloudStorageConfiguration configuration, OAuthConsumerContext context, ICloudStorageAccessToken token) { Service = service; ServiceConfiguration = configuration; Context = context; SessionToken = token; }
public override IStorageProviderSession CreateSession(ICloudStorageAccessToken token, ICloudStorageConfiguration configuration) { // get the user credentials var userToken = token as DropBoxToken; var svcConfig = configuration as DropBoxConfiguration; // get the session return this.Authorize(userToken, svcConfig); }
public DropboxNoteUploader() { storage = new CloudStorage(); var dropboxConfig = CloudStorage.GetCloudConfigurationEasy(nSupportedCloudConfigurations.DropBox); ICloudStorageAccessToken accessToken; using (var fs = File.Open("DropBoxStorage.Token", FileMode.Open, FileAccess.Read, FileShare.None)) { accessToken = storage.DeserializeSecurityToken(fs); } storageToken = storage.Open(dropboxConfig, accessToken); InitNoteFolderIfNecessary(); }
/// <summary> /// Starts the async open request /// </summary> /// <param name="callback"></param> /// <param name="configuration"></param> /// <param name="token"></param> /// <returns></returns> public IAsyncResult BeginOpenRequest(AsyncCallback callback, ICloudStorageConfiguration configuration, ICloudStorageAccessToken token) { // build the request data structure OpenRequest request = new OpenRequest(); request.callback = callback; request.result = new AsyncResultEx(request); request.config = configuration; request.token = token; // add to threadpool ThreadPool.QueueUserWorkItem(OpenRequestCallback, request); // return the result return request.result; }
public override IStorageProviderSession CreateSession(ICloudStorageAccessToken token, ICloudStorageConfiguration configuration) { // cast the creds to the right type GenericNetworkCredentials creds = token as GenericNetworkCredentials; // check if url available int status = (int) FtpStatusCode.CommandOK; WebException e = null; _ftpService.PerformSimpleWebCall(configuration.ServiceLocator.ToString(), WebRequestMethods.Ftp.ListDirectory, creds.GetCredential(null, null), null, out status, out e); if (status == (int) FtpStatusCode.NotLoggedIn) throw new UnauthorizedAccessException(); else if (status >= 100 && status < 400) return new FtpStorageProviderSession(token, configuration as FtpConfiguration, this); else return null; }
/// <summary> /// This method opens a session for the implemented storage provider based on an existing /// security token. /// </summary> /// <param name="configuration"></param> /// <param name="token"></param> /// <returns></returns> public ICloudStorageAccessToken Open(ICloudStorageConfiguration configuration, ICloudStorageAccessToken token) { // Verify the compatibility of the credentials if (!_Service.VerifyAccessTokenType(token)) throw new SharpBoxException(SharpBoxErrorCodes.ErrorInvalidCredentialsOrConfiguration); // create a new session _Session = _Service.CreateSession(token, configuration); // check the session if (_Session == null) throw new SharpBoxException(SharpBoxErrorCodes.ErrorInvalidCredentialsOrConfiguration); // return the accesstoken token return _Session.SessionToken; }
public override IStorageProviderSession CreateSession(ICloudStorageAccessToken token, ICloudStorageConfiguration configuration) { // check if url available if (!Directory.Exists(configuration.ServiceLocator.LocalPath)) { try { Directory.CreateDirectory(configuration.ServiceLocator.LocalPath); } catch (Exception) { return null; } } return new CIFSStorageProviderSession(token, configuration as CIFSConfiguration, this); }
/// <summary> /// This method generates a session to a webdav share via username and password /// </summary> /// <param name="token"></param> /// <param name="configuration"></param> /// <returns></returns> public override IStorageProviderSession CreateSession(ICloudStorageAccessToken token, ICloudStorageConfiguration configuration) { // cast the creds to the right type WebDavConfiguration config = configuration as WebDavConfiguration; // build service DavService svc = new DavService(); // check if url available int status = (int) HttpStatusCode.OK; WebException e = null; svc.PerformSimpleWebCall(config.ServiceLocator.ToString(), WebRequestMethodsEx.WebDAV.Options, (token as ICredentials).GetCredential(null, null), null, out status, out e); if (status == (int) HttpStatusCode.Unauthorized) throw new UnauthorizedAccessException(); else if (HttpUtilityEx.IsSuccessCode(status)) return new WebDavStorageProviderSession(token, config, this); else return null; }
public NoteUpdater(string searchPattern = ".png") { SearchPattern = searchPattern; try { Storage = new CloudStorage(); var dropboxConfig = CloudStorage.GetCloudConfigurationEasy(nSupportedCloudConfigurations.DropBox); ICloudStorageAccessToken accessToken; using (var fs = File.Open(Properties.Settings.Default.DropboxTokenFile, FileMode.Open, FileAccess.Read, FileShare.None)) { accessToken = Storage.DeserializeSecurityToken(fs); } storageToken = Storage.Open(dropboxConfig, accessToken); InitFolderIfNecessary(); } catch (Exception ex) { Utilities.UtilitiesLib.LogError(ex); } existingNotes = new Dictionary<int, ICloudFileSystemEntry>(); }
/// <summary> /// Starts the token exchange process /// </summary> private void Authenticate() { // 0. reset token _GeneratedToken = null; // 1. modify dropbox configuration _UsedConfig.APIVersion = DropBoxAPIVersion.V1; // 2. get the request token _CurrentRequestToken = DropBoxStorageProviderTools.GetDropBoxRequestToken(_UsedConfig, appKey, appSecret); if (_CurrentRequestToken == null) { MessageBox.Show("Can't get request token. Check Application Key & Secret values."); return; } // 3. get the authorization url var authUrl = DropBoxStorageProviderTools.GetDropBoxAuthorizationUrl(_UsedConfig, _CurrentRequestToken); // 4. navigate to the AuthUrl wcAuthenticate.Navigate(authUrl); }
/// <summary> /// Verifies if the given credentials are valid webdav credentials /// </summary> /// <param name="token"></param> /// <returns></returns> public override bool VerifyAccessTokenType(ICloudStorageAccessToken token) { return (token is ICredentials); }
/// <summary> /// This method allows to serialize a security token into a base64 string /// </summary> /// <param name="token"></param> /// <param name="configurationType"></param> /// <param name="additionalMetaData"></param> /// <returns></returns> public String SerializeSecurityTokenToBase64Ex(ICloudStorageAccessToken token, Type configurationType, Dictionary<String, String> additionalMetaData) { using(Stream tokenStream = SerializeSecurityTokenEx(token, configurationType, additionalMetaData)) { using(MemoryStream memStream = new MemoryStream()) { // copy to memory StreamHelper.CopyStreamData(this, tokenStream, memStream, null, null); // reset memStream.Position = 0; // convert return Convert.ToBase64String(memStream.ToArray()); } } }
/// <summary> /// This method can be used for serialize a token without have the connection opened :-) /// </summary> /// <param name="token"></param> /// <param name="configurationType"></param> /// <param name="additionalMetaData"></param> /// <returns></returns> public Stream SerializeSecurityTokenEx(ICloudStorageAccessToken token, Type configurationType, Dictionary<String, String> additionalMetaData) { var items = new Dictionary<String, String>(); var stream = new MemoryStream(); var serializer = new DataContractSerializer(items.GetType()); // add the metadata if (additionalMetaData != null) { foreach (KeyValuePair<String, string> kvp in additionalMetaData) { items.Add(TokenMetadataPrefix + kvp.Key, kvp.Value); } } // save the token into our list StoreToken(items, token, configurationType); // write the data to stream serializer.WriteObject(stream, items); // go to start stream.Seek(0, SeekOrigin.Begin); // go ahead return stream; }
/// <summary> /// This method allows to store a security token into a serialization stream /// </summary> /// <param name="token"></param> /// <returns></returns> public Stream SerializeSecurityToken(ICloudStorageAccessToken token) { return SerializeSecurityToken(token, null); }
/// <summary> /// This method opens a session for the implemented storage provider based on an existing /// security token. /// </summary> /// <param name="configuration"></param> /// <param name="token"></param> /// <returns></returns> public ICloudStorageAccessToken Open(ICloudStorageConfiguration configuration, ICloudStorageAccessToken token) { // Verify the compatibility of the credentials if (!_Service.VerifyAccessTokenType(token)) { throw new SharpBoxException(SharpBoxErrorCodes.ErrorInvalidCredentialsOrConfiguration); } // create a new session _Session = _Service.CreateSession(token, configuration); // check the session if (_Session == null) { throw new SharpBoxException(SharpBoxErrorCodes.ErrorInvalidCredentialsOrConfiguration); } // return the accesstoken token return(_Session.SessionToken); }
public override void StoreToken(IStorageProviderSession session, Dictionary<String, String> tokendata, ICloudStorageAccessToken token) { if (token is OAuth20Token) { tokendata.Add(SkyDriveConstants.SerializedDataKey, (token as OAuth20Token).ToJson()); } }
/// <summary> /// This method allows to store a security token into a serialization stream /// </summary> /// <param name="token"></param> /// <returns></returns> public Stream SerializeSecurityToken(ICloudStorageAccessToken token) { return(SerializeSecurityToken(token, null)); }
internal static CloudStorage InitCouldStorage(Form1 form, CloudStorage cloudStorage) { if (IsCloudStorageOpen(cloudStorage)) { return(cloudStorage); } ToolStripStatusLabel toolStripStatusLabel = form.toolStripStatusLabel; try { if (ConfigUtil.GetBoolParameter("ProxyEnabled")) { if (String.IsNullOrEmpty(ConfigUtil.GetStringParameter("ProxyHost"))) { WindowManager.ShowAlertBox(form, LanguageUtil.GetCurrentLanguageString("ProxyHostRequired", className)); return(null); } WebRequestManager.Instance.SetProxySettings(ConfigUtil.GetStringParameter("ProxyHost"), ConfigUtil.GetIntParameter("ProxyPort"), ProxyUtil.InitNetworkCredential()); } DropBoxConfiguration standardConfiguration = DropBoxConfiguration.GetStandardConfiguration(); try //I try to authenticate myself with previous access token { using (Stream tokenStream = new MemoryStream(Encoding.UTF8.GetBytes(PasswordUtil.GetStringParameter("LastDropboxAccessToken")))) //ConfigUtil.GetStringParameter("LastDropboxAccessToken") { if (tokenStream.Length == 0) { throw new UnauthorizedAccessException(); } cloudStorage = new CloudStorage(); cloudStorage.Open(standardConfiguration, cloudStorage.DeserializeSecurityToken(tokenStream)); //cloudStorage.DeserializeSecurityToken(tokenStream, standardConfiguration) } } catch (Exception) //No way, I should renew my access token { standardConfiguration.AuthorizationCallBack = new Uri(ConstantUtil.dropboxAuthUrl); DropBoxRequestToken requestToken = DropBoxStorageProviderTools.GetDropBoxRequestToken(standardConfiguration, ConstantUtil.dropboxConsumerKey, ConstantUtil.dropboxConsumerSecret); if (requestToken == null) { throw new UnauthorizedAccessException(); } if (WindowManager.ShowInternalBrowser(form, DropBoxStorageProviderTools.GetDropBoxAuthorizationUrl(standardConfiguration, requestToken)) == DialogResult.Cancel) { return(null); } //OtherManager.StartProcess(form, DropBoxStorageProviderTools.GetDropBoxAuthorizationUrl(standardConfiguration, requestToken)); //if (WindowManager.ShowQuestionBox(form, LanguageUtil.GetCurrentLanguageString("SuccessfullyAuth", className)) != DialogResult.Yes) //{ // return null; //} ICloudStorageAccessToken accessToken = DropBoxStorageProviderTools.ExchangeDropBoxRequestTokenIntoAccessToken(standardConfiguration, ConstantUtil.dropboxConsumerKey, ConstantUtil.dropboxConsumerSecret, requestToken); if (accessToken == null) { throw new UnauthorizedAccessException(); } cloudStorage = new CloudStorage(); cloudStorage.Open(standardConfiguration, accessToken); if (ConfigUtil.GetBoolParameter("RememberDropboxAccess")) { using (Stream tokenStream = cloudStorage.SerializeSecurityToken(accessToken)) { PasswordUtil.UpdateParameter("LastDropboxAccessToken", new StreamReader(tokenStream).ReadToEnd()); //ConfigUtil.UpdateParameter("LastDropboxAccessToken", new StreamReader(tokenStream).ReadToEnd()); } } else { PasswordUtil.UpdateParameter("LastDropboxAccessToken", String.Empty); //ConfigUtil.UpdateParameter("LastDropboxAccessToken", String.Empty); } toolStripStatusLabel.Text = LanguageUtil.GetCurrentLanguageString("DropboxLogIn", className); } return(cloudStorage); } catch (UnauthorizedAccessException) { WindowManager.ShowAlertBox(form, LanguageUtil.GetCurrentLanguageString("UnauthorizedAccess", className)); return(null); } catch (UriFormatException) { WindowManager.ShowAlertBox(form, LanguageUtil.GetCurrentLanguageString("UriFormat", className)); return(null); } finally { form.Cursor = Cursors.Default; } }
public override bool VerifyAccessTokenType(ICloudStorageAccessToken token) { return(token is DropBoxToken); }
public override void StoreToken(IStorageProviderSession session, Dictionary <String, string> tokendata, ICloudStorageAccessToken token) { if (token is DropBoxRequestToken) { var requestToken = token as DropBoxRequestToken; tokendata.Add(TokenDropBoxAppKey, requestToken.RealToken.TokenKey); tokendata.Add(TokenDropBoxAppSecret, requestToken.RealToken.TokenSecret); } else { var dropboxToken = token as DropBoxToken; tokendata.Add(TokenDropBoxCredPassword, dropboxToken.TokenSecret); tokendata.Add(TokenDropBoxCredUsername, dropboxToken.TokenKey); tokendata.Add(TokenDropBoxAppKey, dropboxToken.BaseTokenInformation.ConsumerKey); tokendata.Add(TokenDropBoxAppSecret, dropboxToken.BaseTokenInformation.ConsumerSecret); } }
/// <summary> /// Verifies if the given credentials are valid webdav credentials /// </summary> /// <param name="token"></param> /// <returns></returns> public override bool VerifyAccessTokenType(ICloudStorageAccessToken token) { return(token is ICredentials); }
public override void StoreToken(IStorageProviderSession session, Dictionary <string, string> tokendata, ICloudStorageAccessToken token) { if (token is GoogleDocsRequestToken) { var requestToken = token as GoogleDocsRequestToken; tokendata.Add(GoogleDocsConstants.TokenGoogleDocsAppKey, requestToken.RealToken.TokenKey); tokendata.Add(GoogleDocsConstants.TokenGoogleDocsAppSecret, requestToken.RealToken.TokenSecret); } else if (token is GoogleDocsToken) { var gdtoken = token as GoogleDocsToken; tokendata.Add(GoogleDocsConstants.TokenGoogleDocsAppKey, gdtoken.ConsumerKey); tokendata.Add(GoogleDocsConstants.TokenGoogleDocsAppSecret, gdtoken.ConsumerSecret); tokendata.Add(GoogleDocsConstants.TokenGoogleDocsUsername, gdtoken.TokenKey); tokendata.Add(GoogleDocsConstants.TokenGoogleDocsPassword, gdtoken.TokenSecret); } }
public override bool VerifyAccessTokenType(ICloudStorageAccessToken token) { return(token is GoogleDocsToken); }
/// <summary> /// Writes a generic token onto the storage collection /// </summary> /// <param name="session"></param> /// <param name="tokendata"></param> /// <param name="token"></param> public virtual void StoreToken(IStorageProviderSession session, Dictionary <string, string> tokendata, ICloudStorageAccessToken token) { if (token is GenericNetworkCredentials) { var creds = token as GenericNetworkCredentials; tokendata.Add(TokenGenericCredUsername, creds.UserName); tokendata.Add(TokenGenericCredPassword, creds.Password); } }
/// <summary> /// Calling this method with vendor specific configuration settings and token based credentials /// to get access to the cloud storage. The following exceptions are possible: /// /// - System.UnauthorizedAccessException when the user provides wrong credentials /// - AppLimit.CloudComputing.SharpBox.Exceptions.SharpBoxException when something /// happens during cloud communication /// /// </summary> /// <param name="configuration">Vendor specific configuration of the cloud storage</param> /// <param name="token">Vendor specific authorization token</param> /// <returns>A valid access token or null</returns> public ICloudStorageAccessToken Open(ICloudStorageConfiguration configuration, ICloudStorageAccessToken token) { // check state if (IsOpened) { return(null); } // ensures that the right provider will be used SetProviderByConfiguration(configuration); // save the configuration _configuration = configuration; #if !WINDOWS_PHONE && !MONODROID // verify the ssl config if (configuration.TrustUnsecureSSLConnections) { System.Net.ServicePointManager.ServerCertificateValidationCallback = ValidateAllServerCertificates; } // update the max connection settings ServicePointManager.DefaultConnectionLimit = 250; // disable the not well implementes Expected100 header settings ServicePointManager.Expect100Continue = false; #endif // open the cloud connection token = _provider.Open(configuration, token); // ok without Exception every is good IsOpened = true; // return the token return(token); }
/// <summary> /// This method verifies if the given configuration is compatible to the implemented /// service provider. /// </summary> /// <param name="token"></param> /// <returns></returns> public abstract bool VerifyAccessTokenType(ICloudStorageAccessToken token);
/// <summary> /// Refresh expired access token /// </summary> /// <param name="token">Access token</param> /// <returns>Refreshed access token</returns> public static ICloudStorageAccessToken RefreshToken(ICloudStorageAccessToken token) { var sdToken = token as OAuth20Token; if (sdToken == null || !CanRefresh(sdToken)) throw new ArgumentException("Can not refresh given token", "token"); String query = String.Format("client_id={0}&client_secret={1}&redirect_uri={2}&grant_type=refresh_token&refresh_token={3}", sdToken.ClientID, sdToken.ClientSecret, sdToken.RedirectUri, sdToken.RefreshToken); var json = SkyDriveRequestHelper.PerformRequest(SkyDriveConstants.OAuth20TokenUrl, "application/x-www-form-urlencoded", "POST", query, 2); if (json != null) { var refreshed = OAuth20Token.FromJson(json); refreshed.ClientID = sdToken.ClientID; refreshed.ClientSecret = sdToken.ClientSecret; refreshed.RedirectUri = sdToken.RedirectUri; refreshed.Timestamp = DateTime.UtcNow; return refreshed; } return token; }
/// <summary> /// This method generates a session to a webdav share via access token /// </summary> /// <param name="token"></param> /// <param name="configuration"></param> /// <returns></returns> public abstract IStorageProviderSession CreateSession(ICloudStorageAccessToken token, ICloudStorageConfiguration configuration);
public override bool VerifyAccessTokenType(ICloudStorageAccessToken token) { return token is OAuth20Token; }
public void StoreToken(IStorageProviderSession session, Dictionary <string, string> tokendata, ICloudStorageAccessToken token) { _service.StoreToken(session, tokendata, token); }
/// <summary> /// Calling this method with vendor specific configuration settings and token based credentials /// to get access to the cloud storage. The following exceptions are possible: /// /// - System.UnauthorizedAccessException when the user provides wrong credentials /// - AppLimit.CloudComputing.SharpBox.Exceptions.SharpBoxException when something /// happens during cloud communication /// /// </summary> /// <param name="configuration">Vendor specific configuration of the cloud storage</param> /// <param name="token">Vendor specific authorization token</param> /// <returns>A valid access token or null</returns> public ICloudStorageAccessToken Open(ICloudStorageConfiguration configuration, ICloudStorageAccessToken token) { // check state if (IsOpened) return null; // ensures that the right provider will be used SetProviderByConfiguration(configuration); // save the configuration _configuration = configuration; #if !WINDOWS_PHONE && !MONODROID // verify the ssl config if (configuration.TrustUnsecureSSLConnections) System.Net.ServicePointManager.ServerCertificateValidationCallback = ValidateAllServerCertificates; // update the max connection settings ServicePointManager.DefaultConnectionLimit = 250; // disable the not well implementes Expected100 header settings ServicePointManager.Expect100Continue = false; #endif // open the cloud connection token = _provider.Open(configuration, token); // ok without Exception every is good IsOpened = true; // return the token return token; }
/// <summary> /// Starts the async open request /// </summary> /// <param name="callback"></param> /// <param name="configuration"></param> /// <param name="token"></param> /// <returns></returns> public IAsyncResult BeginOpenRequest(AsyncCallback callback, ICloudStorageConfiguration configuration, ICloudStorageAccessToken token) { // build the request data structure OpenRequest request = new OpenRequest(); request.callback = callback; request.result = new AsyncResultEx(request); request.config = configuration; request.token = token; // add to threadpool ThreadPool.QueueUserWorkItem(OpenRequestCallback, request); // return the result return(request.result); }
/// <summary> /// This method allows to store a security token into a serialization stream and /// makes it possible to store a couple of meta data as well /// </summary> /// <param name="token"></param> /// <param name="additionalMetaData"></param> /// <returns></returns> public Stream SerializeSecurityToken(ICloudStorageAccessToken token, Dictionary<String, String> additionalMetaData) { if (!IsOpened) throw new SharpBoxException(SharpBoxErrorCodes.ErrorOpenedConnectionNeeded); return SerializeSecurityTokenEx(token, _configuration.GetType(), additionalMetaData); }
public SkyDriveStorageProviderSession(ICloudStorageAccessToken token, IStorageProviderService service, ICloudStorageConfiguration configuration) { SessionToken = token; Service = service; ServiceConfiguration = configuration; }
/// <summary> /// This method stores a token into a file /// </summary> /// <param name="token"></param> /// <param name="configurationType"></param> /// <param name="additionalMetaData"></param> /// <param name="fileName"></param> public void SerializeSecurityTokenEx(ICloudStorageAccessToken token, Type configurationType, Dictionary<String, String> additionalMetaData, String fileName) { using(FileStream fs = File.Open(fileName, FileMode.Create, FileAccess.Write, FileShare.None)) { using (Stream ts = SerializeSecurityTokenEx(token, configurationType, additionalMetaData)) { // copy StreamHelper.CopyStreamData(this, ts, fs, null, null); } // flush fs.Flush(); // close fs.Close(); } }
/// <summary> /// This method stores the given security token into a tokendictionary /// </summary> /// <param name="tokendata"></param> /// <param name="token"></param> public void StoreToken(Dictionary <String, String> tokendata, ICloudStorageAccessToken token) { _Service.StoreToken(_Session, tokendata, token); }
/// <summary> /// This method stores the content of an access token in to /// a list of string. This list can be serialized. /// </summary> /// <param name="tokendata">Target list</param> /// <param name="token">the token</param> /// <param name="configurationType">type of configguration which is responsable for the token</param> internal void StoreToken(Dictionary<String, String> tokendata, ICloudStorageAccessToken token, Type configurationType) { // add the configuration information into the tokendata.Add(TokenProviderConfigurationType, configurationType.FullName); tokendata.Add(TokenCredentialType, token.GetType().FullName); // get the provider by toke ICloudStorageProviderInternal provider = GetProviderByConfigurationTypeName(configurationType.FullName); // store all the other information to tokendata provider.StoreToken(tokendata, token); }
public override void StoreToken(IStorageProviderSession session, Dictionary <string, string> tokendata, ICloudStorageAccessToken token) { if (token is OAuth20Token) { tokendata.Add(SkyDriveConstants.SerializedDataKey, (token as OAuth20Token).ToJson()); } }
public override bool VerifyAccessTokenType(ICloudStorageAccessToken token) { return(token is OAuth20Token); }
/// <summary> /// A form for token /// </summary> /// <returns>bool true if OK was pressed, false if cancel</returns> public bool ShowConfigDialog() { SettingsForm settingsForm; ILanguage lang = Language.GetInstance(); BackgroundForm backgroundForm = BackgroundForm.ShowAndWait(DropboxPlugin.Attributes.Name, lang.GetString(LangKey.communication_wait)); try { settingsForm = new SettingsForm(this); } finally { backgroundForm.CloseDialog(); } settingsForm.AuthToken = this.DropboxAccessToken; settingsForm.UploadFormat = this.UploadFormat.ToString(); settingsForm.AfterUploadOpenHistory = this.AfterUploadOpenHistory; settingsForm.AfterUploadLinkToClipBoard = this.AfterUploadLinkToClipBoard; DialogResult result = settingsForm.ShowDialog(); if (result == DialogResult.OK) { this.DropboxAccessToken = settingsForm.AuthToken; this.UploadFormat = (OutputFormat)Enum.Parse(typeof(OutputFormat), settingsForm.UploadFormat.ToLower()); this.AfterUploadOpenHistory=settingsForm.AfterUploadOpenHistory; this.AfterUploadLinkToClipBoard=settingsForm.AfterUploadLinkToClipBoard; IniConfig.Save(); // Save DropboxAccessToken from file DropboxUtils.SaveAccessToken(); return true; } return false; }
public bool VerifyAccessTokenType(ICloudStorageAccessToken token) { return _service.VerifyAccessTokenType(token); }
/// <summary> /// This method stores the given security token into a tokendictionary /// </summary> /// <param name="tokendata"></param> /// <param name="token"></param> public void StoreToken(Dictionary<String, String> tokendata, ICloudStorageAccessToken token) { _Service.StoreToken(_Session, tokendata, token); }
public IStorageProviderSession CreateSession(ICloudStorageAccessToken token, ICloudStorageConfiguration configuration) { return _service.CreateSession(token, configuration); }
public CIFSStorageProviderSession(ICloudStorageAccessToken token, CIFSConfiguration config, IStorageProviderService service) { SessionToken = token; ServiceConfiguration = config; Service = service; }
public override IStorageProviderSession CreateSession(ICloudStorageAccessToken token, ICloudStorageConfiguration configuration) { return(new SkyDriveStorageProviderSession(token, this, configuration)); }
public void StoreToken(IStorageProviderSession session, Dictionary<string, string> tokendata, ICloudStorageAccessToken token) { _service.StoreToken(session, tokendata, token); }
public WebDavStorageProviderSession(ICloudStorageAccessToken token, WebDavConfiguration config, IStorageProviderService service) { SessionToken = token; ServiceConfiguration = config; Service = service; }