Require login to view CMS site on staging server but not production?

I have a staging and a production server and staging acts as both a final test of my code as well as a back up of data (production gets synced down to staging so content is aligned before a new feature or code change is pushed to staging). The problem is staging is publicly accessible so I want to make it so that if you hit the staging server you MUST be loged into the CMS to see the pages BUT I don’t want that to be the case on production.

Is this possible to do either in a stock v17 or with a pugin?

A complimentary thread here.

Check user backoffice session from frontend view? - Umbraco community forum

Hi @Eaglef90

Yes, this is possible with v17, no package needed.

Umbraco has front-end basic authentication built in and it validates against backoffice user credentials, which is exactly what you want. It’s an app setting:

"Umbraco": {
  "CMS": {
    "BasicAuth": {
      "Enabled": true,
      "RedirectToLoginPage": true
    }
  }
}

See: Basic Authentication | CMS | Umbraco Documentation

Justin

Thanks, that looks to be exactly what I want.