Client certificate authentication for PowerShell Universal.
Client certificate authentication ensures that client machines hold a particular certificate when connecting to PowerShell Universal. The certificate check is handled during the HTTP negotiation so it affects the entire webserver and cannot be configured per route.
For detailed information about client certificate authentication in ASP.NET Core 5.0, you can visit the Microsoft documentation here.
Enable Client Certificate Authentication
You will need to enable HTTPS hosting and turn on client certificate authentication. First, ensure that you have an HTTP certificate selected and you have set the ClientCertificateMode to RequireCertificate. These settings can be set within the appsettings.json file.
Next, you will need to enable client certificate authentication.
"ClientCertificate": {"Enabled":"true"},
Authorization
You can use the roles.ps1 file to evaluate the certificate provided by the client. This can be used to determine which roles the user will receive when connecting to PSU.
To evaluate the properties that are available during authorization, you can serialize the $user variable provided to the role policy functions.