Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. .NET (Core and Framework)
  4. How to retrieve user's data from active directory by novell.Directory.LDap.NetStandard library

How to retrieve user's data from active directory by novell.Directory.LDap.NetStandard library

Scheduled Pinned Locked Moved .NET (Core and Framework)
asp-netcsharpdatabasedotnetwindows-admin
2 Posts 2 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    ElenaRez
    wrote on last edited by
    #1

    I'm implementing an asp.net core 3.1 project. I connect my project to active directory using Novell.Directory.Ldap.NETStandard and the logged in user also can logged out from the web project. Below is my login method:

    public async Task Login(LoginModel model)
    {
    var result = _authenticationService.ValidateUser("min.fr", model.UserName, model.Password);
    if (result)
    {
    var claims = new List
    {
    new Claim(ClaimTypes.Name, model.UserName),
    new Claim(ClaimTypes.Role, "Administrator")
    };

                    var claimsIdentity = new ClaimsIdentity(
                        claims, CookieAuthenticationDefaults.AuthenticationScheme);
    
    
                    await HttpContext.SignInAsync(
                            CookieAuthenticationDefaults.AuthenticationScheme,
                            new ClaimsPrincipal(claimsIdentity),
                            authProperties);
                }
    
            return RedirectToAction(nameof(MDashboardController.Index), "MDashboard");
    

    }

    Now my problem is I want to show logged in user's image in my web project but I don't know how can I retrieve logged in user's data including his photo from active directory. I appreciate if anyone can suggests me a solution to do it.

    D 1 Reply Last reply
    0
    • E ElenaRez

      I'm implementing an asp.net core 3.1 project. I connect my project to active directory using Novell.Directory.Ldap.NETStandard and the logged in user also can logged out from the web project. Below is my login method:

      public async Task Login(LoginModel model)
      {
      var result = _authenticationService.ValidateUser("min.fr", model.UserName, model.Password);
      if (result)
      {
      var claims = new List
      {
      new Claim(ClaimTypes.Name, model.UserName),
      new Claim(ClaimTypes.Role, "Administrator")
      };

                      var claimsIdentity = new ClaimsIdentity(
                          claims, CookieAuthenticationDefaults.AuthenticationScheme);
      
      
                      await HttpContext.SignInAsync(
                              CookieAuthenticationDefaults.AuthenticationScheme,
                              new ClaimsPrincipal(claimsIdentity),
                              authProperties);
                  }
      
              return RedirectToAction(nameof(MDashboardController.Index), "MDashboard");
      

      }

      Now my problem is I want to show logged in user's image in my web project but I don't know how can I retrieve logged in user's data including his photo from active directory. I appreciate if anyone can suggests me a solution to do it.

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      You're going to have to ask the people that wrote that library. I find it a bit odd that this even exists because Novell ceased to exist back in 2014.

      Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles.
      Dave Kreskowiak

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups