0
votes

Is it possible to support both Azure AD Tokens and Custom tokens for different areas of an application?

==Updated to add more detail==

I essentially want to use both the AddJwtBearer along with AddMicrosoftIdentityWebApp method where My MVC Controller uses the Azure AD and my SignalR Hub uses the Jwt Bearer Token.

services
.AddJwtBearer(...) --> SignalR
.AddMicrosoftIdentityWebApp(...); --> MVC Controller

I have no problem authenticating against one or the other but I have not been able to authenticate both at the same time in a single ASP.NET Core site. It seems like the minute I add the Microsoft Identity it makes the whole site use Azure AD and sending any custom token to the site fails with Authentication Failed.

Is there a way to configure this?

Admin Controller --> Azure AD Auth

SignalR Hub --> Custom Jwt Token

1
Please share exact Authentication Failed error you are facing? - Hari Krishna
Unauthorized exception - webwires

1 Answers

0
votes

Standard project templates gives you "My organization", "Multiple organizations" or "Microsoft Account", to my knowledge (need to be careful in these .NET5 release times, things can change fast).

I suggest you look at AzureAD B2C What is Azure Active Directory B2C?
or IdentityServer4 Sign-in with External Identity Providers