UniStuttgart-VISUS/Visus.LdapAuthentication

Override LdapUserBase "Property set method not found"

antoniolago opened this issue · 2 comments

Hello, while trying to override LdapUserBase like documented:

  public sealed class CustomLdapUser : LdapUserBase
  {
      [LdapAttribute(Schema.ActiveDirectory, "displayName")]
      [Claim(CustomClaimTypes.Nome)]
      public override string DisplayName => base.DisplayName;  
   }

I get:

  {"Property set method not found."}
   at System.Reflection.RuntimePropertyInfo.SetValue(Object obj, Object value, BindingFlags invokeAttr, Binder binder, Object[] index, CultureInfo culture)
   at Visus.LdapAuthentication.LdapUserBase.Assign(LdapEntry entry, LdapConnection connection, ILdapOptions options)
   at Visus.LdapAuthentication.LdapAuthenticationService`1.Login(String username, String password)

I'm currently using

  [LdapAttribute(Schema.ActiveDirectory, "displayName")]
  [Claim(CustomClaimTypes.Nome)]
  public string DisplayName { get; internal set; }

This correctly maps the claims I want but obviously I'm not able to properly access the property ldapUser.DisplayName (it's value is null)

I was able to repro the issue and searching for a fix.

Fixed in Nuget package 1.9.0