Skip to content

Commit e6c75d1

Browse files
authored
Merge pull request #187410 from anthonychu/20220203-add-auth-note
[Static Web Apps] Add note about securing server side routes
2 parents 4562b7f + 7fc392e commit e6c75d1

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

articles/static-web-apps/configuration.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ services: static-web-apps
55
author: craigshoemaker
66
ms.service: static-web-apps
77
ms.topic: conceptual
8-
ms.date: 12/30/2021
8+
ms.date: 02/03/2022
99
ms.author: cshoe
1010
---
1111

@@ -137,10 +137,13 @@ Common uses cases for wildcard routes include:
137137
- Enforcing authentication and authorization rules
138138
- Implementing specialized caching rules
139139

140-
### Securing routes with roles
140+
### <a name="securing-routes-with-roles"></a>Securing routes with roles
141141

142142
Routes are secured by adding one or more role names into a rule's `allowedRoles` array. See the [example configuration file](#example-configuration-file) for usage examples.
143143

144+
> [!IMPORTANT]
145+
> Routing rules can only secure HTTP requests to routes that are served from Static Web Apps. Many front-end frameworks use client-side routing that modifies routes in the browser without issuing requests to Static Web Apps. Routing rules don't secure client-side routes. Clients should call [HTTP APIs](apis.md) to retrieve sensitive data. Ensure APIs validate a [user's identity](user-information.md) before returning data.
146+
144147
By default, every user belongs to the built-in `anonymous` role, and all logged-in users are members of the `authenticated` role. Optionally, users are associated to custom roles via [invitations](./authentication-authorization.md).
145148

146149
For instance, to restrict a route to only authenticated users, add the built-in `authenticated` role to the `allowedRoles` array.
@@ -316,7 +319,9 @@ In addition to IP address blocks, you can also specify [service tags](../virtual
316319
* [Default authentication providers](authentication-authorization.md#login), don't require settings in the configuration file.
317320
* [Custom authentication providers](authentication-custom.md) use the `auth` section of the settings file.
318321

319-
## Disable cache for authenticated paths
322+
For details on how to restrict routes to authenticated users, see [Securing routes with roles](#securing-routes-with-roles).
323+
324+
### Disable cache for authenticated paths
320325

321326
If you have enabled [enterprise-grade edge](enterprise-edge.md), or set up [manual integration with Azure Front Door](front-door-manual.md), you may want to disable caching for your secured routes.
322327

0 commit comments

Comments
 (0)