Validate BackOffice Credentials in Umbraco 12+
# help-with-umbraco
j
I am trying to refactor some code to work in Umbraco 12+, but I am having issues with it saying "Security" is not defined in "IUmbracoContext". Below is the two lines that I can't get working, where I'm logging in a user if they are a Backoffice user. Works on version 9.
Copy code
bool authenticated = UmbracoContext.**Security**.ValidateBackOfficeCredentials(...)

if (authenticated) {
                try {
                    var user = us.GetByUsername(model.Username);
                    UmbracoContext.**Security**.PerformLogin(user.Id);
                    }