Hello everyone, Is there any way to make active directory integration in Umbraco 10 on the login screen to backOffice without using Azure, Google or any External login provider like OpenID. I searched a lot on this topic, so I found a lot of solutions and packages in the old versions of Umbraco. All I need that I want to override the login screen of backOffice and use my custom Active Directory without using third party middleware like OpenID.
I created a class that extended BackOfficeSignInManager and overrode it's PasswordSignInAsync(string, string, bool, bool) function. You will also need to include System.DirectoryServices.AccountManagement from NuGet.
public class ActiveDirectorySignInManager : BackOfficeSignInManager
{
// there will be a couple constructors that must be present
public override async Task<SignInResult> PasswordSignInAsync(string username, string password, bool isPersistent,
bool lockoutOnFailure)
{
// umbraco admin account does not use AD.
if (username == "admin")
return await base.PasswordSignInAsync(username, password, isPersistent, lockoutOnFailure);
// validate user in AD
using var pc = new PrincipalContext(ContextType.Domain, "domain");
using var adUser = UserPrincipal.FindByIdentity(pc, username);
if (adUser == null || !pc.ValidateCredentials(username, password))
return SignInResult.Failed;
// creates a user account in Umbraco
var user = await UserManager.FindByNameAsync(username);
if (user == null)
{
var createResult = await UserManager.CreateAsync(BackOfficeIdentityUser.CreateNew(_globalSettings.Value,
username, "[email protected]",
"en-US", adUser.Name));
if (!createResult.Succeeded)
return SignInResult.Failed;
user = await UserManager.FindByNameAsync(username);
if (user == null)
return SignInResult.Failed;
}
await base.SignInAsync(user, false);
return SignInResult.Success;
}
}
Then in the Startup.cs ConfigureServices method, I added a Replace.
Active Directory BackOffice Users in Umbraco 10
Hello everyone, Is there any way to make active directory integration in Umbraco 10 on the login screen to backOffice without using Azure, Google or any External login provider like OpenID. I searched a lot on this topic, so I found a lot of solutions and packages in the old versions of Umbraco. All I need that I want to override the login screen of backOffice and use my custom Active Directory without using third party middleware like OpenID.
I created a class that extended BackOfficeSignInManager and overrode it's PasswordSignInAsync(string, string, bool, bool) function. You will also need to include System.DirectoryServices.AccountManagement from NuGet.
Then in the Startup.cs ConfigureServices method, I added a Replace.
It's not perfect, there's some functionality I still need to add, but it's a place to start.
is working on a reply...