I've managed to get backoffice logins working with Active Directory. However, upon initial login, the side-menu does not load, and I get some 417 Invalid token errors in the console.
If I hit F5 to reload the page, the error goes away, and the side-menu is loaded just fine.
This is the code:
var result = Task.FromResult(BackOfficeUserPasswordCheckerResult.InvalidCredentials);
try
{
var pc = new PrincipalContext(ContextType.Domain, WebConfigurationManager.AppSettings["ldapAddress"]);
var isValid = pc.ValidateCredentials(user.UserName, password);
if (isValid)
{
result = Task.FromResult(BackOfficeUserPasswordCheckerResult.ValidCredentials);
}
}
catch (Exception ex)
{
result = Task.FromResult(BackOfficeUserPasswordCheckerResult.InvalidCredentials);
LogHelper.Error(typeof(ActiveDirectoryAuthenticator), "Error logging in using ActiveDirectory", ex);
}
return result;
Note: Some code left out (does not affect the issue at hand)
And this is where I setup the UmbracoCustomOwinStartup:
public class UmbracoCustomOwinStartup
{
public void Configuration(IAppBuilder app)
{
var applicationContext = ApplicationContext.Current;
app.ConfigureUserManagerForUmbracoBackOffice<BackOfficeUserManager, BackOfficeIdentityUser>(
applicationContext,
(options, context) =>
{
var membershipProvider = MembershipProviderExtensions.GetUsersMembershipProvider().AsUmbracoMembershipProvider();
var userManager = BackOfficeUserManager.Create(options,
applicationContext.Services.UserService,
applicationContext.Services.ExternalLoginService,
membershipProvider);
userManager.BackOfficeUserPasswordChecker = new ActiveDirectoryAuthenticator();
return userManager;
});
app.UseUmbracoBackOfficeCookieAuthentication(ApplicationContext.Current)
.UseUmbracoBackOfficeExternalCookieAuthentication(ApplicationContext.Current);
}
}
It seems the cookie being set is not correct, as it changes after I press F5.
I don't have an answer, sorry. However I just posted a request for some help on setting this up. Where did you find the info to progress as far as you have? Are you using Azure Active Directory or vanilla AD?
I'll happily help you troubleshoot this, if I can catch up to where you've got with this.
Active Directory login works, but menu not loading
Hello there.
I've managed to get backoffice logins working with Active Directory. However, upon initial login, the side-menu does not load, and I get some 417 Invalid token errors in the console.
If I hit F5 to reload the page, the error goes away, and the side-menu is loaded just fine.
This is the code:
Note: Some code left out (does not affect the issue at hand)
And this is where I setup the UmbracoCustomOwinStartup:
It seems the cookie being set is not correct, as it changes after I press F5.
Anyone have an idea?
Hi Mark,
I don't have an answer, sorry. However I just posted a request for some help on setting this up. Where did you find the info to progress as far as you have? Are you using Azure Active Directory or vanilla AD?
I'll happily help you troubleshoot this, if I can catch up to where you've got with this.
To answer my question, this is the post I've been looking for: http://skrift.io/articles/archive/authenticate-to-umbraco-73plus-using-active-directory/
That link is dead, try this https://skrift.io/issues/authenticate-to-umbraco-7-3-using-active-directory/
Try this: https://skrift.io/issues/authenticate-to-umbraco-7-3-using-active-directory/
is working on a reply...