From bc9f7acf76bbfedd06a5d67cedd7e3b631c68de6 Mon Sep 17 00:00:00 2001 From: Frederik Prijck Date: Tue, 14 Nov 2023 09:22:17 +0100 Subject: [PATCH] Apply suggestions from code review Co-authored-by: Evan Sims --- .../webapp/aspnet-core-blazor-server/01-login.md | 10 +++++----- .../webapp/aspnet-core-blazor-server/interactive.md | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/articles/quickstart/webapp/aspnet-core-blazor-server/01-login.md b/articles/quickstart/webapp/aspnet-core-blazor-server/01-login.md index 1480a38f9b..9768084bf7 100644 --- a/articles/quickstart/webapp/aspnet-core-blazor-server/01-login.md +++ b/articles/quickstart/webapp/aspnet-core-blazor-server/01-login.md @@ -30,7 +30,7 @@ You will need to add this URL to the list of Allowed URLs for your application i ## Integrate Auth0 -[Universal Login](/hosted-pages/login) is the easiest way to set up authentication in your application. We recommend using it for the best experience, best security and the fullest array of features. This guide will use it to provide a way for your users to log in to your Blazor Server application. +[Universal Login](/hosted-pages/login) is the easiest way to set up authentication in your application. We recommend using it for the best experience, security, and the most complete array of features. This guide uses Universal Login to provide a way for your users to log in to your Blazor Server application. ### Install dependencies @@ -71,7 +71,7 @@ To allow users to login to your Blazor Server application, add a `LoginModel` to Inside the `LoginModel`'s `OnGet` method, call `HttpContext.ChallengeAsync()` and pass `Auth0Constants.AuthenticationScheme` as the authentication scheme. This will invoke the OIDC authentication handler that our SDK registers internally. Be sure to also specify the corresponding `authenticationProperties`, which you can construct using the `LoginAuthenticationPropertiesBuilder`. -After succesfully calling `HttpContext.ChallengeAsync()`, the user will be redirected to Auth0 and signed in to both the OIDC middleware and the cookie middleware upon being redirected back to your application. This will allow the users to be authenticated on subsequent requests. +After successfully calling `HttpContext.ChallengeAsync()`, the user will be redirected to Auth0 and signed in to both the OIDC middleware and the cookie middleware upon being redirected back to your application. This will allow the users to be authenticated on subsequent requests. ```cs public class LoginModel : PageModel @@ -89,9 +89,9 @@ public class LoginModel : PageModel ## Display User Profile -After the middleware has successfully retrieved the tokens from Auth0, it will extract the user's information and claims from the ID Token and makes them available through the `AuthenticationState`, which you can add as a `CascadingParameter`. +After the middleware has successfully retrieved the tokens from Auth0, it will extract the user's information and claims from the ID Token and make them available through the `AuthenticationState`, which you can add as a `CascadingParameter`. -You can create a custom user profile page for displaying the user's name, as well as additional claims (such as email, and picture), by retrieving the corresponding information from the `AuthenticationState`'s `User` property and pass it to the view from inside Blazor code. +You can create a custom user profile page for displaying the user's name, as well as additional claims (such as email and picture), by retrieving the corresponding information from the `AuthenticationState`'s `User` property and passing it to the view from inside Blazor code. ```csharp @@ -131,7 +131,7 @@ You can create a custom user profile page for displaying the user's name, as wel Logging out the user from your own application can be done by calling `HttpContext.SignOutAsync` with the `CookieAuthenticationDefaults.AuthenticationScheme` authentication scheme from inside a `LogoutModel`'s `OnGet` method. -Additionaly, If you also want to log the user out from Auth0 (this *might* also log them out of other applications that rely on Single Sign On), call `HttpContext.SignOutAsync` with the `Auth0Constants.AuthenticationScheme` authentication scheme as well as the appropriate `authenticationProperties` that can be constructed using the `LogoutAuthenticationPropertiesBuilder`. +Additionally, if you also want to log the user out from Auth0 (this *might* also log them out of other applications that rely on Single Sign On), call `HttpContext.SignOutAsync` with the `Auth0Constants.AuthenticationScheme` authentication scheme as well as the appropriate `authenticationProperties` that can be constructed using the `LogoutAuthenticationPropertiesBuilder`. ::: note When only logging the user out from your own application but not from Auth0, ensure to return `Redirect("/")` or any other appropriate redirect. diff --git a/articles/quickstart/webapp/aspnet-core-blazor-server/interactive.md b/articles/quickstart/webapp/aspnet-core-blazor-server/interactive.md index 7a1ceabc7c..a2ffe84770 100644 --- a/articles/quickstart/webapp/aspnet-core-blazor-server/interactive.md +++ b/articles/quickstart/webapp/aspnet-core-blazor-server/interactive.md @@ -53,7 +53,7 @@ To allow users to login to your Blazor Server application, add a `LoginModel` to Inside the `LoginModel`'s `OnGet` method, call `HttpContext.ChallengeAsync()` and pass `Auth0Constants.AuthenticationScheme` as the authentication scheme. This will invoke the OIDC authentication handler that our SDK registers internally. Be sure to also specify the corresponding `authenticationProperties`, which you can construct using the `LoginAuthenticationPropertiesBuilder`. -After succesfully calling `HttpContext.ChallengeAsync()`, the user will be redirected to Auth0 and signed in to both the OIDC middleware and the cookie middleware upon being redirected back to your application. This will allow the users to be authenticated on subsequent requests. +After successfully calling `HttpContext.ChallengeAsync()`, the user will be redirected to Auth0 and signed in to both the OIDC middleware and the cookie middleware upon being redirected back to your application. This will allow the users to be authenticated on subsequent requests. ::::checkpoint @@ -79,16 +79,16 @@ Still having issues? Check out our [documentation](https://auth0.com/docs) or vi ## Display User Profile {{{ data-action=code data-code="Profile.razor" }}} -After the middleware has successfully retrieved the tokens from Auth0, it will extract the user's information and claims from the ID Token and makes them available through the `AuthenticationState`, which you can add as a `CascadingParameter`. +After the middleware has successfully retrieved the tokens from Auth0, it will extract the user's information and claims from the ID Token and make them available through the `AuthenticationState`, which you can add as a `CascadingParameter`. -You can create a custom user profile page for displaying the user's name, as well as additional claims (such as email, and picture), by retrieving the corresponding information from the `AuthenticationState`'s `User` property and pass it to the view from inside Blazor code. +You can create a custom user profile page for displaying the user's name, as well as additional claims (such as email and picture), by retrieving the corresponding information from the `AuthenticationState`'s `User` property and passing it to the view from inside Blazor code. ::::checkpoint :::checkpoint-default Now that you have set up to render the user's profile, run your application to verify that: -* Navigating to the endpoint containing the profile after being succesfully logged in, shows the user's profile. +* Navigating to the endpoint containing the profile after being successfully logged in shows the user's profile. ::: @@ -108,7 +108,7 @@ Still having issues? Check out our [documentation](https://auth0.com/docs) or vi Logging out the user from your own application can be done by calling `HttpContext.SignOutAsync` with the `CookieAuthenticationDefaults.AuthenticationScheme` authentication scheme from inside a `LogoutModel`'s `OnGet` method. -Additionaly, If you also want to log the user out from Auth0 (this *might* also log them out of other applications that rely on Single Sign On), call `HttpContext.SignOutAsync` with the `Auth0Constants.AuthenticationScheme` authentication scheme as well as the appropriate `authenticationProperties` that can be constructed using the `LogoutAuthenticationPropertiesBuilder`. +Additionally, if you also want to log the user out from Auth0 (this *might* also log them out of other applications that rely on Single Sign On), call `HttpContext.SignOutAsync` with the `Auth0Constants.AuthenticationScheme` authentication scheme as well as the appropriate `authenticationProperties` that can be constructed using the `LogoutAuthenticationPropertiesBuilder`. ::: note When only logging the user out from your own application but not from Auth0, ensure to return `Redirect("/")` or any other appropriate redirect.