use of com.sequenceiq.environment.api.v1.credential.model.parameters.azure.AzureCredentialRequestParameters in project cloudbreak by hortonworks.
the class EnvironmentServiceIntegrationTest method testCredentialInteractiveLogin.
@Test
public void testCredentialInteractiveLogin() throws InterruptedException {
credentialRequest.setName("testcredential");
credentialRequest.setCloudPlatform("AZURE");
AzureCredentialRequestParameters azureCredentialRequestParameters = new AzureCredentialRequestParameters();
azureCredentialRequestParameters.setSubscriptionId("subid");
azureCredentialRequestParameters.setTenantId("tenant");
RoleBasedRequest roleBasedRequest = new RoleBasedRequest();
roleBasedRequest.setDeploymentAddress("alma");
roleBasedRequest.setRoleName("role");
azureCredentialRequestParameters.setRoleBased(roleBasedRequest);
credentialRequest.setAzure(azureCredentialRequestParameters);
InteractiveLoginResult interactiveLoginResult = new InteractiveLoginResult(1L, Map.of("user_code", USER_CODE, "verification_url", VERIFICATION_URL));
when(requestProvider.getInteractiveLoginRequest(any(), any())).thenReturn(interactiveLoginRequest);
when(interactiveLoginRequest.await()).thenReturn(interactiveLoginResult);
InteractiveCredentialResponse result = client.credentialV1Endpoint().interactiveLogin(credentialRequest);
assertEquals(result.getUserCode(), USER_CODE);
assertEquals(result.getVerificationUrl(), VERIFICATION_URL);
}
use of com.sequenceiq.environment.api.v1.credential.model.parameters.azure.AzureCredentialRequestParameters in project cloudbreak by hortonworks.
the class AzureCloudProvider method credential.
@Override
public CredentialTestDto credential(CredentialTestDto credential) {
AzureCredentialRequestParameters parameters = new AzureCredentialRequestParameters();
parameters.setSubscriptionId(azureProperties.getCredential().getSubscriptionId());
parameters.setTenantId(azureProperties.getCredential().getTenantId());
AppBasedRequest appBased = new AppBasedRequest();
appBased.setAccessKey(azureProperties.getCredential().getAppId());
appBased.setSecretKey(azureProperties.getCredential().getAppPassword());
parameters.setAppBased(appBased);
validateCredential(parameters);
return credential.withAzureParameters(parameters).withCloudPlatform(CloudPlatform.AZURE.name()).withDescription(commonCloudProperties().getDefaultCredentialDescription());
}
Aggregations