I have an Asp.Net MVC project that has users (for this I used Asp.Net Identity 2), and I have another Asp.Net WebApi service.
I want to provide WebApi authentication to provide access only for Asp.Net MVC users to get to the endpoints, and I don't want to use IdentityServer3 for this purpose.
Asp.Net MVC Startup.Auth.cs:
public void ConfigureAuth(IAppBuilder app)
{
app.CreatePerOwinContext(ApplicationDbContext.Create);
app.CreatePerOwinContext<ApplicationUserManager>(ApplicationUserManager.Create);
app.CreatePerOwinContext<ApplicationSignInManager>(ApplicationSignInManager.Create);
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
LoginPath = new PathString("/Account/Login"),
Provider = new CookieAuthenticationProvider
{
OnValidateIdentity = SecurityStampValidator.OnValidateIdentity<ApplicationUserManager, ApplicationUser>(
validateInterval: TimeSpan.FromMinutes(30),
regenerateIdentity: (manager, user) => user.GenerateUserIdentityAsync(manager))
}
});
}
I think I should use a Bearar token and a JWT token, and I can use the Identityure Identity Model on the WebApi side for this, but I was looking to find a clear way that describes how to do this, but I did not find?
, , , SAML, JWT OAuth 2, ?