use of org.gluu.model.ldap.GluuLdapConfiguration in project oxTrust by GluuFederation.
the class LDAPAuthenticationWebResource method updateLdapConfiguration.
@PUT
@Operation(summary = "Update existing configuration", description = "Update an existing configuration")
@ApiResponses(value = { @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = LdapConfigurationDTO.class)), description = "Success"), @ApiResponse(responseCode = "404", description = "Not found") })
@ProtectedApi(scopes = { WRITE_ACCESS })
public Response updateLdapConfiguration(@Valid LdapConfigurationDTO ldapConfiguration) {
log(logger, "Update an existing configuration");
try {
GluuLdapConfiguration gluuLdapConfiguration = withVersion(ldapConfiguration);
ldapConfigurationService.update(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 LDAPAuthenticationWebResource method getLdapConfigurationStatusByName.
@GET
@Path(ApiConstants.NAME_PARAM_PATH + ApiConstants.STATUS)
@Operation(summary = "Check the status of an existing configuration", description = "Check the status of an existing configuration")
@ApiResponses(value = { @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = ConnectionStatusDTO.class)), description = "Success") })
@ProtectedApi(scopes = { READ_ACCESS })
public Response getLdapConfigurationStatusByName(@PathParam("name") String name) {
log(logger, "Check the status of an existing configuration");
try {
GluuLdapConfiguration ldapConfiguration = ldapConfigurationService.findLdapConfigurationByName(name);
org.gluu.oxtrust.util.LdapConnectionData ldapConnectionData = LdapConnectionData.from(ldapConfiguration);
ConnectionStatusDTO connectionStatus = ConnectionStatusDTO.from(this.connectionStatus.isUp(ldapConnectionData));
return Response.ok(connectionStatus).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 LdapConfigurationDtoAssembly method fromDto.
public GluuLdapConfiguration fromDto(org.gluu.oxtrust.api.server.model.LdapConfigurationDTO ldapConfiguration) {
GluuLdapConfiguration gluuLdapConfiguration = new GluuLdapConfiguration();
gluuLdapConfiguration.setLevel(ldapConfiguration.getLevel());
gluuLdapConfiguration.setConfigId(ldapConfiguration.getConfigId());
gluuLdapConfiguration.setBindDN(ldapConfiguration.getBindDN());
gluuLdapConfiguration.setBindPassword(ldapConfiguration.getBindPassword());
gluuLdapConfiguration.setServersStringsList(ldapConfiguration.getServers());
gluuLdapConfiguration.setMaxConnections(ldapConfiguration.getMaxConnections());
gluuLdapConfiguration.setUseSSL(ldapConfiguration.isUseSSL());
gluuLdapConfiguration.setBaseDNsStringsList(ldapConfiguration.getBaseDNs());
gluuLdapConfiguration.setPrimaryKey(ldapConfiguration.getPrimaryKey());
gluuLdapConfiguration.setLocalPrimaryKey(ldapConfiguration.getLocalPrimaryKey());
gluuLdapConfiguration.setUseAnonymousBind(ldapConfiguration.isUseAnonymousBind());
gluuLdapConfiguration.setEnabled(ldapConfiguration.isEnabled());
return gluuLdapConfiguration;
}
use of org.gluu.model.ldap.GluuLdapConfiguration in project oxTrust by GluuFederation.
the class LdapConfigurationDtoAssembly method fromDto.
public GluuLdapConfiguration fromDto(LdapConfigurationDTO ldapConfiguration) {
GluuLdapConfiguration gluuLdapConfiguration = new GluuLdapConfiguration();
gluuLdapConfiguration.setLevel(ldapConfiguration.getLevel());
gluuLdapConfiguration.setConfigId(ldapConfiguration.getConfigId());
gluuLdapConfiguration.setBindDN(ldapConfiguration.getBindDN());
gluuLdapConfiguration.setBindPassword(ldapConfiguration.getBindPassword());
gluuLdapConfiguration.setServersStringsList(ldapConfiguration.getServers());
gluuLdapConfiguration.setMaxConnections(ldapConfiguration.getMaxConnections());
gluuLdapConfiguration.setUseSSL(ldapConfiguration.isUseSSL());
gluuLdapConfiguration.setBaseDNsStringsList(ldapConfiguration.getBaseDNs());
gluuLdapConfiguration.setPrimaryKey(ldapConfiguration.getPrimaryKey());
gluuLdapConfiguration.setLocalPrimaryKey(ldapConfiguration.getLocalPrimaryKey());
gluuLdapConfiguration.setUseAnonymousBind(ldapConfiguration.isUseAnonymousBind());
gluuLdapConfiguration.setEnabled(ldapConfiguration.isEnabled());
return gluuLdapConfiguration;
}
use of org.gluu.model.ldap.GluuLdapConfiguration in project oxTrust by GluuFederation.
the class LdapConfigurationLookup method shouldEncryptPassword.
public boolean shouldEncryptPassword(GluuLdapConfiguration ldapConfiguration) {
try {
GluuLdapConfiguration oldConfiguration = findByName(ldapConfiguration.getConfigId());
String encryptedOldPassword = oldConfiguration.getBindPassword();
return !StringUtils.equals(encryptedOldPassword, ldapConfiguration.getBindPassword());
} catch (LdapConfigurationNotFoundException e) {
return true;
}
}
Aggregations