Open Closed

Single Auth Server With Tenant and Multiple Application #6553


User avatar
0
dipak.z created
  • ABP Framework version: v8.0.0
  • UI Type: MVC
  • Database System: EF Core (PostgreSQL)
  • Tiered (for MVC) or Auth Server Separated (for Angular): yes
  • Exception message and full stack trace:
  • Steps to reproduce the issue:

I want to create Auth Server Which is tenant base and another 3 application which is tenant based and is used Auth Server for Authorization and authentication I want both running on tenant like tenant base is come from Auth Server and applicaton database configure as tenant base and also i want separate admins for different application which can be see specific tenants of application.


33 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Your ULBIDCDbContext has replaced the IIdentityProDbContext, so you have to access the Identity database via Default connection string.

  • User Avatar
    0
    dipak.z created

    then how can i change db context for Identity use AbpIdentityServer Database and for ULB use default connection string in Db Context?

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    I suggest you use the same connection string for authserver and your application because they use the same DBContxt.

  • User Avatar
    0
    dipak.z created

    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

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    Please check these document: https://docs.abp.io/en/abp/latest/Connection-Strings#configure-the-connection-strings https://docs.abp.io/en/abp/latest/Entity-Framework-Core#replace-other-dbcontextes

  • User Avatar
    0
    dipak.z created

    [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&lt;IdentityUser&gt; Users { get; set; }
    public DbSet&lt;IdentityRole&gt; Roles { get; set; }
    public DbSet&lt;IdentityClaimType&gt; ClaimTypes { get; set; }
    public DbSet&lt;OrganizationUnit&gt; OrganizationUnits { get; set; }
    public DbSet&lt;IdentitySecurityLog&gt; SecurityLogs { get; set; }
    public DbSet&lt;IdentityLinkUser&gt; LinkUsers { get; set; }
    public DbSet&lt;IdentityUserDelegation&gt; UserDelegations { get; set; }
    
    // SaaS
    public DbSet&lt;Tenant&gt; Tenants { get; set; }
    public DbSet&lt;Edition&gt; Editions { get; set; }
    public DbSet&lt;TenantConnectionString&gt; 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.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Please create mvc tiered project then check the MyProjectNameMenuContributor of web project.

    You need to add the menu yourself

    abp new BookStore --tiered
    
  • User Avatar
    0
    dipak.z created

    Ok Thank you for support. its works.

Made with ❤️ on ABP v8.2.0-preview Updated on March 25, 2024, 15:11