Esempio n. 1
0
 public ValuesController()
 {
     _jwtSecurityTokenHandler = new JwtSecurityTokenHandler();
     _tokenCreator            = new TokenCreator();
     _certificateReader       = new CertificateReader();
     _tokenValidator          = new TokenValidator(_jwtSecurityTokenHandler, _certificateReader);
 }
Esempio n. 2
0
        public static void FromSecrets()
        {
            const string organizationNumber = "123456789";

            var clientConfiguration = new ClientConfiguration(
                Environment.DifiTest,
                CertificateReader.ReadCertificate(),
                new Sender(organizationNumber));
        }
Esempio n. 3
0
        public HttpResponseMessage ReadCertificate(string filename, string password)
        {
            _certificateReader = new CertificateReader();
            filename           = Path.Combine(_certStoreBasePath, filename);
            _certificateReader.SetPrivateKeyFromP12(filename, password);

            CertificateInfo certificateInfo = GetCertificateInfo();


            return(Request.CreateResponse(HttpStatusCode.OK, certificateInfo, new JsonMediaTypeFormatter()));
        }
Esempio n. 4
0
        public void ClientConfigurationWithCertificate()
        {
            // The actual sender of the message. The broker is the owner of the organization certificate
            // used in the library. The broker id can be retrieved from your Digipost organization account.
            var broker = new Broker(12345);

            // The sender is what the receiver of the message sees as the sender of the message.
            // Sender and broker id will both be your organization's id if you are sending on behalf of yourself.
            var sender = new Sender(67890);

            var clientConfig = new ClientConfig(broker, Environment.Production);

            var client = new DigipostClient(clientConfig, CertificateReader.ReadCertificate());
        }
Esempio n. 5
0
        public static TestSender GetSender(TestEnvironment testEnvironment)
        {
            switch (testEnvironment)
            {
            case TestEnvironment.DifiTest:
                return(new TestSender(
                           497013,
                           CertificateResource.Certificate(),
                           Environment.DifiTest,
                           new RecipientById(IdentificationType.DigipostAddress, "ReplaceMehere")
                           ));

            case TestEnvironment.Qa:
                return(new TestSender(
                           1185201,
                           CertificateReader.ReadCertificate(),
                           Environment.Qa,
                           new RecipientById(IdentificationType.DigipostAddress, "liv.test.aliassen#8514")
                           ));

            default:
                throw new ArgumentOutOfRangeException(nameof(testEnvironment), testEnvironment, null);
            }
        }
        public static X509Certificate2 GetBringCertificate()
        {
            var serviceProvider = LoggingUtility.CreateServiceProviderAndSetUpLogging();

            return(CertificateReader.ReadCertificate(serviceProvider.GetService <ILoggerFactory>()));
        }
Esempio n. 7
0
 public OnBehalfTokenGenerator()
 {
     this._certReader = new CertificateReader();
 }
Esempio n. 8
0
 public S2STokenGenerator()
 {
     this._certReader = new CertificateReader();
 }