Base solution for your next web application

Activities of "Bernard"

Hi,

**I wanted to know the method of updating a parent's fields after closing a modal is correct or if there is a simpler way: ** var selectedEntityId = $('#MasterDetailChild_Convention_LigneConventionsId').val();

_modalManager.setBusy(true); _ligneConventionsService .createOrEdit(ligneConvention) .done(function () {

     abp.notify.info(app.localize('SavedSuccessfully'));

         abp.ajax({
             type: 'GET',
             url: '/api/services/app/Conventions/GetConventionForView',
             data: {
                 id: selectedEntityId
             }
         }).done(function (data) {
           
             update_TotalHT(data.convention.totalHT.toFixed(2));
             update_TotalTVA(data.convention.totalTVA.toFixed(2));
             update_TotalTTC(data.convention.totalTTC.toFixed(2));
         });
   


     _modalManager.close();
     abp.event.trigger('app.createOrEditLigneConventionModalSaved');


 }), 

Hi What do you mean by server side ?

Hi,

I trying to install Angular project i have issue :

Answer

Hi,

Sorry i don't understand how i can achieve this ?

Thks for your help

Hi,

The OpenconnectId and Microsoft graph connection seems to work well now. But I'm facing another issue now. When I want to view emails I am systemically redirected by this method which seems to pose an issue.

ERUDYEntityFrameworkCoreModule

[DependsOn( typeof(AbpZeroCoreEntityFrameworkCoreModule), typeof(ERUDYCoreModule) )] public class ERUDYEntityFrameworkCoreModule : AbpModule { /* Used it tests to skip DbContext registration, in order to use in-memory database of EF Core */ public bool SkipDbContextRegistration { get; set; }

 public bool SkipDbSeed { get; set; }

 public override void PreInitialize()
 {
     if (!SkipDbContextRegistration)
     {
         Configuration.Modules.AbpEfCore().AddDbContext<ERUDYDbContext>(options =>
         {
             if (options.ExistingConnection != null)
             {
                 ERUDYDbContextConfigurer.Configure(options.DbContextOptions,
                     options.ExistingConnection);
             }
             else
             {
                 ERUDYDbContextConfigurer.Configure(options.DbContextOptions,
                     options.ConnectionString);
             }
         });
     }

     // Set this setting to true for enabling entity history.
     Configuration.EntityHistory.IsEnabled = false;

     // Uncomment below line to write change logs for the entities below:
     // Configuration.EntityHistory.Selectors.Add("ERUDYEntities", EntityHistoryHelper.TrackedTypes);
     // Configuration.CustomConfigProviders.Add(new EntityHistoryConfigProvider(Configuration));
 }

 public override void Initialize()
 {
     IocManager.RegisterAssemblyByConvention(typeof(ERUDYEntityFrameworkCoreModule).GetAssembly());
 }

 public override void PostInitialize()
 {
     var configurationAccessor = IocManager.Resolve<IAppConfigurationAccessor>();

     using (var scope = IocManager.CreateScope())
     {
         if (!SkipDbSeed && scope.Resolve<DatabaseCheckHelper>()
                 .Exist(configurationAccessor.Configuration["ConnectionStrings:Default"]))
         {
             SeedHelper.SeedHostDb(IocManager);
         }
     }
 }

}

And the resut email display is :

Have you an idea of what causes this issue ?

Thks very much

Hi Ismail,

I finally found the good way :

// Retrieve required permissions from appsettings string[] initialScopes = configuration.GetValue<string>("DownstreamApi:Scopes")?.Split(' ');

