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’

 

How to debug a custom authentication method made with C# from Visual Studio

 

3) Right-click on ExtAuth.IniFiles, click on ‘Build’

 

How to debug a custom authentication method made with C# from Visual Studio

 

4) Open the VirtualUI Server Manager, and navigate to the ‘Authentication’ tab. Click on ‘Add’ an ‘External DLL’

 

How to debug a custom authentication method made with C# from Visual Studio

 

5) Select the .dll that we just compiled, click on ‘Open’, then ‘OK’ and ‘Apply.

 

How to debug a custom authentication method made with C# from Visual Studio

 

6) The newly External method should be listed in the ‘Authentication’ methods list :

 

How to debug a custom authentication method made with C# from Visual Studio

 

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.

 

How to debug a custom authentication method made with C# from Visual Studio

 

8) Go back to Visual Studio, right-click on ‘ExtAuth.IniFiles’, and select ‘Properties’

 

How to debug a custom authentication method made with C# from Visual Studio

 

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 :
/start

Compare your settings with the screenshot below :

 

How to debug a custom authentication method made with C# from Visual Studio

 

10) Click ‘Start’ to start debugging the .dll

 

How to debug a custom authentication method made with C# from Visual Studio

 

11) Let’s add a breakpoint on line 52 to verify if the .dll is currently being debugged :

 

How to debug a custom authentication method made with C# from Visual Studio

 

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.

 

How to debug a custom authentication method made with C# from Visual Studio

 

14) If the breakpoint is reached, then we have successfully debugged the .dll!

 

How to debug a custom authentication method made with C# from Visual Studio

 

If you found this article interesting and want to know more about Thinfinity VirtualUI, you can contact us or schedule a 15-minute demo call with one of our Sales Engineers.

 

Related Posts

Leave a comment