/// <summary> /// Writes a token for a target URI to the token store /// </summary> /// <param name="targetUri">The URI of the target for which a token is being stored</param> /// <param name="token">The token to be stored</param> public async Task <bool> WriteToken(TargetUri targetUri, Token token) { ValidateTargetUri(targetUri); Token.Validate(token); string targetName = GetTargetName(targetUri); return(WriteToken(targetName, token) && await _tokenCache.WriteToken(targetUri, token)); }
/// <summary> /// Writes a token for a target URI to the token store /// </summary> /// <param name="targetUri">The URI of the target for which a token is being stored</param> /// <param name="token">The token to be stored</param> public bool WriteToken(TargetUri targetUri, Token token) { ValidateTargetUri(targetUri); Token.Validate(token); string targetName = GetTargetName(targetUri); return(WriteToken(targetName, token) && _tokenCache.WriteToken(targetUri, token)); }
/// <summary> /// Writes a token for a target URI to the token store /// </summary> /// <param name="targetUri">The URI of the target for which a token is being stored</param> /// <param name="token">The token to be stored</param> public void WriteToken(TargetUri targetUri, Token token) { ValidateTargetUri(targetUri); Token.Validate(token); string targetName = GetTargetName(targetUri); WriteToken(targetName, token); _tokenCache.WriteToken(targetUri, token); }
/// <summary> /// Writes a token for a target URI to the token store /// </summary> /// <param name="targetUri">The URI of the target for which a token is being stored</param> /// <param name="token">The token to be stored</param> public void WriteToken(TargetUri targetUri, Token token) { ValidateTargetUri(targetUri); Token.Validate(token); Trace.WriteLine("TokenStore::ReadToken"); string targetName = this.GetTargetName(targetUri); _tokenCache.WriteToken(targetUri, token); this.WriteToken(targetName, token); }
/// <summary> /// Writes a token to the cache. /// </summary> /// <param name="targetUri">The key which to index the token by.</param> /// <param name="token">The token to write to the cache.</param> public void WriteToken(TargetUri targetUri, Token token) { BaseSecureStore.ValidateTargetUri(targetUri); Token.Validate(token); string targetName = this.GetTargetName(targetUri); lock (_cache) { if (_cache.ContainsKey(targetName)) { _cache[targetName] = token; } else { _cache.Add(targetName, token); } } }
/// <summary> /// Writes a token to the cache. /// </summary> /// <param name="targetUri">The key which to index the token by.</param> /// <param name="token">The token to write to the cache.</param> public Task <bool> WriteToken(TargetUri targetUri, Token token) { BaseSecureStore.ValidateTargetUri(targetUri); Token.Validate(token); string targetName = GetTargetName(targetUri); lock (_cache) { if (_cache.ContainsKey(targetName)) { _cache[targetName] = token; } else { _cache.Add(targetName, token); } } return(Task.FromResult(true)); }