U4-11539 - Unable to cast object of type 'System.Security.Claims.ClaimsIdentity' to type 'Umbraco.Core.Security.UmbracoBackOfficeIdentity'

Created by Gonçalo Chaves 27 Jul 2018, 12:02:37 Updated by Gonçalo Chaves 27 Jul 2018, 12:25:27

I've tried to follow the instructions of the documentation regarding extending umbraco backoffice security by implementing a custom IBackOfficeUserPasswordChecker. Although I've already tried the exact same code that is suggested in a 7.8.3 version and in a clean latest version 7.11, but also returns the same error:

Unable to cast object of type 'System.Security.Claims.ClaimsIdentity' to type 'Umbraco.Core.Security.UmbracoBackOfficeIdentity'

My current implementation at the 'UmbracoCustomOwinStartup' class:

public void Configuration(IAppBuilder app) {

    var applicationContext = ApplicationContext.Current;
    app.ConfigureUserManagerForUmbracoBackOffice<BackOfficeUserManager, BackOfficeIdentityUser>(
        (options, context) =>
            var membershipProvider = Umbraco.Core.Security.MembershipProviderExtensions.GetUsersMembershipProvider().AsUmbracoMembershipProvider();
            var store = new BackOfficeUserStore(
            var userManager = new BackOfficeUserManager(store)
                //Set your own custom IBackOfficeUserPasswordChecker
                BackOfficeUserPasswordChecker = new MyPasswordChecker()
            return userManager;

    //Ensure owin is configured for Umbraco back office authentication

And the MyPasswordChecker class:

internal class MyPasswordChecker : IBackOfficeUserPasswordChecker { public Task CheckPasswordAsync(BackOfficeIdentityUser user, string password) { var result = (password == "test") ? Task.FromResult(BackOfficeUserPasswordCheckerResult.FallbackToDefaultChecker) : Task.FromResult(BackOfficeUserPasswordCheckerResult.InvalidCredentials);

        return Task.FromResult(BackOfficeUserPasswordCheckerResult.ValidCredentials);

Maybe is something that I'm missing? Anyone had this issue before?

What did you expect to happen? To be able to reproduce what the documentation says regarding a custom backoffice password checker

What actually happened? Exception: Unable to cast object of type 'System.Security.Claims.ClaimsIdentity' to type 'Umbraco.Core.Security.UmbracoBackOfficeIdentity'


Sebastiaan Janssen 27 Jul 2018, 12:21:39

Other people have been able to make this work, so it seems something is not quite right with your code.

Make sure to post questions on how to use Umbraco on the forum: https://our.umbraco.com

Gonçalo Chaves 27 Jul 2018, 12:25:27

Hi @sebastiaan, I already asked at the forum, https://our.umbraco.com/forum/extending-umbraco-and-using-the-api//93004-unable-to-cast-object-of-type-systemsecurityclaimsclaimsidentity-to-type-umbracocoresecurityumbracobackofficeidentity do you know what I'm missing?

Priority: Normal

Type: Bug

State: Closed


Difficulty: Normal


Backwards Compatible: True

Fix Submitted:

Affected versions:

Due in version:


Story Points: