Ejemplo n.º 1
0
        public bool LocalizeSessionFile(IBasicAuthenticationKey authKey)
        {
            if (authKey.BaseUrl.IsBlank() || authKey.UserName.IsBlank())
                return Warn_n("Cannot localize session file.",
                        "BaseURL / UserName of AuthKey is blank.");


            var loc  = _fsShim.GetSpecialDir(SpecialDir.LocalApplicationData);
            var typ  = this.GetType().Name;
            var dom  = authKey.BaseUrl.TextAfter("//").Replace(":", "-");
            var usr  = authKey.UserName;//.Replace(" ", "_");
            var end  = "user.session";
            var path = loc.Bslash(typ).Bslash(dom).Bslash(usr).Bslash(end);
            _auth.SessionFile = _fsShim.File(path);

            return true;
        }
Ejemplo n.º 2
0
        private FolderShim DefineCacheFolder(ISessionClient client,
                                             IBasicAuthenticationKey authKey)
        {
            //Throw.IfNull(_fs, "private FileSystemShim");
            //if (_fs == null) return null;

            if (authKey.BaseUrl.IsBlank() || authKey.UserName.IsBlank())
            {
                Warn_n("Unable to define cache folder.",
                       "User name or base URL should not be blank.");
                return(null);
            }


            var loc  = _fs.GetSpecialDir(SpecialDir.LocalApplicationData);
            var typ  = client.GetType().Name;
            var dom  = authKey.BaseUrl.TextAfter("//").Replace(":", "-");
            var usr  = authKey.UserName;//.Replace(" ", "_");
            var end  = "CachedNodes";
            var path = loc.Bslash(typ).Bslash(dom).Bslash(usr).Bslash(end);

            return(_fs.Folder(path));
        }
Ejemplo n.º 3
0
 public async Task<bool> Login(IBasicAuthenticationKey creds, CancellationToken cancelToken)
     => await Login(creds.BaseUrl, creds.UserName, creds.Password, cancelToken);
Ejemplo n.º 4
0
 public override void SetClient(ISessionClient sessionClient, IBasicAuthenticationKey credentials)
 {
     _client      = sessionClient.As <ID7Client>();
     _credentials = credentials;
 }
Ejemplo n.º 5
0
        public D7CachedNodesRepoBase(IFileSystemShim fileSystemShim, ISerializer serializer, ISessionClient client, IBasicAuthenticationKey credentials)
        {
            _fs      = fileSystemShim;
            _serialr = serializer;
            SetClient(client, credentials);

            _cacheLoaded += OnCacheLoaded_RefreshCache;
        }
Ejemplo n.º 6
0
 public virtual void SetClient(ISessionClient sessionClient,
                               IBasicAuthenticationKey credentials)
 {
 }