예제 #1
0
        public async Task <GetExternalLoginsQueryResult> Handle(GetExternalLoginsQuery query, CancellationToken token)
        {
            var externalLogins = await _externalLoginService.GetExternalLogins();

            return(new GetExternalLoginsQueryResult()
            {
                ExternalLogins = externalLogins
            });
        }
        public async Task <GetUserExternalLoginsQueryResult> Handle(GetUserExternalLoginsQuery query, CancellationToken token)
        {
            var externalLogins = await _externalLoginService.GetExternalLogins();

            var userExternalLogins = await _userExternalLoginService.GetUserExternalLogins(query.User);

            var otherExternalLogins = externalLogins
                                      .Where(el => userExternalLogins
                                             .All(uel => el.LoginProvider != uel.LoginProvider))
                                      .ToList();

            return(new GetUserExternalLoginsQueryResult()
            {
                UserExternalLogins = userExternalLogins,
                OtherExternalLogins = otherExternalLogins
            });
        }
예제 #3
0
        private BackOfficeIdentityUser AssignLoginsCallback(BackOfficeIdentityUser user)
        {
            if (user != null)
            {
                var userId = UserIdToInt(user.Id);
                user.SetLoginsCallback(new Lazy <IEnumerable <IIdentityUserLogin> >(() => _externalLoginService.GetExternalLogins(userId)));
                user.SetTokensCallback(new Lazy <IEnumerable <IIdentityUserToken> >(() => _externalLoginService.GetExternalLoginTokens(userId)));
            }

            return(user);
        }