use of com.microsoft.identity.common.internal.providers.keys.KeyStoreConfiguration in project microsoft-authentication-library-common-for-android by AzureAD.
the class CertificateCredentialBuilder method test_CertificateBuilder_LookupCertificate_IsCorrect.
@Test
public void test_CertificateBuilder_LookupCertificate_IsCorrect() throws KeyStoreException, NoSuchAlgorithmException, UnrecoverableKeyException, NoSuchProviderException, IOException, CertificateException {
PowerMockito.mockStatic(KeyStore.class);
when(KeyStore.getInstance(WINDOWS_MY_KEYSTORE, WINDOWS_KEYSTORE_PROVIDER)).thenReturn(keyStoreMock);
CertificateCredential cred = new CertificateCredential.CertificateCredentialBuilder(CLIENT_ID).keyStoreConfiguration(new KeyStoreConfiguration(WINDOWS_MY_KEYSTORE, WINDOWS_KEYSTORE_PROVIDER, null)).clientCertificateMetadata(new ClientCertificateMetadata(CERTIFICATE_ALIAS, null)).build();
assertEquals(privateKey, cred.getPrivateKey());
assertEquals(certificate, cred.getPublicCertificate());
assertEquals(CLIENT_ID, cred.getClientId());
}
use of com.microsoft.identity.common.internal.providers.keys.KeyStoreConfiguration in project microsoft-authentication-library-common-for-android by AzureAD.
the class CertificateCredentialBuilder method test_CertificateBuilder_NoKeyStoreConfiguration_ExpectException.
@Test(expected = IllegalArgumentException.class)
public void test_CertificateBuilder_NoKeyStoreConfiguration_ExpectException() throws CertificateException, UnrecoverableKeyException, NoSuchAlgorithmException, KeyStoreException, NoSuchProviderException, IOException {
PowerMockito.mockStatic(KeyStore.class);
when(KeyStore.getInstance(WINDOWS_MY_KEYSTORE, WINDOWS_KEYSTORE_PROVIDER)).thenReturn(keyStoreMock);
CertificateCredential cred = new CertificateCredential.CertificateCredentialBuilder(CLIENT_ID).keyStoreConfiguration(new KeyStoreConfiguration(WINDOWS_MY_KEYSTORE, WINDOWS_KEYSTORE_PROVIDER, null)).build();
}
Aggregations