Skip to content

Commit cd80aa1

Browse files
Merge pull request #279053 from craigshoemaker/swa/auth-update
[Static Web Apps] Updates: Authentication & authorization (freshness)
2 parents 91a4fc5 + 67383bc commit cd80aa1

File tree

1 file changed

+18
-19
lines changed

1 file changed

+18
-19
lines changed

articles/static-web-apps/authentication-authorization.yml

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ metadata:
55
description: Learn to use different authorization providers to secure your Azure Static Web Apps.
66
author: craigshoemaker
77
ms.author: cshoe
8-
ms.date: 12/22/2022
8+
ms.date: 06/24/2024
99
ms.service: static-web-apps
1010
ms.topic: how-to
1111
ms.custom:
@@ -15,23 +15,22 @@ metadata:
1515
title: |
1616
Authenticate and authorize Static Web Apps
1717
introduction: |
18-
> [!WARNING]
19-
> Due to changes in X (formerly Twitter) API policy we can’t continue to support it as part of the pre-configured providers for your app.
20-
> If you want to continue to use X (formerly Twitter) for authentication/authorization with your app, update your app configuration to [register a custom provider](./authentication-custom.md).
21-
22-
23-
Azure Static Web Apps provides a streamlined authentication experience, where no other actions or configurations are required to use GitHub and Microsoft Entra ID for authentication.
18+
Azure Static Web Apps provides a streamlined authentication experience, where no extra configuration is required to use GitHub and Microsoft Entra ID for authentication.
2419
2520
In this article, learn about default behavior, how to set up sign-in and sign-out, how to block an authentication provider, and more.
2621
2722
You can [register a custom provider](./authentication-custom.md), which disables all pre-configured providers.
2823
24+
> [!WARNING]
25+
> Due to changes in X (formerly Twitter) API policy, support is not available as part of the pre-configured providers for your app.
26+
> If you want to continue to use X (formerly Twitter) for authentication/authorization with your app, update your app configuration to [register a custom provider](./authentication-custom.md).
27+
2928
prerequisites:
3029
summary: |
3130
Be aware of the following defaults and resources for authentication and authorization with Azure Static Web Apps.
3231
3332
**Defaults:**
34-
- Any user can authenticate with a pre-configured provider
33+
- Any user can authenticate with a preconfigured provider
3534
- GitHub
3635
- Microsoft Entra ID
3736
- To restrict an authentication provider, [block access](#block-an-authentication-provider) with a custom route rule
@@ -42,7 +41,7 @@ prerequisites:
4241
- Assign users custom roles using the built-in [invitations system](authentication-custom.md#manage-roles)
4342
- Programmatically assign users custom roles at sign-in with an [API function](apis-overview.md)
4443
- Understand that authentication and authorization significantly overlap with routing concepts, which are detailed in the [Application configuration guide](configuration.md)
45-
- Restrict sign-in to a specific Microsoft Entra tenant by [configuring a custom Microsoft Entra provider](authentication-custom.md?tabs=aad). The pre-configured Microsoft Entra provider allows any Microsoft account to sign in.
44+
- Restrict sign-in to a specific Microsoft Entra ID tenant by [configuring a custom Microsoft Entra ID provider](authentication-custom.md?tabs=aad). The preconfigured Microsoft Entra ID provider allows any Microsoft account to sign in.
4645
4746
procedureSection:
4847
- title: |
@@ -52,18 +51,18 @@ procedureSection:
5251
5352
Use the following table to find the provider-specific route.
5453
55-
| Authorization provider | Sign in route |
56-
| ---------------------- | ----------------------- |
57-
| Microsoft Entra ID | `/.auth/login/aad` |
58-
| GitHub | `/.auth/login/github` |
54+
| Authorization provider | Sign in route |
55+
| --- | --- |
56+
| Microsoft Entra ID | `/.auth/login/aad` |
57+
| GitHub | `/.auth/login/github` |
5958
60-
For example, to sign in with GitHub, you could include something similar to the following link.
59+
For example, to sign in with GitHub, you could use a URL similar to the following example.
6160
6261
```html
6362
<a href="/.auth/login/github">Login</a>
6463
```
6564
66-
If you chose to support more than one provider, expose a provider-specific link for each on your website.
65+
If you chose to support more than one provider, use a provider-specific link for each provider on your website.
6766
Use a [route rule](./configuration.md#routes) to map a default provider to a friendly route like _/login_.
6867
6968
```json
@@ -75,13 +74,13 @@ procedureSection:
7574
7675
### Set up post-sign-in redirect
7776
78-
Return a user to a specific page after they sign in by providing a fully qualified URL in the `post_login_redirect_uri` query string parameter, like in the following example.
77+
You can return a user to a specific page after they sign in by providing a fully qualified URL in the `post_login_redirect_uri` query string parameter.
7978
code: |
8079
```html
8180
<a href="/.auth/login/github?post_login_redirect_uri=https://zealous-water.azurestaticapps.net/success">Login</a>
8281
```
8382
84-
You can also redirect unauthenticated users back to the referring page after they sign in. To configure this behavior, create a [response override](configuration.md#response-overrides) rule that sets `post_login_redirect_uri` to `.referrer`, like in the following example.
83+
You can also redirect unauthenticated users back to the referring page after they sign in. To add this redirect, create a [response override](configuration.md#response-overrides) rule that sets `post_login_redirect_uri` to `.referrer`, like in the following example.
8584
8685
```json
8786
{
@@ -117,9 +116,9 @@ procedureSection:
117116
118117
## Block an authentication provider
119118
120-
You may want to restrict your app from using an authentication provider, since all authentication providers are enabled. For instance, your app may want to standardize only on [providers that expose email addresses](authentication-custom.md#create-an-invitation).
119+
By default, all authentication providers are enabled, but you may want to restrict your app from using a provider. For instance, your app may want to only use [providers that expose email addresses](authentication-custom.md#create-an-invitation).
121120
122-
To block a provider, you can create [route rules](configuration.md#routes) to return a 404 status code for requests to the blocked provider-specific route. For example, to restrict Twitter as provider, add the following route rule.
121+
To block a provider, create a [route rule](configuration.md#routes) to return a `404` status code for requests to the blocked provider-specific route. For example, to restrict X (formerly Twitter) as provider, add the following route rule.
123122
code: |
124123
```json
125124
{

0 commit comments

Comments
 (0)