Base solution for your next web application

Activities of "kylem"

  • What is your product version?: API: v10.4.0 | Client: v10.5.0 [20211006]
  • What is your product type (Angular or MVC)?: Angular
  • What is product framework type (.net framework or .net core)?: .net core
  • What is ABP Framework version? 6.4.0

Hi, I tried configuring the app to authenticate agains openLDAP, for that I followed the guid: https://docs.aspnetzero.com/en/aspnet-core-angular/latest/Features-Angular-Active-Directory

When I tested it I was getting following error:

"ERROR 2021-10-26 18:35:01,333 [107  ] Mvc.ExceptionHandling.AbpExceptionFilter - Object reference not set to an instance of an object.",
      "System.NullReferenceException: Object reference not set to an instance of an object.",
      "   at System.DirectoryServices.AccountManagement.PrincipalContext.ReadServerConfig(String serverName, ServerProperties& properties)",
      "   at System.DirectoryServices.AccountManagement.PrincipalContext.DoServerVerifyAndPropRetrieval()",
      "   at System.DirectoryServices.AccountManagement.PrincipalContext..ctor(ContextType contextType, String name, String container, ContextOptions options, String userName, String password)",
      "   at Abp.Zero.Ldap.Authentication.LdapAuthenticationSource`2.CreatePrincipalContext(TTenant tenant)",
      "   at Abp.Zero.Ldap.Authentication.LdapAuthenticationSource`2.TryAuthenticateAsync(String userNameOrEmailAddress, String plainPassword, TTenant tenant)",
      "   at Abp.Authorization.AbpLogInManager`3.TryLoginFromExternalAuthenticationSourcesAsync(String userNameOrEmailAddress, String plainPassword, TTenant tenant)",
      "   at Abp.Authorization.AbpLogInManager`3.LoginAsyncInternal(String userNameOrEmailAddress, String plainPassword, String tenancyName, Boolean shouldLockout)",
      "   at Abp.Authorization.AbpLogInManager`3.<>c__DisplayClass36_0.<<LoginAsync>b__0>d.MoveNext()",
      "--- End of stack trace from previous location ---",

I searched up other similar issues, and did make sure that Username and email are populated in LDAP, as this was issue few users encountered. However, this seems to be a bit different, as exception is thrown from .LdapAuthenticationSource.CreatePrincipalContext()

One issue which I found and seems related is this: https://github.com/dotnet/runtime/issues/27160

and from it looks like that PrincipalContext cannot work with OpenLDAP (which we use internally). Is that correct? What option do we have?

Regards, Predrag

Hi, I did try your suggestion and I did debug it but ended up with the same exception and pretty much same conclusion that openLDAP is not supported.

I tried initializing PrincipalContext with different parameters and using various ContextOptions, but that didn't help me resolving the issue.

One thing I noticed for PrincipalContext class is that it seems it is supported on Windows platform only:

Would you guys have any suggestion on alternative way of authenticating against openLDAP (e.g using some other .net classes instead of PrincipalContext)? Is there any plan on your side to look into this and provide some solution?

Thanks, Predrag

Thanks. We were able to get users authenticated by using LdapConnection instead of PrincipalContext in TryAuthenticateAsync(). We still need to work on overriding other methods from LdapAuthenticationSource, like UpdateUserAsync(). in any case, it would be nice to have implementation provided by the framework. Regards, Predrag

I guess we can close this issue for now

  • What is your product version? 10.4.0
  • What is your product type (Angular or MVC)? Angular
  • What is product framework type (.net framework or .net core)? .net core
  • What is ABP Framework version? Abp.AspNetZeroCore: 3.0.0, Abp: 6.4.0

Hi, we tried to configure our application to authenticate users using Open ID Connect using Auth0 as provider but got following error:

