Wednesday, September 16, 2020

how to validate the client certificate in azure web app ( app service ) ?

 Azure Web App.

The Web App has been configured for TLS mutual authentication.

how to validate the client certificate in the web application ?

HTTP request header 

Access client certificate 

In App Service, SSL termination of the request happens at the frontend load balancer. When forwarding the request to your app code with client certificates enabled.

App Service Injects an  X-ARR-ClientCert request header with the client certificate.

App Service does not do anything with this client certificate other than forwarding it to your app.

your app code is responsible for validating the client certificate.

reference:

https://docs.microsoft.com/en-us/azure/app-service/app-service-web-configure-tls-mutual-auth

Encoding type:

Base64 Encoding for the client certificate.

Microsoft documentation for the code used to confirm the client certificate:

example code : 

protected void Page_Load(object sender, EventArgs e)

{

      NameValueCollection headers = base.Request.Headers;

      certHeader = headers["X-ARR-ClientCert"];

      if (!String.IsNullOrEmpty(certHeader))

 {

       try 

      {

            byte[] clientCertBytes = Convert.FromBase64String(certHeader);

            certificate = new X509Certificate2(clientCertBytes);

            certSubject = certificate.Subject;

            certIssuer = certificate.Issuer;


reference:

https://docs.microsoft.com/en-us/azure/app-service/app-service-web-configure-tls-mutual-auth











1 comment:

  1. Kaushik Gattu: How To Validate The Client Certificate In Azure Web App ( App Service ) ? >>>>> Download Now

    >>>>> Download Full

    Kaushik Gattu: How To Validate The Client Certificate In Azure Web App ( App Service ) ? >>>>> Download LINK

    >>>>> Download Now

    Kaushik Gattu: How To Validate The Client Certificate In Azure Web App ( App Service ) ? >>>>> Download Full

    >>>>> Download LINK jA

    ReplyDelete