SiaIdentityProvider extends AbstractComponent implements ServiceIdentityProvider { @Override public SSLContext getIdentitySslContext() { return sslContext; } @Inject  SiaIdentityProvider(SiaProviderConfig config);  SiaIdentityProvider(AthenzIdentity service,
                               Path siaPath,
                               Path athenzTruststoreFile,
                               Path clientTruststoreFile);  SiaIdentityProvider(AthenzIdentity service,
                               Path privateKeyFile,
                               Path certificateFile,
                               Path athenzTruststoreFile,
                               Path clientTruststoreFile); @Override AthenzIdentity identity(); @Override SSLContext getIdentitySslContext(); @Override X509CertificateWithKey getIdentityCertificateWithKey(); @Override Path certificatePath(); @Override Path privateKeyPath(); @Override Path athenzTruststorePath(); @Override Path clientTruststorePath(); @Override void deconstruct();  }
@Test public void constructs_ssl_context_from_file() throws IOException { File keyFile = tempDirectory.newFile(); KeyPair keypair = KeyUtils.generateKeypair(KeyAlgorithm.RSA); createPrivateKeyFile(keyFile, keypair); X509Certificate certificate = createCertificate(keypair); File certificateFile = tempDirectory.newFile(); createCertificateFile(certificate, certificateFile); File trustStoreFile = tempDirectory.newFile(); createTrustStoreFile(certificate, trustStoreFile); SiaIdentityProvider provider = new SiaIdentityProvider( new AthenzService("domain", "service-name"), keyFile.toPath(), certificateFile.toPath(), trustStoreFile.toPath(), trustStoreFile.toPath()); assertNotNull(provider.getIdentitySslContext()); }
@Test public void constructs_ssl_context_with_pem_trust_store() throws IOException { File keyFile = tempDirectory.newFile(); KeyPair keypair = KeyUtils.generateKeypair(KeyAlgorithm.RSA); createPrivateKeyFile(keyFile, keypair); X509Certificate certificate = createCertificate(keypair); File certificateFile = tempDirectory.newFile(); createCertificateFile(certificate, certificateFile); File trustStoreFile = tempDirectory.newFile(); createPemTrustStoreFile(certificate, trustStoreFile); SiaIdentityProvider provider = new SiaIdentityProvider( new AthenzService("domain", "service-name"), keyFile.toPath(), certificateFile.toPath(), trustStoreFile.toPath(), trustStoreFile.toPath()); assertNotNull(provider.getIdentitySslContext()); }