ERROR 2021-11-24 13:12:11,193 [23   ] Mvc.ExceptionHandling.AbpExceptionFilter - IDX20803: Unable to obtain configuration from: 'System.String'.
System.InvalidOperationException: IDX20803: Unable to obtain configuration from: 'System.String'.
 ---> System.IO.IOException: IDX20807: Unable to retrieve document from: 'System.String'. HttpResponseMessage: 'System.Net.Http.HttpResponseMessage', HttpResponseMessage.Content: 'System.String'.
   at Microsoft.IdentityModel.Protocols.HttpDocumentRetriever.GetDocumentAsync(String address, CancellationToken cancel)
   at Microsoft.IdentityModel.Protocols.OpenIdConnect.OpenIdConnectConfigurationRetriever.GetAsync(String address, IDocumentRetriever retriever, CancellationToken cancel)
   at Microsoft.IdentityModel.Protocols.ConfigurationManager`1.GetConfigurationAsync(CancellationToken cancel)
   --- End of inner exception stack trace ---
   at Microsoft.IdentityModel.Protocols.ConfigurationManager`1.GetConfigurationAsync(CancellationToken cancel)
   at Abp.AspNetZeroCore.Web.Authentication.External.OpenIdConnect.OpenIdConnectAuthProviderApi.ValidateToken(String token, String issuer, IConfigurationManager`1 configurationManager, CancellationToken ct)
   at Abp.AspNetZeroCore.Web.Authentication.External.OpenIdConnect.OpenIdConnectAuthProviderApi.GetUserInfo(String token)
   ...

Authentication was working fine when we tried similar setup with Okta as provider.

After our analysis, it turned out that cause of the issue is same as in ticket 9789: https://support.aspnetzero.com/QA/Questions/9789/Azure-B2C-OpenId-new-user-login-failing

So we followed the suggestion in that ticket (re-implementing OpenIdConnectAuthProviderApi) and that at least partially resolved our issues.

The problem seems to be in current logic used in OpenIdConnectAuthProviderApi, GetUserInfo() method, when Issuer URL is created by appending string '/.well-known/openid-configuration' to pre-configured value of the 'Authority' parameter.

In our case that value already has slash (/) characater at the end and when string '/.well-known/openid-configuration' is appended, it creates URI with double slash character which returns 'page not found'

If we remove one slash character - all is good and correct openid configuration is returned in an call

So we applied small tweak to the logic like this:

var configurationManager = new ConfigurationManager<OpenIdConnectConfiguration>(
                issuer + (issuer.EndsWith("/") ? ".well-known/openid-configuration" : "/.well-known/openid-configuration"),
                new OpenIdConnectConfigurationRetriever(),
                new HttpDocumentRetriever());

but as I mentioned, it resolved issue just partially for us - only for cases when configuration parameter "AllowSocialLoginSettingsPerTenant" is set to true.

In this scenario, I was able to implement my version of OpenIdConnectAuthProviderApi based on source code that was provided in ticket 9789, and instantiate this version inside TenantBasedOpenIdConnectExternalLoginInfoProvider class.

However, ideally, we would like to use same Open ID Configuration for all of our tenants, and thus avoid setting it for each tenant, but for that case I was not able to find a way how to override default OpenIdConnectAuthProviderApi implementation.

in any case,to me this looks like a functionality that can be improved in the OpenIdConnectAuthProviderApi (as we see this is not happening only with Auth0, but with other providers as mentioned in ticket 9789)

Thanks and regards, Predrag

  • What is your product version? 10.4.0
  • What is your product type (Angular or MVC)? Angular
  • What is product framework type (.net framework or .net core)? .net core

Hi, I tried using Power Tools, followed documentation, installed the Tools and tried creating entity. All looks good, I am able to run the tool, I defined entity with few properties but when I run 'Generate' button, tool exits without any error, and all looks good but nothing actually happens.

I checked Tools log files and I always find just those 2 lines:

DEBUG 2021-11-28 18:57:14,689 [1    ] dioExtension.Dialogs.EntityGeneratorForm - Generate entity started.
DEBUG 2021-11-28 18:57:16,429 [1    ] dioExtension.Dialogs.EntityGeneratorForm - Entity successfully generated.

No errors.

I am using Visual Studio 2019.

So, what I am doing wrong?

Thanks, Predrag

  • What is your product version? 10.5.0
  • What is your product type (Angular or MVC)? Angular
  • What is product framework type (.net framework or .net core)? .net core

Hi, I purchased separate private license on Nov 23. I was able to login with it, and download the product, However I am not able to post any questons on the support forum (this one is posted with other account) Also, I didn't recieve any invoice for the purchase.

Thanks, Predrag

OK, I was searching the forum and find this thread: https://support.aspnetzero.com/QA/Questions/9845/Power-Tool-under-VS-2019

That turned out to be my issue as well - so after installing .NET Core 2.2 Runtime for my VS 2019, Power Tool is working fine.

I will close the issue,

Thanks, Predrag

Thanks, information sent. Predrag

  • What is your product version? 11.0.1
  • What is your product type (Angular or MVC)? Angular
  • What is product framework type (.net framework or .net core)? 6.0

1. Issue with Timestamp fields in PostgreSQL

Hi, I tried today migrating to latest version of the framework (11.0.1) end there are couple of issues

We are usign PostgreSQL as a DB. After switching to .NET core 6.0 I also upgraded Npgsql.EntityFrameworkCore.PostgreSQL to version 6. When I started aspnet-core part, I got error:

InvalidCastException: Cannot write DateTime with Kind=Local to PostgreSQL type 'timestamp with time zone', only UTC is supported

I was able to get around the issue by adding this into Configure() method of Startup.cs but I am not sure if this is correct way to do it.

    // workaround for issue when switched to .NET 6.0: 'InvalidCastException: Cannot write DateTime with Kind=Local to PostgreSQL type 'timestamp with time zone', only UTC is supported'
    // solution found here: https://stackoverflow.com/questions/69961449/net6-and-datetime-problem-cannot-write-datetime-with-kind-utc-to-postgresql-ty
    AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true);

2. Links that suppose to open in new tab do not work in Default Theme, but work in Theme 2

One of the Menu items we added is link to external web page that opens in new tab. To achieve this we set externalLink to true in AppMenuItem:

new AppMenuItem('Helpdesk - New Tab', 'Pages.Tenant.Helpdesk.InNewTab', 'flaticon-book', 'https://EXTERNAL_URL_HERE', [], [], true)

Nothing happens when this menu item is clicked. Nothing is recorded in Console as well.

However, if I pick 'Theme 2', external link is correctly opened in new link. Can you please take a look and advice if this is right way to achieve opening external URL in a new tab.

Another minor issue is that although I downloaded version 11.0.1, version strings in the app still say: 11.0.0

Thanks and Regards, Predrag

Showing 1 to 10 of 36 entries