public async Task <Token> GetAsync(string key) { var result = await Collection.FindOneByIdAsync(key).ConfigureAwait(false); if (result == null) { return(null); } return(await _serializer.Deserialize(result)); }
public async Task <RefreshToken> Deserialize(BsonDocument doc) { var token = new RefreshToken(); BsonValue at; if (doc.TryGetValue("accessToken", out at)) { token.AccessToken = await _tokenSerializer.Deserialize(at.AsBsonDocument); } token.CreationTime = doc.GetValueOrDefault("creationTime", token.CreationTime); token.LifeTime = doc.GetValueOrDefault("lifetime", token.LifeTime); token.Version = doc.GetValueOrDefault("version", token.Version); return(token); }