use of com.sequenceiq.freeipa.controller.exception.UnsupportedException in project cloudbreak by hortonworks.
the class UserKeytabService method validateFreeIpaState.
private void validateFreeIpaState(String workloadUsername, String environmentCrn) {
String accountId = Crn.safeFromString(environmentCrn).getAccountId();
FreeIpaClient freeIpaClient;
try {
freeIpaClient = freeIpaClientFactory.getFreeIpaClientByAccountAndEnvironment(environmentCrn, accountId);
if (!FreeIpaCapabilities.hasSetPasswordHashSupport(freeIpaClient.getConfig())) {
throw new UnsupportedException("User keytab retrieval requires a newer environment and FreeIPA version");
}
Optional<User> user = freeIpaClient.userFind(workloadUsername);
if (user.isEmpty()) {
throw new NotFoundException(String.format("Workload user %s has not been synced into environment %s", workloadUsername, environmentCrn));
}
} catch (FreeIpaClientException e) {
throw new RuntimeException(e);
}
}
Aggregations