Ejemplo n.º 1
0
        /// <inheritdoc/>
        public override async Task <IList <UserLoginInfo> > GetLoginsAsync(TUser user, CancellationToken cancellationToken)
        {
            cancellationToken.ThrowIfCancellationRequested();
            ThrowIfDisposed();
            user.ThrowIfNull(nameof(user));
            var userLogins = await UserLoginsTable.GetLoginsAsync(user.Id);

            return(userLogins.Select(x => new UserLoginInfo(x.LoginProvider, x.ProviderKey, x.ProviderDisplayName)).ToList());
        }
Ejemplo n.º 2
0
 /// <inheritdoc/>
 public override async Task AddLoginAsync(TUser user, UserLoginInfo login, CancellationToken cancellationToken)
 {
     cancellationToken.ThrowIfCancellationRequested();
     ThrowIfDisposed();
     user.ThrowIfNull(nameof(user));
     login.ThrowIfNull(nameof(login));
     UserLogins ??= (await UserLoginsTable.GetLoginsAsync(user.Id)).ToList();
     UserLogins.Add(CreateUserLogin(user, login));
 }
Ejemplo n.º 3
0
        /// <inheritdoc/>
        public override async Task RemoveLoginAsync(TUser user, string loginProvider, string providerKey, CancellationToken cancellationToken)
        {
            cancellationToken.ThrowIfCancellationRequested();
            ThrowIfDisposed();
            user.ThrowIfNull(nameof(user));
            UserLogins ??= (await UserLoginsTable.GetLoginsAsync(user.Id)).ToList();
            var userLogin = await FindUserLoginAsync(user.Id, loginProvider, providerKey, cancellationToken);

            if (userLogin != null)
            {
                UserLogins.Remove(userLogin);
            }
        }