예제 #1
0
        /// <inheritdoc />
        public async Task <string> StoreAsync(AuthenticationTicket ticket)
        {
            var key = CryptoRandom.CreateUniqueId(format: CryptoRandom.OutputFormat.Hex);

            var session = new UserSession
            {
                Key       = key,
                Created   = ticket.GetIssued(),
                Renewed   = ticket.GetIssued(),
                Expires   = ticket.GetExpiration(),
                SubjectId = ticket.GetSubjectId(),
                SessionId = ticket.GetSessionId(),
                Scheme    = ticket.AuthenticationScheme,
                Ticket    = ticket.Serialize(),
            };

            await _store.CreateUserSessionAsync(session);

            return(key);
        }