コード例 #1
0
        public async Task SendAndGenerateTwoFactorTokenAsync(string sessionToken, string username)
        {
            var twoFactor = RandomExtensions.GetRandomNumberString(TwoFactorLength);

            var cacheKey = CacheKeys.TwoFactorSession;
            await cache.SetAsync(cacheKey.Name(sessionToken), new TwoFactorSession { TwoFactor = twoFactor, Username = username }, cacheKey.TimeToLive);

            await messageBus.SendMessageAsync(MessageBusName, JsonSerializer.Serialize(new { Value = twoFactor }));
        }