Thanks @cotur It's solved and displayed much better.If I want a simple online document preview function, for example: [http://view.officeapps.live.com/op/view.aspx?src= http://video.ch9.ms/build/2011/slides/TOOL-532T_Sutter.pptx]。 Src=“Document absolute path ”,Replace with /api/file-management/file-descriptor/download/fileId, I don’t know if it is possible, or there are other simpler ways
Volo.FileManagement Module
When configure the AbpDistributedEntityEventOptions in the ConfigureServices
options.AutoEventSelectors.AddAll();
It cause AutoMapper.AutoMapperMappingException Mapping types:DirectoryDescriptor -> FileDescriptorEto\FileDescriptor -> FileDescriptorEto
So I have to create a profile class to fix it
public class FileManagementMappingProfile : Profile
{
public FileManagementMappingProfile()
{
CreateMap<FileDescriptor, FileDescriptorEto>();
CreateMap<DirectoryDescriptor, FileDescriptorEto>();
}
}
Volo.FileManagement should configure AbpAutoMapperOptions to add this mappingfile
By the way,UploadFiles only support dropPast. It should support more ways, such as selecting files。
/Pages/Identity/OrganizationUnits/Index.cshtml
The original code is wrong because IndexModel
@using Volo.Abp.Identity.Web.Pages.Identity.Roles
it should be using OrganizationUnits,.it affects abp-style-bundle 、 abp-script-bundle and I have fixed it it by by changing to
@using Volo.Abp.Identity.Web.Pages.Identity.OrganizationUnits
Thanks for your patience to answer, my problem has been solved. **BackendAdminApp.Host **project adds tenant resolution based on second-level domain and Querystring ` Configure
options.TenantResolvers.InsertAfter(
r => r is CurrentUserTenantResolveContributor,
new CustomDomainTenantResolveContributor("{0}.mydomain.com")
);
});
.AddOpenIdConnect("oidc", options =>
{
options.Authority = configuration["AuthServer:Authority"];
options.ClientId = configuration["AuthServer:ClientId"];
options.ClientSecret = configuration["AuthServer:ClientSecret"];
options.RequireHttpsMetadata = false;
options.ResponseType = OpenIdConnectResponseType.CodeIdToken;
options.SaveTokens = true;
options.GetClaimsFromUserInfoEndpoint = true;
options.Scope.Add("profile");
options.Scope.Add("role");
options.Scope.Add("email");
options.Scope.Add("phone");
options.Scope.Add("BackendAdminAppGateway");
options.Scope.Add("BloggingService");
options.ClaimActions.MapAbpClaimTypes();
//// Add the following code
options.Events.OnRedirectToIdentityProvider = redirectContext =>
{
var currentTenant = redirectContext.HttpContext.RequestServices.GetService<ICurrentTenant>();
if (currentTenant.Id.HasValue)
{
var multiTenancyOptions = redirectContext.HttpContext.RequestServices.GetService<IOptions<AbpAspNetCoreMultiTenancyOptions>>().Value;
redirectContext.ProtocolMessage.IssuerAddress += $"?{multiTenancyOptions.TenantKey}=" + currentTenant.Id.Value;
}
return Task.CompletedTask;
};
});
`
AuthServer.Host Add IdentityServerTenantResolveContributor class
` Configure<AbpTenantResolveOptions>(opt =>
{
//opt.TenantResolvers.Add(new IdentityServerTenantResolveContributor());
opt.TenantResolvers.InsertAfter(
r => r is CurrentUserTenantResolveContributor,
new IdentityServerTenantResolveContributor()
);
});
public class IdentityServerTenantResolveContributor : HttpTenantResolveContributorBase
{
public override string Name => "IdentityServer";
protected override string GetTenantIdOrNameFromHttpContextOrNull(ITenantResolveContext context,
HttpContext httpContext)
{
if (httpContext.Request.Path == "/Account/Login" && httpContext.Request.Query.ContainsKey("ReturnUrl"))
{
var interaction = httpContext.RequestServices.GetService<IIdentityServerInteractionService>();
var authorizationContext = AsyncHelper.RunSync(() =>
interaction.GetAuthorizationContextAsync(httpContext.Request.Query["ReturnUrl"]));
if (context != null)
{
//TODO: Reference AspNetCore MultiTenancy module and use options to get the tenant key!
var tenantIdOrName = authorizationContext.Parameters[context.GetAbpAspNetCoreMultiTenancyOptions().TenantKey];
return tenantIdOrName;
}
}
return null;
}
}
`
I did not add DomainTenantResolveContributor in authserver
In priority, CurrentUser>QueryString>RouteTenant>HeaderTenant>Cookie
.
If QueryString resolves to the tenant, the tenant switching box will not be displayed.
It means that QueryString is not effective.
Moreover, the callback url includes many strange characters, and the encodeURIComponent cannot be parsed, but it starts with /Account/Login?ReturnUrl=/connect/authorize/callback?__tenant=ea4a820e-9555-7f83-60c7-39f586e7efe0&client_id=backend-admin-app- client&redirect_uri=
Thanks, it might be another way. redirecting to auth server,the url querystring contain __tenant. But It doesn't work,But I refresh the browser page, The tenant box can be displayed normally.
At first, it seems that the querystring does not work, but after refreshing, the cookies are written and work. I changed the domain name of other tenants, and it is still the previous one unless I refresh again。Can be optimized again without refreshing? refresh after
the redirect url
https://auth.***.***/Account/Login?ReturnUrl=/connect/authorize/callback?**__tenant=cee65354-71d7-9773-a293-39f5672d1da0**&client_id=backend-admin-app-client&redirect_uri=https%3A%2F%2Fgree.****.****%2Fsignin-oidc&response_type=code%20id_token&scope=openid%20profile%20role%20email%20phone%20BackendAdminAppGateway%20BloggingService&response_mode=form_post&nonce=637266918513104558.NzgxYTUxZjQtMWI3Mi00ZTA5LTg1NmUtMGIxZDc5YjllNTYyZDA0ODk2YWQtZTdhMC00YWUzLTk2OWMtNTYxMjE0YWEwYTAy&state=CfDJ8FBiEkjnLbtOocsDyjId0EpHNi_2bYFwLl7Zjlzb5sYzSaRdF1Y6LkqI9qcGBCryDbyMRGNnIoPvBB-5lk1QsMQ0tRpCyfpDmZMv6oCgUwt0NvD23pQTk0qo1U7kb0aTvI89gev410x2gRKS7Jd56tpyeb9d6DvEJ3EGwYkqG0hpMUwhd0bTFsO1JntHcY5zXt1fzlxU13MxBcgo93HHmdDBb5i3HAeA-dBvN3F_22HXlMOUAmbx-OaJ1qlEMbq0I2aLI3aTuTXpa58fqT6Tdp_wBmvCYU9cyV5FsCJrI5ztNJCREcX93O1T1CrEjzio9A&x-client-SKU=ID_NETSTANDARD2_0&x-client-ver=5.5.0.0
If I put it in AuthServer.Host project. It can get submain. It is not tenant what I want, But It's in redirect_url. it is hard to format.
What I want the tenant in the BackendAdminApp.Host‘S URL。IF I put it in BackendAdminApp.Host, It does not work. I may change grand type like Password. but I also have no idea