Attaching the Bearer Token to Claims Identity in ASP.NET Core to implement On-Behalf-Of Flow

When you setup an ASP.NET Core web API project and go through the wizard to associate it with an Azure Active Directory tenant it will add the necessary plumbing within your project to get it all working. However, if you are ever in a place where you need to use on-behalf-of flow to obtain another … Continue reading Attaching the Bearer Token to Claims Identity in ASP.NET Core to implement On-Behalf-Of Flow

AspNetCore.TestHost + Azure Active Directory (Part II)

So in my last post on the topic, I was describing some challenges I faced when receiving 401 not authorized errors when attempting to pass a seemingly correct bearer token to my Azure Active Directory protected WebAPI. I’ve discovered the solution. Not only was I able to get it working but it also works flawlessly … Continue reading AspNetCore.TestHost + Azure Active Directory (Part II)

AspNetCore.TestHost + Azure Active Directory (Part I)

I have been evaluating new practices for implementing Integration Testing WebAPIs and I’ve been trying to use TestHost to test a WebAPI that I have secured with Azure Active Directory. I am able to use PostMan to obtain a bearer token from Azure AD's oauth2/token endpoint and call HTTP GET on '/api/Values'. However, when I … Continue reading AspNetCore.TestHost + Azure Active Directory (Part I)