You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/static-web-apps/authentication-authorization.yml
+18-19Lines changed: 18 additions & 19 deletions
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@ metadata:
5
5
description: Learn to use different authorization providers to secure your Azure Static Web Apps.
6
6
author: craigshoemaker
7
7
ms.author: cshoe
8
-
ms.date: 12/22/2022
8
+
ms.date: 06/24/2024
9
9
ms.service: static-web-apps
10
10
ms.topic: how-to
11
11
ms.custom:
@@ -15,23 +15,22 @@ metadata:
15
15
title: |
16
16
Authenticate and authorize Static Web Apps
17
17
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.
24
19
25
20
In this article, learn about default behavior, how to set up sign-in and sign-out, how to block an authentication provider, and more.
26
21
27
22
You can [register a custom provider](./authentication-custom.md), which disables all pre-configured providers.
28
23
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
+
29
28
prerequisites:
30
29
summary: |
31
30
Be aware of the following defaults and resources for authentication and authorization with Azure Static Web Apps.
32
31
33
32
**Defaults:**
34
-
- Any user can authenticate with a pre-configured provider
33
+
- Any user can authenticate with a preconfigured provider
35
34
- GitHub
36
35
- Microsoft Entra ID
37
36
- To restrict an authentication provider, [block access](#block-an-authentication-provider) with a custom route rule
@@ -42,7 +41,7 @@ prerequisites:
42
41
- Assign users custom roles using the built-in [invitations system](authentication-custom.md#manage-roles)
43
42
- Programmatically assign users custom roles at sign-in with an [API function](apis-overview.md)
44
43
- 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.
46
45
47
46
procedureSection:
48
47
- title: |
@@ -52,18 +51,18 @@ procedureSection:
52
51
53
52
Use the following table to find the provider-specific route.
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.
61
60
62
61
```html
63
62
<a href="/.auth/login/github">Login</a>
64
63
```
65
64
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.
67
66
Use a [route rule](./configuration.md#routes) to map a default provider to a friendly route like _/login_.
68
67
69
68
```json
@@ -75,13 +74,13 @@ procedureSection:
75
74
76
75
### Set up post-sign-in redirect
77
76
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.
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.
85
84
86
85
```json
87
86
{
@@ -117,9 +116,9 @@ procedureSection:
117
116
118
117
## Block an authentication provider
119
118
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).
121
120
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.
0 commit comments