diff --git a/docs/en/UI/Blazor/CurrentUser.md b/docs/en/UI/Blazor/CurrentUser.md index 6c1cdb31f5..d0d761420a 100644 --- a/docs/en/UI/Blazor/CurrentUser.md +++ b/docs/en/UI/Blazor/CurrentUser.md @@ -1,3 +1,22 @@ -# Blazor UI: Authentication +# Blazor UI: Current User + +`ICurrentUser` service is used to obtain information about the currently authenticated user. Inject the `ICurrentUser` into any component/page and use its properties and methods. + +**Example: Show username & email on a page** + +````csharp +@page "/" +@using Volo.Abp.Users +@inject ICurrentUser CurrentUser +@if (CurrentUser.IsAuthenticated) +{ +
Welcome @CurrentUser.UserName
+} +```` + +> If you (directly or indirectly) derived your component from the `AbpComponentBase`, you can directly use the base `CurrentUser` property. + +`ICurrentUser` provides `Id`, `Name`, `SurName`, `Email`, `Roles` and some other properties. + +> See the [Server Side Current User](../../CurrentUser) service for more information. -TODO \ No newline at end of file