Does with Roles or Policies in Blazor apps, work with Active Directory?

Falanga, Rod, DOH 105 Reputation points
2024-07-09T16:22:20.2666667+00:00

I want to write a Blazor application. It must authenticate and authorize internal users in our Active Directory domain. I'm currently reading through Core Blazor Authentication and Authorization. It discusses roles and policies, which look like they will work, but I'm not sure. We are not using Azure and I'm not sure we ever will. So, this app must work with our on-prem Active Directory. With either the roles or the policies read those the logged in user's Active Directory Groups or Organizational Units, so that I can determine whether the user is in the necessary OUs and AD Groups?

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,499 questions
Active Directory
Active Directory
A set of directory-based technologies included in Windows Server.
6,233 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Bruce (SqlWork.com) 61,491 Reputation points
    2024-07-09T17:39:50.84+00:00

    you have two approaches.

    • use a on-prem oauth server that uses ldap to connect to your local AD. this is you single sign option. identity server used to be used for this, but now its a paid option: https://duendesoftware.com/products/identityserver
    • use windows authentication. configure as you would for aps.net core, and the principal and claims will be passed to the Blazor app. you can use AD calls and custom claims to control the claims.

    as all the claims go into a cookie, beware of the number of claims you add. It is a good idea to filter the claims to just the ones used by the app.