use of org.gluu.model.ldap.GluuLdapConfiguration in project oxTrust by GluuFederation.
the class LDAPAuthenticationWebResource method setupVersion.
private void setupVersion(LdapConfigurationDTO ldapConfiguration, GluuLdapConfiguration result) {
final String name = ldapConfiguration.getConfigId();
GluuLdapConfiguration gluuLdapConfiguration = ldapConfigurationService.findLdapConfigurationByName(name);
result.setVersion(gluuLdapConfiguration.getVersion());
}
use of org.gluu.model.ldap.GluuLdapConfiguration in project oxTrust by GluuFederation.
the class LDAPAuthenticationWebResource method createLdapConfiguration.
@POST
@Operation(summary = "Create a new configuration", description = "Create a new configuration")
@ApiResponses(value = { @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = LdapConfigurationDTO.class)), description = "Success") })
@ProtectedApi(scopes = { WRITE_ACCESS })
public Response createLdapConfiguration(@Valid LdapConfigurationDTO ldapConfiguration) {
log(logger, "Create a new configuration");
try {
if (existingLdapConfigurationValidator.isInvalid(ldapConfiguration)) {
throw new LdapConfigurationDuplicatedException(ldapConfiguration.getConfigId());
}
GluuLdapConfiguration gluuLdapConfiguration = ldapConfigurationDtoAssembly.fromDto(ldapConfiguration);
ldapConfigurationService.save(gluuLdapConfiguration);
return Response.ok(read(ldapConfiguration.getConfigId())).build();
} catch (Exception e) {
log(logger, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build();
}
}
use of org.gluu.model.ldap.GluuLdapConfiguration in project oxTrust by GluuFederation.
the class LdapConfigurationService method remove.
public void remove(String name) {
GluuLdapConfiguration toRemove = findLdapConfigurationByName(name);
List<GluuLdapConfiguration> allConfiguration = new ArrayList<GluuLdapConfiguration>(findLdapConfigurations());
List<GluuLdapConfiguration> newConfigurations = excludeFromConfigurations(allConfiguration, toRemove);
save(newConfigurations);
}
use of org.gluu.model.ldap.GluuLdapConfiguration in project oxTrust by GluuFederation.
the class LdapConfigurationService method oxIDPAuthConfs.
private List<OxIDPAuthConf> oxIDPAuthConfs(List<GluuLdapConfiguration> ldapConfigurations) {
final LdapConfigurationLookup ldapConfigurationLookup = new LdapConfigurationLookup(findLdapConfigurations());
List<OxIDPAuthConf> idpConf = new ArrayList<OxIDPAuthConf>();
for (GluuLdapConfiguration ldapConfig : ldapConfigurations) {
if (ldapConfigurationLookup.shouldEncryptPassword(ldapConfig)) {
ldapConfig.setBindPassword(encrypt(ldapConfig.getBindPassword()));
}
if (ldapConfig.isUseAnonymousBind()) {
ldapConfig.setBindDN(null);
}
OxIDPAuthConf ldapConfigIdpAuthConf = new OxIDPAuthConf();
ldapConfig.updateStringsLists();
ldapConfigIdpAuthConf.setType(AUTH);
ldapConfigIdpAuthConf.setVersion(ldapConfigIdpAuthConf.getVersion() + 1);
ldapConfigIdpAuthConf.setName(ldapConfig.getConfigId());
ldapConfigIdpAuthConf.setEnabled(ldapConfig.isEnabled());
ldapConfigIdpAuthConf.setConfig(ldapConfig);
idpConf.add(ldapConfigIdpAuthConf);
}
return idpConf;
}
use of org.gluu.model.ldap.GluuLdapConfiguration in project oxTrust by GluuFederation.
the class LDAPAuthenticationWebResource method withVersion.
private GluuLdapConfiguration withVersion(LdapConfigurationDTO ldapConfiguration) {
GluuLdapConfiguration result = ldapConfigurationDtoAssembly.fromDto(ldapConfiguration);
setupVersion(ldapConfiguration, result);
return result;
}
Aggregations