Käyttäjän "dipak.z" toiminnot

Kysymys
  • ABP Framework version: v5.2.1
  • UI Type: Angular / MVC / Blazor WASM / Blazor Server
  • Database System: EF Core (PostgreSQL)
  • Tiered (for MVC) or Auth Server Separated (for Angular): yes/no
  • Exception message and full stack trace:
  • Steps to reproduce the issue:

I want two swagger UI in one swagger there is default apis which are in default in abp.io project like identity server/client,languages,users,roles etc and in other swagger i want only my created app services apis how can i achieve this?

Vastaus

i tried this but Apis of identity server also shows in swagger i dont want that apis in v2 swagger

[ApiExplorerSettings(GroupName = "v2")] public class SampleAPIAppService : ImageProcessingAPIAppService { [HttpGet] [ApiExplorerSettings(GroupName = "v2")] public int GetVersion() { return 1; } }

in Web Module of project

private void ConfigureSwaggerServices(IServiceCollection services) { services.AddAbpSwaggerGen( options => { options.SwaggerDoc("v1", new OpenApiInfo { Title = "ImageProcessingAPI API", Version = "v1" }); options.SwaggerDoc("v2", new OpenApiInfo { Title = "ImageProcessingAPI API V2", Version = "v2" }); options.DocInclusionPredicate((docName, description) => true); options.CustomSchemaIds(type => type.FullName); } ); }

app.UseAbpSwaggerUI(options => { options.SwaggerEndpoint("/swagger/v1/swagger.json", "ImageProcessingAPI API"); options.SwaggerEndpoint("/swagger/v2/swagger.json", "ImageProcessingAPI API V2"); });

Vastaus

Thank you this is working, but i want two swagger ui in one there is my apis with JWT auth and in 2nd swagger there is default apis of abp, identity server etc there is no token required. for my apis default route /swagger for abp / identity server /admin/swagger

private void ConfigureSwaggerServices(IServiceCollection services) { services.AddAbpSwaggerGen( options => { options.SwaggerDoc("v1", new OpenApiInfo { Title = "ImageProcessingAPI API", Version = "v1" }); options.SwaggerDoc("v2", new OpenApiInfo { Title = "ImageProcessingAPI API V2",Description="v2" , Version = "v2" }); options.DocInclusionPredicate((docName, description) => { return description.ActionDescriptor.IsControllerAction() && docName switch { "v2" => description.GroupName == null || description.GroupName == "v1", "v1" => description.GroupName == null || description.GroupName == "v2", _ => description.GroupName == null || description.GroupName == "v2", }; }); options.IgnoreObsoleteActions(); options.IgnoreObsoleteProperties(); options.CustomSchemaIds(type => type.FullName); } ); }

Vastaus

this add versions in dropdown of swagger ui i want two swagger ui on diff routes like

/admin/swagger /public/swagger

like that

  • 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.

hi

What was the problem or error you got?

I Created Project from abp suite with separate tenant schema and Tiered as Auth Server i created another project with Application Template . now i want to use Auth Server for Authentication and Authorization in this and same for other two projects.because in this already openiddict and login register all. and all projects has own pages and apis and also tenant base and use database of tenant which are configure in auth server tenant.

I Created Different Solution from ABP Suite (Application Template/EF CorePostgres/MVC) in this solution i have Models and its tenant based and i want to use auth server identity (with tenant) use in this solution

Auth Server is in Different solution and its used Different database

In WebModule I added

