How do I configure ABP identity in my application to connect to a running ABP instance without full integration?
02:21 19 Jun 2025

Requirement

I am working on a product which is expected to have user login to be able to offer it online. As a start, the idea is to simply add some wrapper/annotation/integrations enough to only redirect to a running instance of ABP app (which can be developed independently for other products as well) and extract user role and permission info.

I am able to redirect to the running identity app and authenticate myself and return to main app, but I have no idea on how to configure the ICurrentUser service from ABP to pick up all requisite data from identity app. We wish to see how usefull it will be for our use cases before fully committing to ABP.

Specs

Tech Version
.Net 8.0
ABP 8.3.4
DB MongoDB 6.0
UI Blazor Server

I have added this in the module class in the main project:

[DependsOn(
    typeof(AbpAspNetCoreModule),
    typeof(AbpAutofacModule)
)]
public class APPAbpModule : AbpModule
{
    public override void OnApplicationInitialization(ApplicationInitializationContext context)
    {
        // Most of this is in Program.cs
        //var app = context.GetApplicationBuilder();
        //var env = context.GetEnvironment();
        //if (!env.IsDevelopment())
        //{
        //    app.UseHsts();
        //}
        //app.UseHttpsRedirection();
        //app.UseAuthentication();
        //app.UseAuthorization();
    }
    public override void ConfigureServices(ServiceConfigurationContext context)
    {
        context
            .Services
                .AddAuthentication(options =>
                {
                    options.DefaultScheme = CookieAuthenticationDefaults.AuthenticationScheme;
                    options.DefaultChallengeScheme = OpenIdConnectDefaults.AuthenticationScheme;
                })
                .AddCookie("Cookies", options =>
                {
                    options.ExpireTimeSpan = TimeSpan.FromDays(365);
                })
                .AddOpenIdConnect(OpenIdConnectDefaults.AuthenticationScheme, options =>>
                {
                    options.Authority = "https://localhost:44331";
                    options.ClientId = "APP_Client";
                    options.ClientSecret = "";
                    options.CallbackPath = "/";

                    options.SignInScheme = CookieAuthenticationDefaults.AuthenticationScheme;
                    options.ResponseType = OpenIdConnectResponseType.Code;

                    options.SaveTokens = true;
                    options.SkipUnrecognizedRequests = true;
                    options.GetClaimsFromUserInfoEndpoint = true;
                    options.RequireHttpsMetadata = true;

                    options.MapInboundClaims = false;
                    options.TokenValidationParameters.NameClaimType = JwtRegisteredClaimNames.Name;
                    options.TokenValidationParameters.RoleClaimType = "roles";
                })
                ;
    }
}

The ABP app is a standard template app from ABP with multi-tenancy, identity, permission and user management (as given by ABP Studio) and only the client info about APP_Client is added in the seeder. 2 permissions have been added for testing.

What do I need to add to my main project to allow ABP to connect to the identity service and fetch required info? The aim here is to have minimal disruption in the way the main product is structured.

c# authentication .net-core microservices abp-framework