Exemplo n.º 1
0
        public object CredentialsInfo(InputCredentialsInfo inputCredentialsInfo)
        {
            JsonSerializer serializer  = new JsonSerializer();
            ErrorLogger    errorLogger = new ErrorLogger();
            string         baseURL     = _configuration.GetSection("Transsped").GetSection("BaseURL").Value;


            CredentialsInfoClient credentialsInfoClient = new CredentialsInfoClient(serializer, errorLogger, baseURL);
            object response = credentialsInfoClient.GetCredentialsInfo(_accessToken.GetAccessToken().access_token, inputCredentialsInfo);

            return(response);
        }
Exemplo n.º 2
0
        public ActionResult _LoadCert()
        {
            JsonSerializer serializer  = new JsonSerializer();
            ErrorLogger    errorLogger = new ErrorLogger();
            string         baseURL     = _configuration.GetSection("CSC_API").GetSection("BaseURL").Value;

            InputCredentialsList credentialsList = new InputCredentialsList()
            {
            };
            MyHttpClient            myHttpClient     = new MyHttpClient(serializer, errorLogger, baseURL);
            var                     response         = myHttpClient.GetCertificatesList(_accessToken.GetAccessToken().access_token, credentialsList);
            List <CredentialObject> userCertificates = new List <CredentialObject>();

            if (!response.Contains("error"))
            {
                List <OutputCredentials> outputCredentials = serializer.Deserialize <List <OutputCredentials> >(response);
                foreach (var output in outputCredentials)
                {
                    //trebuie sa adaug si credential id
                    Cert   certificate = new Cert();
                    byte[] certBytes   = Convert.FromBase64String(output.cert.certificates.FirstOrDefault());
                    var    certTest    = new X509Certificate2(certBytes);
                    certificate.issuerDN     = certTest.IssuerName.Name.ToString();
                    certificate.serialNumber = certTest.SerialNumber.ToString();
                    certificate.subjectDN    = certTest.SubjectName.Name.ToString();
                    certificate.status       = certTest.FriendlyName.ToString();
                    certificate.validFrom    = certTest.NotBefore.ToString();
                    certificate.validTo      = certTest.NotAfter.ToString();

                    string credID = output.credentialID;

                    CredentialObject userCredentialObject = new CredentialObject();
                    userCredentialObject.credentialID = credID;
                    userCredentialObject.certificate  = certificate;

                    userCertificates.Add(userCredentialObject);
                }
            }
            return(PartialView("_LoadCert", userCertificates));
        }
Exemplo n.º 3
0
 public object Auth()
 {
     return(_accessToken.GetAccessToken());
 }