private void ConfigureAuthentication(ServiceConfigurationContext context, IConfiguration configuration) { context.Services.AddAuthentication(options => { options.DefaultScheme = "Cookies"; options.DefaultChallengeScheme = "oidc"; }) .AddCookie("Cookies", options => { options.ExpireTimeSpan = TimeSpan.FromDays(365); options.CheckTokenExpiration(); }) .AddAbpOpenIdConnect("oidc", options => { options.Authority = configuration["AuthServer:Authority"]; options.RequireHttpsMetadata = configuration.GetValue<bool>("AuthServer:RequireHttpsMetadata"); options.ResponseType = OpenIdConnectResponseType.CodeIdToken;

         options.ClientId = configuration["AuthServer:ClientId"];
         options.ClientSecret = configuration["AuthServer:ClientSecret"];

         options.UsePkce = true;
         options.SaveTokens = true;
         options.GetClaimsFromUserInfoEndpoint = true;

         options.Scope.Add("roles");
         options.Scope.Add("email");
         options.Scope.Add("phone");
         options.Scope.Add("ULB");
     });
 /*
 * This configuration is used when the AuthServer is running on the internal network such as docker or k8s.
 * Configuring the redirecting URLs for internal network and the web
 * The login and the logout URLs are configured to redirect to the AuthServer real DNS for browser.
 * The token acquired and validated from the the internal network AuthServer URL.
 */
 if (configuration.GetValue&lt;bool&gt;("AuthServer:IsContainerized"))
 {
     context.Services.Configure&lt;OpenIdConnectOptions&gt;("oidc", options =>
     {
         options.TokenValidationParameters.ValidIssuers = new[]
         {
                 configuration["AuthServer:MetaAddress"]!.EnsureEndsWith('/'),
                 configuration["AuthServer:Authority"]!.EnsureEndsWith('/')
             };

         options.MetadataAddress = configuration["AuthServer:MetaAddress"]!.EnsureEndsWith('/') +
                                 ".well-known/openid-configuration";

         var previousOnRedirectToIdentityProvider = options.Events.OnRedirectToIdentityProvider;
         options.Events.OnRedirectToIdentityProvider = async ctx =>
         {
             // Intercept the redirection so the browser navigates to the right URL in your host
             ctx.ProtocolMessage.IssuerAddress = configuration["AuthServer:Authority"]!.EnsureEndsWith('/') + "connect/authorize";

             if (previousOnRedirectToIdentityProvider != null)
             {
                 await previousOnRedirectToIdentityProvider(ctx);
             }
         };
         var previousOnRedirectToIdentityProviderForSignOut = options.Events.OnRedirectToIdentityProviderForSignOut;
         options.Events.OnRedirectToIdentityProviderForSignOut = async ctx =>
         {
             // Intercept the redirection for signout so the browser navigates to the right URL in your host
             ctx.ProtocolMessage.IssuerAddress = configuration["AuthServer:Authority"]!.EnsureEndsWith('/') + "connect/logout";

             if (previousOnRedirectToIdentityProviderForSignOut != null)
             {
                 await previousOnRedirectToIdentityProviderForSignOut(ctx);
             }
         };
     });
 }

 context.Services.Configure&lt;AbpClaimsPrincipalFactoryOptions&gt;(options =>
 {
     options.IsDynamicClaimsEnabled = true;
 });

}

then throw when i click on login button =>

An unhandled exception occurred while processing the request. ComponentNotRegisteredException: The requested service 'Volo.Abp.Account.Public.Web.Pages.Account.LoginModel' has not been registered. To avoid this exception, either register a component to provide the service, check for service registration using IsRegistered(), or use the ResolveOptional() method to resolve an optional dependency.

See https://autofac.rtfd.io/help/service-not-registered for more info. Autofac.ResolutionExtensions.ResolveService(IComponentContext context, Service service, IEnumerable<Parameter> parameters)

Stack Query Cookies Headers Routing ComponentNotRegisteredException: The requested service 'Volo.Abp.Account.Public.Web.Pages.Account.LoginModel' has not been registered. To avoid this exception, either register a component to provide the service, check for service registration using IsRegistered(), or use the ResolveOptional() method to resolve an optional dependency. See https://autofac.rtfd.io/help/service-not-registered for more info.

hi

Please share the source code of your WebModule and WebModule.csproj; I think you should remove the account module from the csproj file.

Only From Web Project?

i created Application Template/MVC/EfCore(Postgres) from Abp Suite (No selected any other tired or seprate tenant scehma / public site all are unchecked) and in this in web project i changed ConfigureAuthentication method as per given. not changed anything in web module it is as it is which are created

Näytetään 1 - 10/58 tietueesta
Made with ❤️ on ABP v8.2.0-preview Updated on maaliskuuta 25, 2024, 15.11