Let's consider that I already have a package that returns UserIdentity based on HttpRequest. I want to create an ASP.NET Core project that uses my package in order to get ClaimIdentity object. How it could be done?
I think you can tell Asp.NET Core to use your custom Identity by applying it on the services middleware registration. Something like
services.AddDefaultIdentity<MyIdentityClass>()
Supposing that MyIdentityClass extends the IdentityUser class.
You can find more informations about how to customize the Identity [https://learn.microsoft.com/it-it/aspnet/core/security/authentication/customize-identity-model?view=aspnetcore-3.1](here in the Asp.NET Core documentation)
Related
I have a custom AuthenticationHandler built to tie into the Claims-based authorization in ASP.NET Core. Is it possible for ServiceStack to re-use this component, or will I have to implement it as a custom AuthProvider?
Have a look at the new mvcidentity .NET Core template which shows an example of using ASP.NET identity Auth to protect both MVC and ServiceStack Services.
The integration is enabled with the new NetCoreIdentityAuthProvider which provides a bidirectional adapter that converts between an ASP.NET Core ClaimsPrincipal and a ServiceStack User Session.
I would like to use a Controller based Identity with .NET Core 2.1. I would like to scaffold the UI but the scaffolder creates Razor Page based identity. I would like to use controllers instead of Razor Pages. Is it possible to scaffold this?
I found that creating a new project and choosing the.net core V2 with authentication will create the controller based authentication vs the razor one.
I have following scenario. I write asp.net core web api which will be used by mobile and web (asp.net core mvc web app) apps.
I authenticate user using asp.net core identity framework class SignInManager (add account controller and related classes manually) and then generate oauth token which will be used by client applications. By doing so I have 2 identities associated with the user. one is created by after I login using SignInManager.PasswordSignInAsync and second is created by generating oauth JWT token.
Is this correct approach or not?
Thanks
https://blogs.msdn.microsoft.com/webdev/2016/10/27/bearer-token-authentication-in-asp-net-core/
that might shed some light on what direction to go. there is also another blog post about using IdentityServer4 (3rd party) works well.
https://blogs.msdn.microsoft.com/webdev/2017/01/23/asp-net-core-authentication-with-identityserver4/
I have an external web service which holds the user data & I need to use that to log user in. I would like to use existing AccountController + UI views if possible. I tried adding custom SignInManager class to override PasswordSignInAsync as below.
public class MySignInManager<ApplicationUser>
: SignInManager<ApplicationUser> where ApplicationUser : MyModels.ApplicationUser
But it fails due to missing EF database which stores user information. I do not need EF database since this external web service will be my data source.
I read I need to implement UserManager & UserStore but could not find samples with ASP.NET Core release. Could someone point me to that?
I found this implementation - Aspnet Core Identity Without Entityframework
Source code on Github
I think this should be good enough to start with.
I am using asp.net mvc 4 template, which ships with OpenID2 as default.
Since google has depricated OpenID 2.0, I want to use OAuth 2.0. I checked all MSN blogs
where there is no solution for out of box. I am using visual studio 2012 and mvc 4 only.
So my question is how can i migrate openid 2.0 to open auth.
Thanks & Regards,
Aruljothi
You can either get GoogleOAuth2Client from NuGet or reimplement it yourself:
You'll have to create a new GoogleAuth model which implements IAuthenticationClient interface, can be initialized with appId and appSecret, returns provider name ("gooogle") and includes specific classes and methods to complete the auth, get user data and deserialize data.
If you are too lazy to do that you can even use Google's own library Google.Apis.Auth.OAuth2. Or look for ready-to-use template implementations.
After that all you need to do is configure your AuthConfig and use them via OAuthWebSecurity in your external login controller.