2

The Microsoft Default Identity did not fit my project needs so i had to write a custom filter to handle authentication. I do allow users to use Azure Active Directory, by storing a reference table with the ActiveDirectory User Id, and their user id in my system.

I really had to hack things to make it work in regular .NET. I've now switched my system to .Net Core web api Mvc and many of my libraries and syntax's did not translate.

Code Examples below:

public void SignIn() {
 HttpContext.GetOwinContext().Authentication.Challenge(new 
 AuthenticationProperties { RedirectUri = "/" }, 
 OpenIdConnectAuthenticationDefaults.AuthenticationType);
}

I just want to reference azure AD, I can sign in a user using .net core, but can't get any details about the user. I was using azure graph in the past.

How can I do this with out using the Microsoft Identity?

Tom Crosman
  • 1,137
  • 1
  • 12
  • 37

1 Answers1

0

Your scenario is unclear . If you want to implement authentication with AAD , the simplest way is to use the default Azure AD template : Change Authentication --> Work or School Accounts . Or manually add the Microsoft.AspNetCore.Authentication.AzureAD.UI package :

https://stackoverflow.com/a/54546245/5751404

If you are using the .Net Core Web API as your service , the client should ask AAD for access token to accessing your protected APIs , you can use JWT bearer authentication middleware :

https://github.com/Azure-Samples/active-directory-dotnet-webapp-webapi-openidconnect-aspnetcore

Nan Yu
  • 26,101
  • 9
  • 68
  • 148