Refresh Tokens in Asp.Net Core 2 Api

So you are now Authenticating your user and providing Authorization via the Jwt (Auth) token.  Now you don’t want your Auth tokens to live for really long periods of time, and you certainly don’t want your users having to re-login to your app every 30 minutes.  But for safety, how do we get around this? Refresh Tokens A refresh token…

Read more »

Customize Asp.Net Core’s IdentityUser

In the last post we set up the Asp.Net Identity database and saw that our tables were all created for us.  There is a lot of fields in the AspNetUsers table but if we do a bit of forshadowing….we know that we will need some extra fields. I would like to show the user’s name when they are logged in…

Read more »

Set up Asp.Net Core 2 Web API to use Asp.Net Core Identity

Pure API Project I wanted to do a series on using Asp.Net Core 2 and Asp.Net Identity and expand that and customize it quite a bit…. but… Only using an Web API project.  I could not find anything like that.  Every other post I could find on the subject would mix in an MVC project and things got confusing. If…

Read more »

Multi-App Support For Asp.Net Identity – Part 6

Let’s Run Some EF Migrations Already! Now we will run the EF Code First Migrations and build our database……Finally!! To run the migrations, we will need a the Nuget Package Manager Console. Now we will have to enable the Migrations.  In the Package Manager Console, type in “enable-migrations” And if all went well, you should see this: You should now…

Read more »

Multi-App Support For Asp.Net Identity – Part 5

Cross Reference / Join / Junction Table I would like to associate the new AspNetApplications table to the users table.  If I want a user to be allowed access to multiple Applications and I want Applications to be assigned to many users, I have a Many-To-Many relationship.  Now I can’t just associate my Applications table and my Users table directly. …

Read more »

Multi-App Support For Asp.Net Identity – Part 4

Add New Table Now let’s add a whole new table.  Let’s add an Applications table to house our application information.  We will tie this table to our users in a later post.  For now, let’s just get the new table in place. Let’s look back at our IdentityModels.cs file.   We need to add another using statement to our IdentityModels.cs…

Read more »

Multi-App Support For Asp.Net Identity – Part 3

Add Fields to User Table Now I would like to add 3 fields to the AspNetUser that will be created for us.  In addition to the login information, I would like to  add a First Name field, Last Name field, and an Employee Number field to the table. For simplicity sake, I would just want all the new fields to…

Read more »

Multi-App Support For Asp.Net Identity – Part 2

Set The Stage So let’s set the what and why we will be doing.  Our fictitious company, Apothecaric Consulting is a small consulting firm with a few employees and a few subcontractors.  Apothecaric would like to create an application for employees and subcontractors to submit timesheets for the projects they are working on.  Apothecaric would also like to be able…

Read more »

Multi-App Support For Asp.Net Identity – Part 1

So I was thinking about how a small organization could leverage single-sign-on without having to leverage a larger Identity server implementation such as Thinktecture’s Identity Server 3. I reserve the right to change my mind and change course, but for now, I am looking to leverage Asp.Net’s Identity database to manage users and the applications the users are granted access…

Read more »