var authenticationBuilder = services.AddAuthentication(options => { options.DefaultScheme = "OpenIdConnect"; options.DefaultChallengeScheme = "AzureAd";

if (bool.Parse(configuration["Authentication:OpenId:IsEnabled"])) { if (bool.Parse(configuration["Authentication:AllowSocialLoginSettingsPerTenant"])) { services.AddSingleton<IOptionsMonitor<OpenIdConnectOptions>, TenantBasedOpenIdConnectOptions>(); }

  authenticationBuilder.AddOpenIdConnect(options =>
  {
      options.ClientId = configuration["Authentication:OpenId:ClientId"];
      options.Authority = configuration["Authentication:OpenId:Authority"];
      options.SignedOutRedirectUri = configuration["App:WebSiteRootAddress"] + "Account/Logout";
      options.ResponseType = configuration["Authentication:OpenId:ResponseType"];

      options.TokenValidationParameters = new TokenValidationParameters()
      {
          ValidateIssuer = bool.Parse(configuration["Authentication:OpenId:ValidateIssuer"])
      };

      options.Events.OnTokenValidated = context =>
      {
          var jsonClaimMappings = new List&lt;JsonClaimMap&gt;();
          configuration.GetSection("Authentication:OpenId:ClaimsMapping").Bind(jsonClaimMappings);

          context.AddMappedClaims(jsonClaimMappings);

          return Task.FromResult(0);
      };

      var clientSecret = configuration["Authentication:OpenId:ClientSecret"];
      if (!clientSecret.IsNullOrEmpty())
      {
          options.ClientSecret = clientSecret;
      }
  })**.AddMicrosoftIdentityWebApp(options =>
  {
      options.ClientId = configuration["Authentication:AzureAd:ClientId"];
      options.Instance= configuration["Authentication:AzureAd:Instance"];
      options.TenantId = configuration["Authentication:AzureAd:TenantId"];
      options.SignedOutRedirectUri = configuration["App:WebSiteRootAddress"] + "Account/Logout";
    
      var clientSecret = configuration["Authentication:AzureAd:ClientSecret"];
      if (!clientSecret.IsNullOrEmpty())
      {
          options.ClientSecret = clientSecret;
      }
  }, null, "AzureAd")
  .EnableTokenAcquisitionToCallDownstreamApi(initialScopes)
  .AddMicrosoftGraph(configuration.GetSection("DownstreamApi"))
  .AddInMemoryTokenCaches();**

};

//MS Graph Authentification services.AddAuthentication().AddMicrosoftIdentityWebApp(configuration.GetSection("AzureAd")) .EnableTokenAcquisitionToCallDownstreamApi(configuration.GetValue<string>("DownstreamApi:Scopes")?.Split(' ')) .AddMicrosoftGraph(configuration.GetSection("DownstreamApi")) .AddInMemoryTokenCaches();

Same issue

I follow your example like :

  var authenticationBuilder = services.AddAuthentication();

  if (bool.Parse(configuration["Authentication:OpenId:IsEnabled"]))
  {
      if (bool.Parse(configuration["Authentication:AllowSocialLoginSettingsPerTenant"]))
      {
          services.AddSingleton&lt;IOptionsMonitor&lt;OpenIdConnectOptions&gt;, TenantBasedOpenIdConnectOptions>();
      }

      authenticationBuilder.AddOpenIdConnect(options =>
      {
          options.ClientId = configuration["Authentication:OpenId:ClientId"];
          options.Authority = configuration["Authentication:OpenId:Authority"];
          options.SignedOutRedirectUri = configuration["App:WebSiteRootAddress"] + "Account/Logout";
          options.ResponseType = configuration["Authentication:OpenId:ResponseType"];

          options.TokenValidationParameters = new TokenValidationParameters()
          {
              ValidateIssuer = bool.Parse(configuration["Authentication:OpenId:ValidateIssuer"])
          };

          options.Events.OnTokenValidated = context =>
          {
              var jsonClaimMappings = new List&lt;JsonClaimMap&gt;();
              configuration.GetSection("Authentication:OpenId:ClaimsMapping").Bind(jsonClaimMappings);

              context.AddMappedClaims(jsonClaimMappings);

              return Task.FromResult(0);
          };

          var clientSecret = configuration["Authentication:OpenId:ClientSecret"];
          if (!clientSecret.IsNullOrEmpty())
          {
              options.ClientSecret = clientSecret;
          }
      });

  };


  authenticationBuilder.AddMicrosoftIdentityWebApp(configuration.GetSection("AzureAd"))
  .EnableTokenAcquisitionToCallDownstreamApi(configuration.GetValue&lt;string&gt;("DownstreamApi:Scopes")?.Split(' '))
      .AddMicrosoftGraph(configuration.GetSection("DownstreamApi"))
      .AddInMemoryTokenCaches();
      

but it cause issue

An error occurred while starting the application. InvalidOperationException: Scheme already exists: OpenIdConnect

Microsoft.AspNetCore.Authentication.AuthenticationOptions.AddScheme(string name, Action<AuthenticationSchemeBuilder> configureBuilder) ComponentActivatorException: ComponentActivator: could not instantiate Microsoft.AspNetCore.Authentication.AuthenticationSchemeProvider

Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.CreateInstanceCore(ConstructorCandidate constructor, object[] arguments, Type implType)

InvalidOperationException: Scheme already exists: OpenIdConnect
    Microsoft.AspNetCore.Authentication.AuthenticationOptions.AddScheme(string name, Action&lt;AuthenticationSchemeBuilder&gt; configureBuilder)
    Microsoft.Extensions.Options.OptionsFactory&lt;TOptions&gt;.Create(string name)
    Microsoft.Extensions.Options.UnnamedOptionsManager&lt;TOptions&gt;.get_Value()
    Microsoft.AspNetCore.Authentication.AuthenticationSchemeProvider..ctor(IOptions&lt;AuthenticationOptions&gt; options, IDictionary&lt;string, AuthenticationScheme&gt; schemes)
    lambda_method47(Closure , object[] )
    Castle.Core.Internal.ReflectionUtil.Instantiate(ConstructorInfo ctor, object[] ctorArgs)
    Castle.Core.Internal.ReflectionUtil.Instantiate&lt;TBase&gt;(Type subtypeofTBase, object[] ctorArgs)
    Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.CreateInstanceCore(ConstructorCandidate constructor, object[] arguments, Type implType)

Hi

No, I not able to call AddMicrosoftIdentityWebApp And Openconnect because each uses the same scheme

Question

Hi,

How can i refresh field in View after calling a modal with : _createOrEditModal.open();

Showing 61 to 70 of 134 entries