Ok Thank you for support. its works.
[ConnectionStringName("Default")] public class ULBIDCDbContext : AbpDbContext<ULBIDCDbContext> { public ULBIDCDbContext(DbContextOptions<ULBIDCDbContext> options) : base(options) {
}
protected override void OnModelCreating(ModelBuilder builder)
{
base.OnModelCreating(builder);
/* Include modules to your migration db context */
builder.ConfigurePermissionManagement();
builder.ConfigureSettingManagement();
builder.ConfigureBackgroundJobs();
builder.ConfigureAuditLogging();
builder.ConfigureIdentityPro();
builder.ConfigureOpenIddictPro();
builder.ConfigureFeatureManagement();
builder.ConfigureLanguageManagement();
builder.ConfigureSaas();
builder.ConfigureTextTemplateManagement();
builder.ConfigureBlobStoring();
builder.ConfigureGdpr();
}
}
[ConnectionStringName("AbpIdentityServer")] [ReplaceDbContext(typeof(IIdentityProDbContext))] [ReplaceDbContext(typeof(ISaasDbContext))] public class IdentityServerDbContext : AbpDbContext<IdentityServerDbContext>, IIdentityProDbContext, ISaasDbContext { public IdentityServerDbContext(DbContextOptions<IdentityServerDbContext> options) : base(options) {
}
#region Entities from the modules
// Identity
public DbSet<IdentityUser> Users { get; set; }
public DbSet<IdentityRole> Roles { get; set; }
public DbSet<IdentityClaimType> ClaimTypes { get; set; }
public DbSet<OrganizationUnit> OrganizationUnits { get; set; }
public DbSet<IdentitySecurityLog> SecurityLogs { get; set; }
public DbSet<IdentityLinkUser> LinkUsers { get; set; }
public DbSet<IdentityUserDelegation> UserDelegations { get; set; }
// SaaS
public DbSet<Tenant> Tenants { get; set; }
public DbSet<Edition> Editions { get; set; }
public DbSet<TenantConnectionString> TenantConnectionStrings { get; set; }
#endregion
}
like this?
its works but when i logged in in application its not show the logout and other options in menu its only show personal data option.
But i have Auth Server in different solution and application in different solution. i dont want to use same database because i have 3 other application also. i want Common Auth Server for all application so i want different database for Auth Server and Applications has their own database
then how can i change db context for Identity use AbpIdentityServer Database and for ULB use default connection string in Db Context?
namespace ULBIDC.EntityFrameworkCore;
[ReplaceDbContext(typeof(IIdentityProDbContext))] [ReplaceDbContext(typeof(ISaasDbContext))] [ConnectionStringName("Default")] public class ULBIDCDbContext : AbpDbContext<ULBIDCDbContext>, IIdentityProDbContext, ISaasDbContext { ...... }
in db context there is any option to give Identity Connection String?
i have to remove this app.UseDynamicClaims(); also?
i set this to IsDynamicClaimsEnabled to false but same error occured i set ConnectionString AbpIdentity in appsetting.json any other settings?
private void ConfigureAuthentication(ServiceConfigurationContext context) { // context.Services.ForwardIdentityAuthenticationForBearer(OpenIddictValidationAspNetCoreDefaults.AuthenticationScheme); context.Services.Configure<AbpClaimsPrincipalFactoryOptions>(options => { options.IsDynamicClaimsEnabled = true; }); }
its already enabled
hi
Volo.Abp.Identity.IdentityUserManager.GetByIdAsync(Guid id)
Which project does the log come from?
Please share the full request logs.
from Application's Web Project logfile
2024-01-29 10:00:58.413 +05:30 [INF] Request finished HTTP/2 GET https://localhost:44319/_vs/browserLink - 200 null text/javascript; charset=UTF-8 13.2284ms
2024-01-29 10:00:58.413 +05:30 [INF] Executing endpoint 'Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.AbpApplicationConfigurationScriptController.Get (Volo.Abp.AspNetCore.Mvc)'
2024-01-29 10:00:58.414 +05:30 [INF] Route matched with {area = "Abp", action = "Get", controller = "AbpApplicationConfigurationScript", page = ""}. Executing controller action with signature System.Threading.Tasks.Task1[Microsoft.AspNetCore.Mvc.ActionResult] Get() on controller Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.AbpApplicationConfigurationScriptController (Volo.Abp.AspNetCore.Mvc). 2024-01-29 10:00:58.416 +05:30 [DBG] Filling dynamic claims cache for user: 3a10485f-3e23-7e7e-31da-5bdee5aba0af 2024-01-29 10:00:58.416 +05:30 [WRN] User not found: 3a10485f-3e23-7e7e-31da-5bdee5aba0af Volo.Abp.Domain.Entities.EntityNotFoundException: There is no such an entity. Entity type: Volo.Abp.Identity.IdentityUser, id: 3a10485f-3e23-7e7e-31da-5bdee5aba0af at Volo.Abp.Identity.IdentityUserManager.GetByIdAsync(Guid id) at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo) at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue
1.ProceedAsync()
at Volo.Abp.Uow.UnitOfWorkInterceptor.InterceptAsync(IAbpMethodInvocation invocation)
at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func
3 proceed)
at Volo.Abp.Identity.IdentityDynamicClaimsPrincipalContributorCache.<>c__DisplayClass23_0.<<GetAsync>b__0>d.MoveNext()
--- End of stack trace from previous location ---
at Volo.Abp.Caching.DistributedCache2.GetOrAddAsync(TCacheKey key, Func
1 factory, Func1 optionsFactory, Nullable
1 hideErrors, Boolean considerUow, CancellationToken token)
at Volo.Abp.Identity.IdentityDynamicClaimsPrincipalContributorCache.GetAsync(Guid userId, Nullable`1 tenantId)
at Volo.Abp.Identity.IdentityDynamicClaimsPrincipalContributor.ContributeAsync(AbpClaimsPrincipalContributorContext context)
2024-01-29 10:00:58.417 +05:30 [INF] Executing endpoint 'Volo.Abp.AspNetCore.Mvc.ProxyScripting.AbpServiceProxyScriptController.GetAll (Volo.Abp.AspNetCore.Mvc)'
2024-01-29 10:00:58.417 +05:30 [INF] Route matched with {area = "Abp", action = "GetAll", controller = "AbpServiceProxyScript", page = ""}. Executing controller action with signature Microsoft.AspNetCore.Mvc.ActionResult GetAll(Volo.Abp.AspNetCore.Mvc.ProxyScripting.ServiceProxyGenerationModel) on controller Volo.Abp.AspNetCore.Mvc.ProxyScripting.AbpServiceProxyScriptController (Volo.Abp.AspNetCore.Mvc).
2024-01-29 10:00:58.448 +05:30 [INF] Executing action method Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.AbpApplicationConfigurationScriptController.Get (Volo.Abp.AspNetCore.Mvc) - Validation state: "Valid"
2024-01-29 10:00:58.450 +05:30 [INF] Sending file. Request path: '/libs/timeago/jquery.timeago.js'. Physical path: 'D:\Identity Server ABP\Web With Identity\ULBIDC\src\ULBIDC.Web\wwwroot\libs\timeago\jquery.timeago.js'
2024-01-29 10:00:58.450 +05:30 [INF] Sending file. Request path: '/libs/abp/luxon/abp.luxon.js'. Physical path: 'D:\Identity Server ABP\Web With Identity\ULBIDC\src\ULBIDC.Web\wwwroot\libs\abp\luxon\abp.luxon.js'
2024-01-29 10:00:58.450 +05:30 [INF] Sending file. Request path: '/libs/bootstrap-daterangepicker/daterangepicker.js'. Physical path: 'D:\Identity Server ABP\Web With Identity\ULBIDC\src\ULBIDC.Web\wwwroot\libs\bootstrap-daterangepicker\daterangepicker.js'
2024-01-29 10:00:58.450 +05:30 [INF] Request finished HTTP/2 GET https://localhost:44319/libs/abp/luxon/abp.luxon.js?_v=638415968503970000 - 499 1361 application/javascript 87.2179ms
In Auth Server i Used IdentityAuth database and in Application I Used Different database .
in Application i removed below code from WebModule and remove account package
typeof(AbpAccountPublicWebOpenIddictModule), app.UseAbpOpenIddictValidation();
added Volo.Abp.AspNetCore.Authentication.OpenIdConnect this package and typeof(AbpAspNetCoreAuthenticationOpenIdConnectModule) in web project of application
due to different database in application project
[10:00:58 WRN] User not found: 3a10485f-3e23-7e7e-31da-5bdee5aba0af
Volo.Abp.Domain.Entities.EntityNotFoundException: There is no such an entity. Entity type: Volo.Abp.Identity.IdentityUser, id: 3a10485f-3e23-7e7e-31da-5bdee5aba0af
at Volo.Abp.Identity.IdentityUserManager.GetByIdAsync(Guid id)
at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo)
at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue1.ProceedAsync() at Volo.Abp.Uow.UnitOfWorkInterceptor.InterceptAsync(IAbpMethodInvocation invocation) at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter
1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func3 proceed) at Volo.Abp.Identity.IdentityDynamicClaimsPrincipalContributorCache.<>c__DisplayClass23_0.<<GetAsync>b__0>d.MoveNext() --- End of stack trace from previous location --- at Volo.Abp.Caching.DistributedCache
2.GetOrAddAsync(TCacheKey key, Func1 factory, Func
1 optionsFactory, Nullable1 hideErrors, Boolean considerUow, CancellationToken token) at Volo.Abp.Identity.IdentityDynamicClaimsPrincipalContributorCache.GetAsync(Guid userId, Nullable
1 tenantId)
at Volo.Abp.Identity.IdentityDynamicClaimsPrincipalContributor.ContributeAsync(AbpClaimsPrincipalContributorContext context)
Yes ,Thank You but its works if i use same database for both but if i change the database of the application and auth server then its not work...i want Different Database for Auth Server and Different for Application