use of org.eclipse.vorto.repository.oauth.internal.PublicKeyHelper in project vorto by eclipse.
the class PublicKeyHelperTest method testPublicKeyVerifier.
@Test
public void testPublicKeyVerifier() {
RestTemplate restTemplate = Mockito.mock(RestTemplate.class);
Mockito.when(restTemplate.getForObject(CIAM_PUBLIC_KEY_URI, Keys.class)).thenReturn(getCiamKeys());
Mockito.when(restTemplate.getForObject(KEYCLOAK_PUBLIC_KEY_URI, Keys.class)).thenReturn(getKeyCloakKeys());
PublicKeyHelper helper = PublicKeyHelper.instance(restTemplate);
assertFalse(helper.getPublicKey(CIAM_PUBLIC_KEY_URI).isEmpty());
assertEquals(helper.getPublicKey(CIAM_PUBLIC_KEY_URI).size(), 2);
assertFalse(helper.getPublicKey(KEYCLOAK_PUBLIC_KEY_URI).isEmpty());
assertEquals(helper.getPublicKey(KEYCLOAK_PUBLIC_KEY_URI).size(), 1);
}
Aggregations