private async Task <IActionResult> PasswordBusiness(string username, string password) { var(id, role, storeId) = await Mediator.Send(new AuthStoreUser { Username = username, Password = password }); var builder = new TicketBuilder() .AddClaim(OpenIdConnectConstants.Claims.Role, role, "access_token") .AddClaim(OpenIdConnectConstants.Claims.Subject, id, "id_token") .AddClaim(OpenIdConnectConstants.Claims.Name, username, "id_token") .AddClaim(ClaimTypes.Role, role, "id_token") .AddClaim(ClaimTypes.Name, username, "id_token") .SetScopes( OpenIdConnectConstants.Scopes.OpenId, OpenIdConnectConstants.Scopes.Profile, OpenIdConnectConstants.Scopes.OfflineAccess); if (storeId != null) { builder.AddClaim("store_id", storeId, "id_token"); } var ticket = builder.GetTicket(); return(SignIn(ticket.Principal, ticket.Properties, ticket.AuthenticationScheme)); }