Skip to content
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions umbraco-cloud/set-up/project-settings/public-access.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,22 @@ By default, **Basic Authentication** is enabled on trial projects.
![Allow IPs for your Umbraco Cloud Project](../images/allow_ip.png)

Once **Basic Authentication** has been enabled, users not on the project or with IPs not added to the allowlist will be prompted to log in.

### CMS Basic Authentication

The Umbraco Cloud Public Access feature is built on top of the Basic Authentication implementation in CMS core. This means the appsettings related to Basic Authentication are controlled by Umbraco Cloud, and your Cloud Environment has access to them. With that you can setup a httpclient that can do a loop back request without being blocked, by adding the Shared Secret Header if needed.

```csharp
// Setup http client that does loop back requests
var basicAuthEnabled = Environment.GetEnvironmentVariable("UMBRACO__CMS__BASICAUTH__ENABLED") == "True";
if (basicAuthEnabled) {
var headerName = Environment.GetEnvironmentVariable("UMBRACO__CMS__BASICAUTH__SHAREDSECRET__HEADERNAME");
var headerValue = Environment.GetEnvironmentVariable("UMBRACO__CMS__BASICAUTH__SHAREDSECRET__VALUE");

loopbackHttpClient.DefaultRequestHeaders.Add(headerName, headerValue));
}
```

- [CMS Configuration: Reading Configuration in Code](https://docs.umbraco.com/umbraco-cms/reference/configuration#reading-configuration-in-code)
- [CMS Configuration Options: Basic Authentication Settings](https://docs.umbraco.com/umbraco-cms/reference/configuration/basicauthsettings)