How to retrieve user's data from active directory by novell.Directory.LDap.NetStandard library
-
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.
-
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.
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