Activities of "sh_erfan"

Thanks for the issue

Hi, Thanks. That solved the problem.

Hi,

I can reproduce the problem, can you create a new project to reproduce and send it to me by email? shiwei.liang@volosoft.com Thanks.

Hi. I sent the requested sample to your email address. Thanks.

Thanks a lot This solved the problem Better to update sample to avoid future duplicate questions

I want to implement resolver for web api project:

Configure<AbpTenantResolveOptions>(options =>
{
    options.AddDomainTenantResolver("{0}.api.getabp.net:44302");
});

Then, I want to go to https://tenant1.api.getabp.net:44302/swagger/index.html When authorizing, I want to be automatically be directed to https://tenant.ids.getabp.net:44301 After that, redirect back to https://tenant1.api.getabp.net:44302/swagger/index.html Now, my swagger client is authorized and the active tenant is tenant1 Hence, current tenant id will tenant1 id. Just like web project.

Hope you understand

Actually this worked for me "https://*.api.getabp.net,https://*.web.getabp.net,https://api.getabp.net:44302" This is solution for host user authorization.

Now, the second part. How should we handle https://tenant1.api.getabp.net:44302/swagger/index.html for tenant1?

Hi there

First simple scenario:

  • Head to DomainTenantResolver/MVC-TIERED
  • Add BookStore_Swagger client to appsettings.json in DbMigrator:
"IdentityServer": {
    "Clients": {
      "BookStore_Web": {
        "ClientId": "BookStore_Web",
        "ClientSecret": "1q2w3e*",
        "RootUrl": "https://{0}.web.getabp.net:44303"
      },
      "BookStore_Swagger": {
        "ClientId": "BookStore_Swagger",
        "ClientSecret": "1q2w3e*",
        "RootUrl": "https://{0}.api.getabp.net:44302"
      }
    }
  • Add BookStore_Swagger client to IdentityDataSeedContributor.cs
//Web Client
var webClientId = configurationSection["BookStore_Web:ClientId"];
if (!webClientId.IsNullOrWhiteSpace())
{
	var webClientRootUrl = configurationSection["BookStore_Web:RootUrl"].EnsureEndsWith('/');

	/* BookStore_Web client is only needed if you created a tiered
	 * solution. Otherwise, you can delete this client. */

	await CreateClientAsync(
		name: webClientId,
		scopes: commonScopes,
		grantTypes: new[] { "hybrid" },
		secret: (configurationSection["BookStore_Web:ClientSecret"] ?? "1q2w3e*").Sha256(),
		redirectUri: $"{webClientRootUrl}signin-oidc",
		postLogoutRedirectUri: $"{webClientRootUrl}signout-callback-oidc",
		frontChannelLogoutUri: $"{webClientRootUrl}Account/FrontChannelLogout",
		corsOrigins: new[] { webClientRootUrl.RemovePostFix("/") }
	);
}

// Swagger Client
var swaggerClientId = configurationSection["BookStore_Swagger:ClientId"];
if (!swaggerClientId.IsNullOrWhiteSpace())
{
	var swaggerRootUrl = configurationSection["BookStore_Swagger:RootUrl"].TrimEnd('/');

	await CreateClientAsync(
		name: swaggerClientId,
		scopes: commonScopes,
		grantTypes: new[] { "authorization_code" },
		secret: (configurationSection["Recruitans_Swagger:ClientSecret"] ?? "1q2w3e*").Sha256(),
		requireClientSecret: false,
		redirectUri: $"{swaggerRootUrl}/swagger/oauth2-redirect.html",
		corsOrigins: new[] { swaggerRootUrl.RemovePostFix("/") }
	);
}
  • Run DbMigrator
  • Run multiple projects (ids, web,api)
  • Open swagger https://api.getabp.net:44302/swagger/index.html and try to authorize using host admin user. it fails on redirection.

This is the initial scenario that I cant use swagger api.

Thanks This solved the problem

public override async Task&lt;IRemoteStreamContent&gt; GetProfilePictureFileAsync(Guid id)
{
    Guid? targetTenantId = null;
    using (DataFilter.Disable&lt;IMultiTenant&gt;())
    {
        var user = await UserRepository.FindAsync(id);
        targetTenantId = user.TenantId;
    }

    using (CurrentTenant.Change(targetTenantId))
    {
        return await base.GetProfilePictureFileAsync(id);
    }
}

Thanks, This solved my problem What about edition features seed contributor? Do you have an example?

Showing 1 to 9 of 9 entries
Made with ❤️ on ABP v8.2.0-preview Updated on March 25, 2024, 15:11