Click here to Skip to main content
15,796,507 members

Comments by Member 15418280 (Top 12 by date)

Member 15418280 17-Nov-23 0:28am View    
IN background we have now only string not array how can we pass 2 common.js and eventpage.js
Member 15418280 26-Oct-23 5:18am View    
How can we upload multiple files from that folder location
Member 15418280 26-May-23 5:14am View    
this is our controller

[Route("api/[controller]")]
[ApiController]
public class TestController : ControllerBase
{
[Authorize]
[HttpPost]
public string Post() => "The action works fine only with a certificate";
}


public void ConfigureServices(IServiceCollection services)
{
services.AddControllers();
services.AddTransient<certificatevalidation>();
services.AddAuthentication(CertificateAuthenticationDefaults.AuthenticationScheme).AddCertificate(options => {
options.AllowedCertificateTypes = CertificateTypes.SelfSigned;
options.Events = new CertificateAuthenticationEvents
{
OnCertificateValidated = context => {
var validationService = context.HttpContext.RequestServices.GetService<certificatevalidation>();
if (validationService.ValidateCertificate(context.ClientCertificate))
{
context.Success();
}
else
{
context.Fail("Invalid certificate");
}
return Task.CompletedTask;
},
OnAuthenticationFailed = context => {
context.Fail("Invalid certificate");
return Task.CompletedTask;
}
};
});
services.AddSwaggerGen(c =>
{
c.SwaggerDoc("v1", new OpenApiInfo { Title = "WebApiCertificateAuth", Version = "v1" });
});
}



using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography.X509Certificates;
using System.Threading.Tasks;

namespace WebApiCertificateAuth
{
public class CertificateValidation
{
public bool ValidateCertificate(X509Certificate2 clientCertificate)
{
string[] allowedThumbprints = { "310084D83EC974AEE7FC0B0D5175E11CA5E8DE6D" };
if (allowedThumbprints.Contains(clientCertificate.Thumbprint))
{
return true;
}
return false;
}
}
}
Member 15418280 25-May-23 2:54am View    
we need only to check whether any file is password or not.
Member 15418280 14-May-23 10:33am View    
Need to use in mvc application for rdp purpose