اشتراک‌ها
NET MAUI Preview 5. منتشر شد

In this release we have enabled animations and view transformations, completed the porting of several UI components, and introduced improvements to the single project templates. 

NET MAUI Preview 5. منتشر شد
اشتراک‌ها
پیاده‌سازی فرآیند Impersonation در ASP.NET Core

Impersonation Process

Impersonation is when an admin user is logged in with the same privileges as a user, but without knowing their password or other credentials. I’ve used this in couple applications and it was invaluable for support cases and debugging user permissions. 

[Authorize(Roles = "Admin")] // <-- Make sure only admins can access this 
public async Task<IActionResult> ImpersonateUser(String userId)
{
    var currentUserId = User.GetUserId();

    var impersonatedUser = await _userManager.FindByIdAsync(userId);

    var userPrincipal = await _signInManager.CreateUserPrincipalAsync(impersonatedUser);

    userPrincipal.Identities.First().AddClaim(new Claim("OriginalUserId", currentUserId));
    userPrincipal.Identities.First().AddClaim(new Claim("IsImpersonating", "true"));

    // sign out the current user
    await _signInManager.SignOutAsync();

    await HttpContext.Authentication.SignInAsync(cookieOptions.ApplicationCookieAuthenticationScheme, userPrincipal);

    return RedirectToAction("Index", "Home");
}


پیاده‌سازی فرآیند Impersonation در ASP.NET Core
اشتراک‌ها
پروژه‌ی Silver

Silver is a free implementation of Apple's Swift programming language.

With Silver, you can use Swift to write code directly against the .NET, Java, Android and Cocoa APIs. And you can also share a lot of non-UI code between platforms. 

پروژه‌ی Silver