Skip to content

Latest commit

 

History

History
41 lines (31 loc) · 774 Bytes

File metadata and controls

41 lines (31 loc) · 774 Bytes

| EN

Authentication.Identity.BlazorServer

Provides an Identity implementation for the project, supports the Blazor Server project

Example:

Install-Package Masa.Contrib.Authentication.Identity.BlazorServer
  1. Modify Program.cs
builder.Services.AddMasaIdentity();
  1. Get user information
IUserContext userContext;//Get IUserContext from DI
userContext.User;//Get user information
  1. Temporarily change the current login user information
IUserSetter userSetter;//Get IUserSetter from DI
var user = new IdentityUser()
{
     Id = "2",
     UserName = "Tom",
     Environment = "Production",
     TenantId = "2"
};
using(userSetter.Change(user))
{
     //The obtained user information is Tom
}