I'm trying to build a small custom Remote Desktop Gateway in C#. Currently I have a small controller which captures the RD request from the Windows RDP Client.
[Route("[controller]")]
public class RemoteGatewayController : Controller
{
[Route("/remoteDesktopGateway")]
public async Task<IActionResult> AuthenticateAsync()
{
var context = this.HttpContext;
var request = context.Request;
if (request.Headers.TryGetValue("RDG-Auth-Scheme", out var authorizationHeader))
{
if (authorizationHeader.ToString() == "PAA")
{
Response.Headers.Append("RDG-Auth-Scheme", "PAA");
return Unauthorized();
}
}
return Ok();
}
}
I have my .rdp file configured to use PAA authentication and can see that in the request. Here is the .rdp file:
screen mode id:i:2 use multimon:i:0 desktopwidth:i:800 desktopheight:i:600 session bpp:i:32 winposstr:s:0,3,0,0,800,600 compression:i:1 keyboardhook:i:2 audiocapturemode:i:0 videoplaybackmode:i:1 connection type:i:7 networkautodetect:i:1 bandwidthautodetect:i:1 displayconnectionbar:i:1 enableworkspacereconnect:i:0 disable wallpaper:i:0 allow font smoothing:i:0 allow desktop composition:i:0 disable full window drag:i:1 disable menu anims:i:1 disable themes:i:0 disable cursor setting:i:0 bitmapcachepersistenable:i:1 full address:s:someTarget audiomode:i:0 redirectprinters:i:1 redirectcomports:i:0 redirectsmartcards:i:1 redirectclipboard:i:1 redirectposdevices:i:0 autoreconnection enabled:i:1 authentication level:i:2 prompt for credentials:i:0 negotiate security layer:i:1 remoteapplicationmode:i:0 alternate shell:s: shell working directory:s: gatewayhostname:s:localhost:5001 gatewayusagemethod:i:1 gatewaycredentialssource:i:5 gatewayaccesstoken:s:SomePlainText gatewayprofileusagemethod:i:1 promptcredentialonce:i:1 gatewaybrokeringtype:i:0 use redirection server name:i:0 rdgiskdcproxy:i:0 kdcproxyname:s:
But for some reason the gatewayaccesstoken is not send anywhere in my request. What do I have to do so that the windows RDP client will send this token either in the header or in the body?