0
votes

I am developing a C# WPF application that needs to authorize the current user based on their Windows domain logon. The user is not expected to enter his username/password, the application just authorizes him as long as his user account is running the app.

I achieve this by simply querying the current user's credentials using System.Security.Principal like this:

System.Security.Principal.WindowsIdentity CallerWindowsIdentity = System.Security.Principal.WindowsIdentity.GetCurrent();
string username = CallerWindowsIdentity.Name;

// Then, I simply look up the username in my database

The problem: today my client has asked me to make it compliant with users from ADFS (Active Directory Federation Services) and Azure Active Directory.

I'm a bit of an old school coder. My knowledge has been around on-premise Windows Server Active Directory.

Would my code be compliant with these new technologies? Or do I have to redo the logon mechanism?

1

1 Answers

1
votes

Supporting ADFS will introduce additional overhead. You can try one of the following:

  1. Use the MSAL SDK - Active Directory Federation Services support in MSAL.NET
  2. AD FS OpenID Connect/OAuth flows and Application Scenarios