@manhnguyenv

Welcome to my blog!

ASP.NET Identity (MVC)

February 6, 2020 09:45

ASP.NET Identity (MVC) (edit)

1) Introduction to ASP.NET Identity
https://docs.microsoft.com/en-us/aspnet/identity/overview/getting-started/introduction-to-aspnet-identity

2) ASP.NET Identity Stripped Bare - MVC Part 1 + ASP.NET Identity Stripped Bare - MVC Part 2
https://benfoster.io/blog/aspnet-identity-stripped-bare-mvc-part-1
https://benfoster.io/blog/aspnet-identity-stripped-bare-mvc-part-2
NakedIdentity-master.zip

3) ASP.NET Identity Tutorial – OWIN Authentication Middleware
https://www.tektutorialshub.com/asp-net/asp-net-identity-tutorial-owin-setup/
AspNetMVCIdentityOWIN.rar

4) Securing ASP.NET MVC Applications with ASP.NET Identity
https://www.codeguru.com/csharp/.net/net_asp/mvc/securing-asp.net-mvc-applications-with-asp.net-identity.htm

OWIN Authentication middleware: It has dependencies on the following packages

Microsoft.Owin
The Microsoft.Owin namespace contains classes that support OWIN collection. The class Provides a set of helper types and abstractions for simplifying the creation of OWIN Components

Microsoft.Owin.Security

Microsoft.Owin.Security.Cookies
This Middleware that adds the cookie-based authentication to the application. This is similar to ASP.NET’s forms authentication

Microsoft.Owin.Security.OAuth
Middleware that enables an application to support any standard OAuth 2.0 authentication workflow

5) A workshop for moving through the various new pieces in ASP.NET Core Authorization
https://github.com/blowdart/AspNetAuthorizationWorkshop

6) Authorization
https://github.com/aspnet/AspNetCore.Docs/tree/master/aspnetcore/security/authorization/secure-data/samples/

7) OAuth providers for Owin - OWIN OAuth Providers (jerrie@jerriepelser.com)
https://github.com/TerribleDev/OwinOAuthProviders

ASP.NET Identity Recommended Resources - ASP.NET 4.x | Microsoft Docs

ASP.NET Identity Recommended Resources

https://docs.microsoft.com/en-us/aspnet/identity/overview/getting-started/aspnet-identity-recommended-resources

ASP.NET Identity

October 28, 2019 22:49

ASP.NET Identity (edit)

https://bytutorial.com/blogs/asp-net-mvc/aspnet-mvc-identity-without-using-entity-framework

https://www.pluralsight.com/guides/configuring-asp-net-identity

https://www.c-sharpcorner.com/article/Asp-Net-mvc-5-integrating-existing-database-with-login-usin/

https://www.asmak9.com/2016/04/aspnet-mvc5-role-base-accessibility.html

https://www.codeproject.com/Articles/1075956/ASP-NET-MVC-User-Role-Base-Menu-Management-Using-W

Claims-based Authentication

June 3, 2019 18:25

Claims (edit)

_Header.cshtml 

@using Microsoft.AspNet.Identity
@using System.Security.Claims
@using WebApp.Mvc.Helpers

@{
var Fullname = string.Empty;
var claimsIdentity = User.Identity as System.Security.Claims.ClaimsIdentity;

if (claimsIdentity != null)
{
var userData = claimsIdentity.FindFirst(System.Security.Claims.ClaimTypes.UserData);
if (userData != null)
{
var userBase = JsonUtils.DeserializeObject<UserBase>(userData.Value);
if (userBase != null)
{
Fullname = userBase.Fullname;
}
}
}
}

https://stackoverflow.com/questions/39125347/how-to-get-claim-inside-asp-net-core-razor-view

https://stackoverflow.com/questions/19524050/get-a-user-claim-in-asp-net-mvc-4-razor-view/19526229

    @{
        var claimsIdentity = User.Identity as System.Security.Claims.ClaimsIdentity;

        if (claimsIdentity != null)
        {
            var c = claimsIdentity.FindFirst(System.Security.Claims.ClaimTypes.NameIdentifier);

            if (c != null)
            {
             <p>
                 @c.Type.ToString(); 
                 @c.Value.ToString();
             </p>   
            }
        }
    }

Categories

Recent posts