How to debug a custom authentication method made with C# using Visual Studio
Authentication is key in the world of application delivery; however, some solutions fall short of providing support for advanced and custom integrations that greatly enhance a software security offering. Thinfinity VirtualUI allows developers to write custom authentication methods wrapped into a DLL. Here’s how to set up the debugging environment to test the health of a DLL written in C# with Visual Studio.
The standard ways to provide secure access to resources (including OAuth or any other Single Sing-On mechanism, with or without a second-factor authentication) are very efficient and reliable. But, in some situations, secure access is only a part of the solution.
The following list shows some scenarios where a solution like this can help us:
- When you need better integration with other company systems.
- When you have to integrate the sign-in into a complex authentication workflow.
- If you want to save, use or track sign-in information in the workflow of a VirtualUI-powered application.
As a customizable integration solution, Thinfinity products lets you encapsulate the security schema or method within a DLL.
To explain this functionality, we provide the source code of a simple DLL. You can get the information to configure this authentication mechanism in the Product Guide to integrate it with Thinfinity VirtualUI.
In this tutorial, you’ll learn how to debug the External DLL example in C# using Visual Studio.
1) Make sure you have the latest version of the Thinfinity Virtual UI demo.
2) Open the solution and change the ‘Any CPU’ option to ‘x64’
3) Right-click on ExtAuth.IniFiles, click on ‘Build’
4) Open the VirtualUI Server Manager, and navigate to the ‘Authentication’ tab. Click on ‘Add’ an ‘External DLL’
5) Select the .dll that we just compiled, click on ‘Open’, then ‘OK’ and ‘Apply.
6) The newly External method should be listed in the ‘Authentication’ methods list :
7) Now, open Windows Task manager and stop Thinfinity Services. Close the Thinfinity Manager as well.
Finally, ensure that there are no leftover processes in the ‘Details’ tab.
8) Go back to Visual Studio, right-click on ‘ExtAuth.IniFiles’, and select ‘Properties’
9) Click on ‘Debug’, then ‘Start External Program’ and click ‘Browse’. Search for the Thinfinity.VirtualUI.Server.exe file located in C:\Program Files\Thinfinity\VirtualUI\bin64
In the ‘Command line arguments’ field, add the following line :
Compare your settings with the screenshot below :
10) Click ‘Start’ to start debugging the .dll
11) Let’s add a breakpoint on line 52 to verify if the .dll is currently being debugged :
12) Open your browser and navigate to your VirtualUI landing page. ( In my case https://localhost:6580 )
13) Log in using the ‘user1’ user and the ‘password’ password.
14) If the breakpoint is reached, then we have successfully debugged the .dll!