/// <summary> /// Returns the user associated with this login /// </summary> /// <returns/> public Task <BackOfficeIdentityUser> FindAsync(UserLoginInfo login) { ThrowIfDisposed(); if (login == null) { throw new ArgumentNullException("login"); } //get all logins associated with the login id var result = _externalLoginService.Find(login).ToArray(); if (result.Any()) { //return the first user that matches the result BackOfficeIdentityUser output = null; foreach (var l in result) { var user = _userService.GetUserById(l.UserId); if (user != null) { output = Mapper.Map <BackOfficeIdentityUser>(user); break; } } return(Task.FromResult(AssignLoginsCallback(output))); } return(Task.FromResult <BackOfficeIdentityUser>(null)); }
/// <summary> /// Returns the user associated with this login /// </summary> /// <returns/> public Task <BackOfficeIdentityUser> FindAsync(UserLoginInfo login) { ThrowIfDisposed(); if (login == null) { throw new ArgumentNullException("login"); } //get all logins associated with the login id var result = _externalLoginService.Find(login).ToArray(); if (result.Any()) { //return the first member that matches the result var output = (from l in result select _userService.GetUserById(l.UserId) into user where user != null select Mapper.Map <BackOfficeIdentityUser>(user)).FirstOrDefault(); return(Task.FromResult(AssignLoginsCallback(output))); } return(Task.FromResult <BackOfficeIdentityUser>(null)); }
/// <inheritdoc /> protected override Task <IdentityUserLogin <string> > FindUserLoginAsync(string loginProvider, string providerKey, CancellationToken cancellationToken) { cancellationToken.ThrowIfCancellationRequested(); ThrowIfDisposed(); var logins = _externalLoginService.Find(loginProvider, providerKey).ToList(); if (logins.Count == 0) { return(Task.FromResult((IdentityUserLogin <string>)null)); } IIdentityUserLogin found = logins[0]; return(Task.FromResult(new IdentityUserLogin <string> { LoginProvider = found.LoginProvider, ProviderKey = found.ProviderKey, ProviderDisplayName = null, // TODO: We don't store this value so it will be null UserId = found.UserId })); }