use of com.github.nagyesta.lowkeyvault.http.AuthorityOverrideFunction in project lowkey-vault by nagyesta.
the class LowkeyVaultContainerVanillaTest method testContainerShouldStartUpWhenCalledWithoutVaultNames.
@Test
void testContainerShouldStartUpWhenCalledWithoutVaultNames() {
// given
final LowkeyVaultContainer underTest = new LowkeyVaultContainer(DockerImageName.parse(getCurrentLowkeyVaultImageName()).asCompatibleSubstituteFor(LowkeyVaultContainer.DEFAULT_IMAGE_NAME)).withImagePullPolicy(PullPolicy.defaultPolicy());
// when
underTest.start();
// then
final String endpoint = underTest.getDefaultVaultBaseUrl();
final AuthorityOverrideFunction authorityOverrideFunction = new AuthorityOverrideFunction(underTest.getDefaultVaultAuthority(), underTest.getEndpointAuthority());
final TokenCredential credentials = new BasicAuthenticationCredential(underTest.getUsername(), underTest.getPassword());
verifyConnectionIsWorking(endpoint, new ApacheHttpClient(authorityOverrideFunction), credentials);
}
use of com.github.nagyesta.lowkeyvault.http.AuthorityOverrideFunction in project lowkey-vault by nagyesta.
the class ManagementStepDefs method aVaultIsCreatedWithName.
@Given("a vault is created with name {name}")
public void aVaultIsCreatedWithName(final String vaultName) {
final String vaultAuthority = vaultName + ".localhost:8443";
final String vaultUrl = "https://" + vaultAuthority;
final AuthorityOverrideFunction overrideFunction = new AuthorityOverrideFunction(vaultAuthority, CONTAINER_AUTHORITY);
context.setProvider(new ApacheHttpClientProvider(vaultUrl, overrideFunction));
context.getClient().createVault(URI.create(vaultUrl), RecoveryLevel.RECOVERABLE_AND_PURGEABLE, 90);
}
use of com.github.nagyesta.lowkeyvault.http.AuthorityOverrideFunction in project lowkey-vault by nagyesta.
the class SecretsStepDefs method theSecretClientIsCreatedWithVaultNameSelected.
@Given("a secret client is created with the vault named {name}")
public void theSecretClientIsCreatedWithVaultNameSelected(final String vaultName) {
final String vaultAuthority = vaultName + ".localhost:8443";
final String vaultUrl = "https://" + vaultAuthority;
final AuthorityOverrideFunction overrideFunction = new AuthorityOverrideFunction(vaultAuthority, CONTAINER_AUTHORITY);
context.setProvider(new ApacheHttpClientProvider(vaultUrl, overrideFunction));
}
use of com.github.nagyesta.lowkeyvault.http.AuthorityOverrideFunction in project lowkey-vault by nagyesta.
the class LowkeyVaultContainerJupiterTest method testContainerShouldStartUpWhenCalledWithValidNames.
@Test
void testContainerShouldStartUpWhenCalledWithValidNames() {
// given + when test container is created
// then
final String endpoint = underTest.getVaultBaseUrl(VAULT_NAME);
final AuthorityOverrideFunction authorityOverrideFunction = new AuthorityOverrideFunction(underTest.getVaultAuthority(VAULT_NAME), underTest.getEndpointAuthority());
final TokenCredential credentials = new BasicAuthenticationCredential(underTest.getUsername(), underTest.getPassword());
verifyConnectionIsWorking(endpoint, new ApacheHttpClient(authorityOverrideFunction), credentials);
}
use of com.github.nagyesta.lowkeyvault.http.AuthorityOverrideFunction in project lowkey-vault by nagyesta.
the class LowkeyVaultContainerVanillaTest method testContainerShouldStartUpWhenCalledWithValidNames.
@Test
void testContainerShouldStartUpWhenCalledWithValidNames() {
// given
final LowkeyVaultContainer underTest = new LowkeyVaultContainer(DockerImageName.parse(getCurrentLowkeyVaultImageName()).asCompatibleSubstituteFor(LowkeyVaultContainer.DEFAULT_IMAGE_NAME), Collections.singleton(VAULT_NAME)).withImagePullPolicy(PullPolicy.defaultPolicy());
// when
underTest.start();
// then
final String endpoint = underTest.getVaultBaseUrl(VAULT_NAME);
final AuthorityOverrideFunction authorityOverrideFunction = new AuthorityOverrideFunction(underTest.getVaultAuthority(VAULT_NAME), underTest.getEndpointAuthority());
final TokenCredential credentials = new BasicAuthenticationCredential(underTest.getUsername(), underTest.getPassword());
verifyConnectionIsWorking(endpoint, new ApacheHttpClient(authorityOverrideFunction), credentials);
}
Aggregations