I've recently started playing with Azure Active Directory to authenticate users against my website built on AngularJS.
Using blogs and sample code on GitHub, I've gotten it working with single-tenant using a combination of ADAL.js and Katana's Bearer Token AD integration.
However, I'm now running into some issues with supporting multiple tenants.
I've got a page set up that displays the user as ADAL sees them (found through the root scope's userInfo
), as well as makes a call to my server that gets picked up by OWIN, and serializes context.Authentication.User
.
Client-side, everything seems to be working properly. I can log in with any of my tenants, and it gives me the object I'd expect (with isAuthenticated: true
, username
populated, and all sorts of properties on profile
describing the user, login, and tenant).
This is accomplished client-side by leaving off the tenant
argument to my adalAuthenticationServiceProvider.init
call, as described in the documentation.
Server-side, however, the UseWindowsAzureActiveDirectoryBearerAuthentication
method doesn't like having no value for Tenant
(in that it throws an exception). I've tried a few values for this, including the tenant with which my app was originally registered and, my logical favorite, "common," but no matter what I put in there (unless it's the tenant I'm trying to log in with, and if my ADAL is set up with that tenant), it seems to just skip over this.
For what it's worth, an actual API call is failing on the [Authorize]
filter and returning a 401, which tells me this isn't an issue with my OWIN interceptor.
How can I tell UseWindowsAzureActiveDirectoryBearerAuthentication
to support multi-tenant authentication?