![]() If (string.IsNullOrEmpty(userName) || string.IsNullOrEmpty(password)) Private async Task GetClaimsIdentity(string userName, string password) Public DateTime Expiration => IssuedAt.Add(ValidFor) JwtIssuerOptions.cs Contents public class JwtIssuerOptions This object stores information and options regarding the configuration of the token and how the token will be issued. CredentialsViewModel.cs Contents public class CredentialsViewModel This is a simple POCO object with data annotations for validation. This view model is what will be used to accept authentication credentials from the user asking for a bearer token. Each of these items should be added to your project as individual classes. Supporting Itemsīefore we get into the "meat" of the code, there are a few supporting objects that we need to create first. We want this to be in the same project to ensure the best reusability within the application, and we want to do this with the least amount of impact to the existing application. However, you would like to use Bearer Tokens to support the mobile API's. The existing application and controllers should continue to use Identity. ![]() You now want to expand your application to have an API for a mobile application. ![]() Your application is working, you have various parts of the application secured, and users can access what they should. This post assumes that you have an already working ASP.NET Core 2.0 application using ASP.NET Identity. The Goalīefore I get into the specifics of how to accomplish, let's discuss the goal. In this post, I explore the process of supporting multiple authentication providers. ![]() With ASP.NET Core we can use multiple authentication providers so we can easily support various providers and control when each should apply. I have seen some methods used in the past to create these two interfaces, everything from home-grown security to the creation of two separate applications that do the same thing. ![]() I find that in many cases application developers need to create web applications that can support not only the web application itself but an API that might be used by a Mobile Application or otherwise. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
January 2023
Categories |