use of com.sequenceiq.cloudbreak.domain.LdapConfig in project cloudbreak by hortonworks.
the class LdapConfigService method getByName.
public LdapConfig getByName(String name, IdentityUser user) {
LdapConfig ldapConfig = ldapConfigRepository.findByNameInAccount(name, user.getAccount());
if (ldapConfig == null) {
throw new NotFoundException(String.format("LdapConfig '%s' not found", name));
}
authorizationService.hasReadPermission(ldapConfig);
return ldapConfig;
}
use of com.sequenceiq.cloudbreak.domain.LdapConfig in project cloudbreak by hortonworks.
the class LdapController method getPrivate.
@Override
public LdapConfigResponse getPrivate(String name) {
IdentityUser user = authenticatedUserService.getCbUser();
LdapConfig config = ldapConfigService.getPrivateConfig(name, user);
return conversionService.convert(config, LdapConfigResponse.class);
}
use of com.sequenceiq.cloudbreak.domain.LdapConfig in project cloudbreak by hortonworks.
the class LdapController method getPublic.
@Override
public LdapConfigResponse getPublic(String name) {
IdentityUser user = authenticatedUserService.getCbUser();
LdapConfig config = ldapConfigService.getPublicConfig(name, user);
return conversionService.convert(config, LdapConfigResponse.class);
}
use of com.sequenceiq.cloudbreak.domain.LdapConfig in project cloudbreak by hortonworks.
the class LdapController method getPublics.
@Override
public Set<LdapConfigResponse> getPublics() {
IdentityUser user = authenticatedUserService.getCbUser();
Set<LdapConfig> configs = ldapConfigService.retrieveAccountConfigs(user);
return toJsonSet(configs);
}
use of com.sequenceiq.cloudbreak.domain.LdapConfig in project cloudbreak by hortonworks.
the class LdapConfigRequestToLdapConfigConverter method convert.
@Override
public LdapConfig convert(LdapConfigRequest json) {
LdapConfig config = new LdapConfig();
if (Strings.isNullOrEmpty(json.getName())) {
config.setName(missingResourceNameGenerator.generateName(APIResourceType.LDAP_CONFIG));
} else {
config.setName(json.getName());
}
config.setDescription(json.getDescription());
config.setBindDn(json.getBindDn());
config.setBindPassword(json.getBindPassword());
config.setServerHost(json.getServerHost());
config.setServerPort(json.getServerPort());
config.setProtocol(json.getProtocol());
config.setGroupSearchBase(json.getGroupSearchBase());
config.setUserSearchBase(json.getUserSearchBase());
config.setUserNameAttribute(json.getUserNameAttribute());
config.setDomain(json.getDomain());
config.setDirectoryType(json.getDirectoryType() != null ? json.getDirectoryType() : DirectoryType.LDAP);
config.setUserObjectClass(json.getUserObjectClass() != null ? json.getUserObjectClass() : "person");
config.setGroupObjectClass(json.getGroupObjectClass() != null ? json.getGroupObjectClass() : "groupOfNames");
config.setGroupNameAttribute(json.getGroupNameAttribute() != null ? json.getGroupNameAttribute() : "cn");
config.setGroupMemberAttribute(json.getGroupMemberAttribute() != null ? json.getGroupMemberAttribute() : "member");
config.setAdminGroup(json.getAdminGroup());
return config;
}
Aggregations