Exemplo n.º 1
0
        public async Task <IList <UserLoginInfo> > GetLoginsAsync(TUser user, CancellationToken cancellationToken)
        {
            ThrowIfDisposed();
            cancellationToken.ThrowIfCancellationRequested();
            log.LogDebug("GetLoginsAsync");

            if (user == null)
            {
                throw new ArgumentNullException("user");
            }

            var logins = new List <UserLoginInfo>();

            var siteGuid = siteSettings.Id;

            if (multiTenantOptions.UseRelatedSitesMode)
            {
                siteGuid = multiTenantOptions.RelatedSiteId;
            }

            var userLogins = await queries.GetLoginsByUser(siteGuid, user.Id, cancellationToken);

            foreach (UserLogin ul in userLogins)
            {
                var l = new UserLoginInfo(ul.LoginProvider, ul.ProviderKey, ul.ProviderDisplayName);
                logins.Add(l);
            }


            return(logins);
        }