Skip to content

Commit acab804

Browse files
authored
Merge pull request #7184 from jesp209i/main
Cloud Public Access additional information
2 parents 80e8c70 + 416da37 commit acab804

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

umbraco-cloud/set-up/project-settings/public-access.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,26 @@ By default, **Basic Authentication** is enabled on trial projects.
3636
![Allow IPs for your Umbraco Cloud Project](../images/allow_ip.png)
3737

3838
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.
39+
40+
### CMS Basic Authentication
41+
42+
The **Public Access** feature in Umbraco Cloud is built on top of the **Basic Authentication** implementation in CMS core. This means that the `appsettings` related to Basic Authentication are controlled by Umbraco Cloud, and your Cloud Environment has access to them.
43+
44+
This setup allows you to configure an `HttpClient` that can do a loop back request without being blocked, by adding the **Shared Secret** Header if needed.
45+
46+
```csharp
47+
// Setup http client that does loop back requests
48+
var basicAuthEnabled = Environment.GetEnvironmentVariable("UMBRACO__CMS__BASICAUTH__ENABLED") == "True";
49+
if (basicAuthEnabled) {
50+
var headerName = Environment.GetEnvironmentVariable("UMBRACO__CMS__BASICAUTH__SHAREDSECRET__HEADERNAME");
51+
var headerValue = Environment.GetEnvironmentVariable("UMBRACO__CMS__BASICAUTH__SHAREDSECRET__VALUE");
52+
53+
loopbackHttpClient.DefaultRequestHeaders.Add(headerName, headerValue));
54+
}
55+
```
56+
57+
For more information, see the following links:
58+
59+
- [CMS Configuration: Reading Configuration in Code](https://docs.umbraco.com/umbraco-cms/reference/configuration#reading-configuration-in-code)
60+
- [CMS Configuration Options: Basic Authentication Settings](https://docs.umbraco.com/umbraco-cms/reference/configuration/basicauthsettings)
61+

0 commit comments

Comments
 (0)