Is it possible for a Blazor app to access Windows Server Active Directory?

Falanga, Rod, DOH 190 Reputation points
2024-07-03T23:55:54.7266667+00:00

We are beginning to consider writing some new apps using Blazor and .NET 8. I've played around with the beginner's tutorials, which are nice, but not enterprise quality. One of my colleagues has been experimenting with Blazor. He has approached it from the angle of authentication and authorization. In his experimentations he found that he could authenticate to our Active Directory servers, but he couldn't retrieve anything about the AD Groups the user is in. I tried duplicating what he did, by creating a new Blazor app using .NET 8, then I chose "Individual" for authentication. (The only other option was "None", which I didn't want to do.) I discovered the same thing, when running it. It popped up a window informing me that I was authenticated, but I suspect I, too, couldn't get a listing of all the AD Groups I'm a member of, in our domain. Please note that we do NOT want to use Azure AD! At this point we don't have an Azure tenant and I'm not sure if, or when, we'll have one. This must work with Windows Servers AD on-prem.

We're wondering, is it even possible to determine the AD Groups a person is a member of, in a Blazor app, written in .NET 8?

Blazor
Blazor
A free and open-source web framework that enables developers to create web apps using C# and HTML being developed by Microsoft.
1,575 questions
Active Directory
Active Directory
A set of directory-based technologies included in Windows Server.
6,520 questions
0 comments No comments
{count} vote

1 answer

Sort by: Most helpful
  1. Bruce (SqlWork.com) 64,901 Reputation points
    2024-07-05T18:30:04.28+00:00

    Only server blazor can access the ad directly, a WASM would need to call an api. Second you want Windows authentication, not individual. Individual uses a database to define users and passwords. To add Windows authentication see:

    https://learn.microsoft.com/en-us/aspnet/core/security/authentication/windowsauth?view=aspnetcore-8.0&tabs=visual-studio

    1 person found this answer helpful.

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.