use of com.sequenceiq.environment.credential.attributes.azure.CodeGrantFlowAttributes in project cloudbreak by hortonworks.
the class CredentialService method updateAuthorizationCodeOfAzureCredential.
private void updateAuthorizationCodeOfAzureCredential(Credential credential, String authorizationCode) {
try {
CredentialAttributes credentialAttributes = new Json(credential.getAttributes()).get(CredentialAttributes.class);
if (credentialAttributes.getAzure() != null && credentialAttributes.getAzure().getCodeGrantFlowBased() != null) {
CodeGrantFlowAttributes codeGrantFlowAttributes = credentialAttributes.getAzure().getCodeGrantFlowBased();
codeGrantFlowAttributes.setAuthorizationCode(authorizationCode);
credential.setAttributes(new Json(credentialAttributes).getValue());
}
} catch (IOException e) {
LOGGER.info("Attributes of credential '{}' could not get from JSON attributes", credential.getName());
}
}
use of com.sequenceiq.environment.credential.attributes.azure.CodeGrantFlowAttributes in project cloudbreak by hortonworks.
the class CredentialServiceTest method getTestAttributes.
private String getTestAttributes(String state, String deploymentAddress, String url) {
CodeGrantFlowAttributes codeGrantFlowBased = new CodeGrantFlowAttributes();
codeGrantFlowBased.setDeploymentAddress(deploymentAddress);
codeGrantFlowBased.setAppLoginUrl(url);
codeGrantFlowBased.setCodeGrantFlowState(state);
codeGrantFlowBased.setAuthorizationCode(CODE);
return getTestAttributesWithCodeGrantFlow(codeGrantFlowBased);
}
use of com.sequenceiq.environment.credential.attributes.azure.CodeGrantFlowAttributes in project cloudbreak by hortonworks.
the class AzureCredentialV1ParametersToAzureCredentialAttributesConverter method getRoleBased.
private CodeGrantFlowAttributes getRoleBased(RoleBasedRequest roleBased) {
CodeGrantFlowAttributes response = new CodeGrantFlowAttributes();
response.setDeploymentAddress(roleBased.getDeploymentAddress());
return response;
}
use of com.sequenceiq.environment.credential.attributes.azure.CodeGrantFlowAttributes in project cloudbreak by hortonworks.
the class CredentialService method getCodeGrantFlowAppLoginUrl.
private String getCodeGrantFlowAppLoginUrl(Credential credential) {
CodeGrantFlowAttributes azureCodeGrantFlowAttributes = getAzureCodeGrantFlowAttributes(credential);
Object appLoginUrl = Optional.ofNullable(azureCodeGrantFlowAttributes.getAppLoginUrl()).orElseThrow(() -> new CredentialOperationException("Unable to obtain App login url!"));
return String.valueOf(appLoginUrl);
}
Aggregations