/// <inheritdoc/> public async Task <HostBasePartAuthUser> GetCurrentUser(HostBasePartAuthJobCurrentUserGetInput input) { HostBasePartAuthUser result; var principal = input.Principal; if (principal == null || !principal.Identity.IsAuthenticated) { result = new HostBasePartAuthUser() { UserName = "******", FullName = "Unknown user" }; } else { var userManager = input.UserManager; result = await GetUserByName(principal.Identity.Name, userManager) .CoreBaseExtTaskWithCurrentCulture(false); } if (result == null) { throw new HostBasePartAuthJobCurrentUserGetException(); } return(result); }
private async Task <HostBasePartAuthUser> GetUserByName( string name, UserManager <DataEntityObjectUser> userManager ) { HostBasePartAuthUser result = null; if (!string.IsNullOrEmpty(name)) { var data = await userManager.FindByNameAsync(name) .CoreBaseExtTaskWithCurrentCulture(false); if (data != null) { result = await data.HostBasePartAuthExtCreateUser(userManager) .CoreBaseExtTaskWithCurrentCulture(false); } } return(result); }