diff --git a/api-server/src/main/java/org/gluu/oxtrust/api/server/api/impl/BaseWebResource.java b/api-server/src/main/java/org/gluu/oxtrust/api/server/api/impl/BaseWebResource.java index e90c803114..8c4fa90ece 100644 --- a/api-server/src/main/java/org/gluu/oxtrust/api/server/api/impl/BaseWebResource.java +++ b/api-server/src/main/java/org/gluu/oxtrust/api/server/api/impl/BaseWebResource.java @@ -12,7 +12,7 @@ @OpenAPIDefinition ( info = @Info ( title = "oxTrust API", - version = "4.5.3", + version = "4.5.4", description = "This is an API for Gluu Server's oxTrust administrative interface. Go to https://gluu.org for more information", termsOfService = "https://gluu.org/gluu-terms-and-conditions/", contact = @Contact(url="https://support.gluu.org/",name="Gluu Support",email="support@gluu.org"), diff --git a/api-server/src/main/java/org/gluu/oxtrust/api/server/api/impl/TrustRelationshipWebService.java b/api-server/src/main/java/org/gluu/oxtrust/api/server/api/impl/TrustRelationshipWebService.java index 063800be06..e1d7fd7ec1 100644 --- a/api-server/src/main/java/org/gluu/oxtrust/api/server/api/impl/TrustRelationshipWebService.java +++ b/api-server/src/main/java/org/gluu/oxtrust/api/server/api/impl/TrustRelationshipWebService.java @@ -655,21 +655,7 @@ private String saveTR(GluuSAMLTrustRelationship trustRelationship) { break; case MDQ: - try { - if (generateSpMetaDataFile(trustRelationship)) { - if (!update) { - trustRelationship.setStatus(GluuStatus.ACTIVE); - } - } else { - logger.error("Failed to generate MDQ SP meta-data file"); - return OxTrustConstants.RESULT_FAILURE; - } - } catch (Exception ex) { - logger.error("Failed to generate MDQ SP certificate", ex); - - return "MDQ : Failed to generate MDQ SP meta-data file"; - } - + //TODO: Implement MDQ Save break; default: @@ -1038,17 +1024,7 @@ else if (configuration.getSmtpConfiguration() == null } } - private boolean generateSpMetaDataFile(GluuSAMLTrustRelationship trustRelationship) { - String spMetadataFileName = trustRelationship.getSpMetaDataFN(); - - if (StringHelper.isEmpty(spMetadataFileName)) { - // Generate new file name - spMetadataFileName = shibboleth3ConfService.getSpNewMetadataFileName(trustRelationship); - trustRelationship.setSpMetaDataFN(spMetadataFileName); - } - - return shibboleth3ConfService.generateMDQMetadataFile(trustRelationship); - } + private boolean saveSpMetaDataFileSourceTypeManual(GluuSAMLTrustRelationship trustRelationship , String metadataStr) throws IOException { String spMetadataFileName = trustRelationship.getSpMetaDataFN(); diff --git a/api-server/src/main/java/org/gluu/oxtrust/api/server/api/impl/TrustedIDPWebResource.java b/api-server/src/main/java/org/gluu/oxtrust/api/server/api/impl/TrustedIDPWebResource.java index 2619d12332..075c8b82bf 100644 --- a/api-server/src/main/java/org/gluu/oxtrust/api/server/api/impl/TrustedIDPWebResource.java +++ b/api-server/src/main/java/org/gluu/oxtrust/api/server/api/impl/TrustedIDPWebResource.java @@ -221,7 +221,9 @@ public Response deleteTrustedIdps(@PathParam("remoteIdpHost") String remoteIdpHo if(oxTrustedIdp != null) trustedIDPService.removeTrustedIDP(oxTrustedIdp); - return Response.status(Response.Status.OK).build(); + return Response.status(Response.Status.OK).entity("{\r\n" + + " \"message\": \"OK\"\r\n" + + "}").build(); } catch (Exception e) { log(logger, e); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); diff --git a/configuration/src/main/resources/META-INF/shibboleth3/idp/mdq-metadata.xml.vm b/configuration/src/main/resources/META-INF/shibboleth3/idp/mdq-metadata.xml.vm deleted file mode 100644 index aa86d75e4c..0000000000 --- a/configuration/src/main/resources/META-INF/shibboleth3/idp/mdq-metadata.xml.vm +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - $mdqUrl - - \ No newline at end of file diff --git a/configuration/src/main/resources/META-INF/shibboleth3/idp/metadata-providers.xml.vm b/configuration/src/main/resources/META-INF/shibboleth3/idp/metadata-providers.xml.vm index d39a61cd1b..2ed3af8b49 100644 --- a/configuration/src/main/resources/META-INF/shibboleth3/idp/metadata-providers.xml.vm +++ b/configuration/src/main/resources/META-INF/shibboleth3/idp/metadata-providers.xml.vm @@ -32,21 +32,28 @@ --> #foreach( $trustRelationship in $trustParams.trusts ) - - #if($trustRelationship.spMetaDataSourceType.value == "file") + #if($trustRelationship.isFileMetadataSourceType()) - #elseif($trustRelationship.spMetaDataSourceType.value == "uri") + #elseif($trustRelationship.isUriMetadataSourceType()) - + + #elseif($trustRelationship.isMdqMetadataSourceType() and $trustRelationship.entityTypeIsFederation()) + + + + $trustRelationship.url + #end #if( $trustRelationship.gluuSAMLMetaDataFilter and $trustRelationship.getGluuSAMLMetaDataFilter().size() > 0 ) @@ -59,10 +66,11 @@ #end - #if($trustRelationship.spMetaDataSourceType.value == 'file' || $trustRelationship.spMetaDataSourceType.value == 'uri') + #if($trustRelationship.isFileMetadataSourceType() or $trustRelationship.isUriMetadataSourceType()) + + #end + #if($trustRelationship.isMdqMetadataSourceType() and $trustRelationship.entityTypeIsFederation()) #end - #end - diff --git a/model/src/main/java/org/gluu/oxtrust/model/AuditConfigLogDetails.java b/model/src/main/java/org/gluu/oxtrust/model/AuditConfigLogDetails.java new file mode 100644 index 0000000000..b9296b79f5 --- /dev/null +++ b/model/src/main/java/org/gluu/oxtrust/model/AuditConfigLogDetails.java @@ -0,0 +1,62 @@ +package org.gluu.oxtrust.model; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; + +@JsonIgnoreProperties(ignoreUnknown = true) +public class AuditConfigLogDetails { + + private String user; + private String objectName; + private String property; + private String oldValue; + private String newValue; + + + public AuditConfigLogDetails(String user, String objectName, String property, String oldValue, + String newValue) { + super(); + this.user = user; + this.objectName = objectName; + this.property = property; + this.oldValue = oldValue; + this.newValue = newValue; + } + public String getUser() { + return user; + } + public void setUser(String user) { + this.user = user; + } + public String getProperty() { + return property; + } + public void setProperty(String property) { + this.property = property; + } + public String getOldValue() { + return oldValue; + } + public void setOldValue(String oldValue) { + this.oldValue = oldValue; + } + public String getNewValue() { + return newValue; + } + public void setNewValue(String newValue) { + this.newValue = newValue; + } + public String getObjectName() { + return objectName; + } + public void setObjectName(String objectName) { + this.objectName = objectName; + } + + @Override + public String toString() { + return "AuditConfigLogDetails [user=" + user + ", objectName=" + objectName + + ", property=" + property + ", oldValue=" + oldValue + ", newValue=" + newValue + "]"; + } + + +} diff --git a/model/src/main/java/org/gluu/oxtrust/model/GluuMetadataSourceType.java b/model/src/main/java/org/gluu/oxtrust/model/GluuMetadataSourceType.java index 69be7643fe..a73a6014b6 100644 --- a/model/src/main/java/org/gluu/oxtrust/model/GluuMetadataSourceType.java +++ b/model/src/main/java/org/gluu/oxtrust/model/GluuMetadataSourceType.java @@ -8,7 +8,6 @@ import java.util.HashMap; import java.util.Map; - import org.gluu.persist.annotation.AttributeEnum; /** @@ -18,10 +17,11 @@ */ public enum GluuMetadataSourceType implements AttributeEnum { - FILE("file", "File"), URI("uri", "URI"), FEDERATION("federation", "Federation"), MANUAL("manual", "Manual"), MDQ("mdq", "MDQ"); + FILE("file", "File",1), URI("uri", "URI",2), FEDERATION("federation", "Federation",3), MANUAL("manual", "Manual",4), MDQ("mdq", "MDQ",5); private final String value; private final String displayName; + private final int rank; // used for ordering private static final Map mapByValues = new HashMap(); static { @@ -30,9 +30,10 @@ public enum GluuMetadataSourceType implements AttributeEnum { } } - private GluuMetadataSourceType(String value, String displayName) { + private GluuMetadataSourceType(String value, String displayName,int rank) { this.value = value; this.displayName = displayName; + this.rank = rank; } @Override @@ -44,6 +45,11 @@ public String getDisplayName() { return displayName; } + public int getRank() { + + return this.rank; + } + public static GluuMetadataSourceType getByValue(String value) { return mapByValues.get(value); } diff --git a/model/src/main/java/org/gluu/oxtrust/model/GluuSAMLTrustRelationship.java b/model/src/main/java/org/gluu/oxtrust/model/GluuSAMLTrustRelationship.java index 765f96ca31..8f8cf56d20 100644 --- a/model/src/main/java/org/gluu/oxtrust/model/GluuSAMLTrustRelationship.java +++ b/model/src/main/java/org/gluu/oxtrust/model/GluuSAMLTrustRelationship.java @@ -8,6 +8,8 @@ import java.io.Serializable; import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -32,7 +34,6 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; -import javax.xml.bind.annotation.XmlTransient; import com.fasterxml.jackson.annotation.JsonInclude.Include; @DataEntry @@ -140,6 +141,7 @@ public class GluuSAMLTrustRelationship extends InumEntry implements Serializable private String certificate; + public String getCertificate() { return certificate; } @@ -222,15 +224,6 @@ public boolean getSpecificRelyingPartyConfig() { return Boolean.parseBoolean(gluuSpecificRelyingPartyConfig); } - /*public List getDeconstructedTrustRelationships() { - return deconstructedTrustRelationships; - } - - public void setDeconstructedTrustRelationships( - List deconstructedTrustRelationships) { - this.deconstructedTrustRelationships = deconstructedTrustRelationships; - }*/ - public String getDescription() { return description; } @@ -450,4 +443,46 @@ public GluuEntityType getEntityType() { public void setEntityType(GluuEntityType entityType) { this.entityType = entityType; } + + public boolean entityTypeIsFederation() { + + return (this.entityType == GluuEntityType.FederationAggregate); + } + + public boolean entityTypeIsSingleSp() { + + return (this.entityType == GluuEntityType.SingleSP); + } + + public boolean isFileMetadataSourceType() { + + return (this.spMetaDataSourceType == GluuMetadataSourceType.FILE); + } + + public boolean isUriMetadataSourceType() { + + return (this.spMetaDataSourceType == GluuMetadataSourceType.URI); + } + + public boolean isMdqMetadataSourceType() { + + return (this.spMetaDataSourceType == GluuMetadataSourceType.MDQ); + } + + public boolean isMdqFederation() { + + return (this.entityType == GluuEntityType.FederationAggregate) && (this.spMetaDataSourceType == GluuMetadataSourceType.MDQ); + } + + private static class SortByDatasourceTypeComparator implements Comparator { + + public int compare(GluuSAMLTrustRelationship first, GluuSAMLTrustRelationship second) { + + return first.getSpMetaDataSourceType().getRank() - second.getSpMetaDataSourceType().getRank(); + } + } + + public static void sortByDataSourceType(List trustRelationships) { + Collections.sort(trustRelationships,new SortByDatasourceTypeComparator()); + } } \ No newline at end of file diff --git a/pom.xml b/pom.xml index 006bfdc50c..0fb89d7795 100644 --- a/pom.xml +++ b/pom.xml @@ -15,9 +15,9 @@ UTF-8 3.3.9 - 4.5.3.Final - 4.5.3.Final - 4.5.3.Final + 4.5.4-SNAPSHOT + 4.5.4-SNAPSHOT + 4.5.4-SNAPSHOT 1.5.4 @@ -202,7 +202,7 @@ org.gluu uma-rs-resteasy - 4.5.3.Final + 4.5.4-SNAPSHOT org.slf4j diff --git a/server/src/main/java/org/gluu/oxtrust/action/FederationDeconstructionAction.java b/server/src/main/java/org/gluu/oxtrust/action/FederationDeconstructionAction.java index 095ca00f28..93deebdc60 100644 --- a/server/src/main/java/org/gluu/oxtrust/action/FederationDeconstructionAction.java +++ b/server/src/main/java/org/gluu/oxtrust/action/FederationDeconstructionAction.java @@ -87,7 +87,11 @@ public List getBulkEntities() { trustRelationship = trustService.getTrustContainerFederation(trustRelationship) ; } - bulkEntities.addAll(trustRelationship.getGluuEntityId()); + List gluuEntityIds = trustRelationship.getGluuEntityId(); + if(gluuEntityIds != null) { + bulkEntities.addAll(gluuEntityIds); + } + List currentDeconstruction = trustService.getDeconstructedTrustRelationships(trustRelationship); for (GluuSAMLTrustRelationship configuredTR : currentDeconstruction) { bulkEntities.remove(configuredTR.getEntityId()); @@ -95,8 +99,11 @@ public List getBulkEntities() { } bulkFiltered = new ArrayList(); - bulkFiltered.addAll(bulkEntities); + if(bulkEntities != null) { + bulkFiltered.addAll(bulkEntities); + } + if (filteredEntities != null) { bulkFiltered.retainAll(filteredEntities); diff --git a/server/src/main/java/org/gluu/oxtrust/action/PasswordResetAction.java b/server/src/main/java/org/gluu/oxtrust/action/PasswordResetAction.java index 47021d33a8..f1d00e2b86 100644 --- a/server/src/main/java/org/gluu/oxtrust/action/PasswordResetAction.java +++ b/server/src/main/java/org/gluu/oxtrust/action/PasswordResetAction.java @@ -178,9 +178,10 @@ public void update() { String outcome = updateImpl(); if (OxTrustConstants.RESULT_SUCCESS.equals(outcome)) { facesMessages.add(FacesMessage.SEVERITY_INFO, "Password reset successful."); + redirect(); + conversationService.endConversation(); } - redirect(); - conversationService.endConversation(); + } public String updateImpl() { diff --git a/server/src/main/java/org/gluu/oxtrust/action/RegisterPersonAction.java b/server/src/main/java/org/gluu/oxtrust/action/RegisterPersonAction.java index ed9a5c6b6e..f95b2bea71 100644 --- a/server/src/main/java/org/gluu/oxtrust/action/RegisterPersonAction.java +++ b/server/src/main/java/org/gluu/oxtrust/action/RegisterPersonAction.java @@ -20,6 +20,7 @@ import javax.enterprise.context.ConversationScoped; import javax.faces.application.FacesMessage; import javax.faces.component.UIComponent; +import javax.faces.component.UIInput; import javax.faces.context.ExternalContext; import javax.faces.context.FacesContext; import javax.faces.validator.ValidatorException; @@ -36,6 +37,7 @@ import org.gluu.model.GluuStatus; import org.gluu.model.GluuUserRole; import org.gluu.model.SimpleCustomProperty; +import org.gluu.model.attribute.AttributeValidation; import org.gluu.model.custom.script.conf.CustomScriptConfiguration; import org.gluu.oxtrust.exception.DuplicateEmailException; import org.gluu.oxtrust.model.GluuCustomAttribute; @@ -510,5 +512,39 @@ public boolean isConfirmationOkay() { public void setConfirmationOkay(boolean confirmationOkay) { this.confirmationOkay = confirmationOkay; } + public void validateConfirmPassword(FacesContext context, UIComponent comp, Object value) { + Pattern pattern = null; + String attributeValue = (String) value; + if (StringHelper.isEmpty(attributeValue)) { + FacesMessage message = new FacesMessage("Value is required"); + message.setSeverity(FacesMessage.SEVERITY_ERROR); + throw new ValidatorException(message); + } + AttributeValidation validation = attributeService.getAttributeByName("userPassword").getAttributeValidation(); + boolean canValidate = validation != null && validation.getRegexp() != null && !validation.getRegexp().isEmpty(); + if (comp.getClientId().endsWith("password")) { + this.password = (String) value; + } else if (comp.getClientId().endsWith("passwordValidation")) { + this.repeatPassword = (String) value; + } + this.repeatPassword = this.repeatPassword == null ? "" : this.repeatPassword; + if (canValidate) { + pattern = Pattern.compile(validation.getRegexp()); + } + if (!StringHelper.equalsIgnoreCase(password, repeatPassword) && this.repeatPassword != null) { + ((UIInput) comp).setValid(false); + FacesMessage message = new FacesMessage("Both passwords should be the same!"); + message.setSeverity(FacesMessage.SEVERITY_ERROR); + throw new ValidatorException(message); + } + if (canValidate + && (!pattern.matcher(this.password).matches() || !pattern.matcher(this.repeatPassword).matches())) { + ((UIInput) comp).setValid(false); + FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_ERROR, + facesMessages.evalResourceAsString("#{msgs['password.validation.invalid']}"), + facesMessages.evalResourceAsString("#{msgs['password.validation.invalid']}")); + context.addMessage(comp.getClientId(context), message); + } + } } diff --git a/server/src/main/java/org/gluu/oxtrust/action/SearchClientAction.java b/server/src/main/java/org/gluu/oxtrust/action/SearchClientAction.java index b8536350d2..25b78ed9b7 100644 --- a/server/src/main/java/org/gluu/oxtrust/action/SearchClientAction.java +++ b/server/src/main/java/org/gluu/oxtrust/action/SearchClientAction.java @@ -9,6 +9,7 @@ import java.io.Serializable; import java.util.Comparator; import java.util.List; +import java.util.stream.Collectors; import javax.enterprise.context.ConversationScoped; import javax.faces.application.FacesMessage; @@ -76,7 +77,10 @@ protected String searchImpl() { } else { this.clientList = clientService.searchClients(this.searchPattern, 100); } - this.clientList.sort(Comparator.comparing(OxAuthClient::getDisplayName)); + this.clientList = this.clientList.stream() + .sorted(Comparator.comparing(OxAuthClient::getDisplayName, + Comparator.nullsFirst(Comparator.naturalOrder()))) + .collect(Collectors.toList()); this.oldSearchPattern = this.searchPattern; this.searchPattern = ""; } catch (Exception ex) { diff --git a/server/src/main/java/org/gluu/oxtrust/action/UpdateClientAction.java b/server/src/main/java/org/gluu/oxtrust/action/UpdateClientAction.java index 64f40c7e5e..08ad3e3e5b 100644 --- a/server/src/main/java/org/gluu/oxtrust/action/UpdateClientAction.java +++ b/server/src/main/java/org/gluu/oxtrust/action/UpdateClientAction.java @@ -738,11 +738,13 @@ private boolean hasSameHostname(String url1) throws MalformedURLException { boolean result = true; URL uri1 = new URL(url1); for (String url : this.loginUris) { - URL uri = new URL(url); - if (!(uri1.getHost().equalsIgnoreCase(uri.getHost()))) { - result = false; - break; - } + if(url.startsWith(HTTPS)) { + URL uri = new URL(url); + if (!(uri1.getHost().equalsIgnoreCase(uri.getHost()))) { + result = false; + break; + } + } } return result; } diff --git a/server/src/main/java/org/gluu/oxtrust/action/UpdateTrustRelationshipAction.java b/server/src/main/java/org/gluu/oxtrust/action/UpdateTrustRelationshipAction.java index ea2ec043a9..e57b678d09 100644 --- a/server/src/main/java/org/gluu/oxtrust/action/UpdateTrustRelationshipAction.java +++ b/server/src/main/java/org/gluu/oxtrust/action/UpdateTrustRelationshipAction.java @@ -71,6 +71,7 @@ import org.gluu.oxtrust.model.GluuEntityType; import org.gluu.oxtrust.model.GluuMetadataSourceType; import org.gluu.oxtrust.model.GluuSAMLTrustRelationship; +import org.gluu.oxtrust.model.GluuValidationStatus; import org.gluu.oxtrust.model.OxAuthClient; import org.gluu.oxtrust.security.Identity; import org.gluu.oxtrust.service.AttributeService; @@ -224,19 +225,19 @@ public class UpdateTrustRelationshipAction implements Serializable { private String orgUrl; public List getMetadataSourceTypesList() { - List metadataSourceTypesList = (Arrays.asList(GluuMetadataSourceType.values())); - if (GluuEntityType.FederationAggregate.equals(trustRelationship.getEntityType())) { - List GluuMetadataSourceTypeSubList = new ArrayList(); - for (GluuMetadataSourceType enumType : GluuMetadataSourceType.values()) { - if (!GluuMetadataSourceType.FEDERATION.equals(enumType)) { - GluuMetadataSourceTypeSubList.add(enumType); + + List ret = null; + if(GluuEntityType.FederationAggregate.equals(trustRelationship.getEntityType())) { + ret = new ArrayList(); + for(GluuMetadataSourceType enumType: GluuMetadataSourceType.values()) { + if(!GluuMetadataSourceType.FEDERATION.equals(enumType)) { + ret.add(enumType); } } - return GluuMetadataSourceTypeSubList; - } else { - return metadataSourceTypesList; + }else { + ret = Arrays.asList(GluuMetadataSourceType.values()); } - + return ret; } public String add() { @@ -411,21 +412,16 @@ public String saveImpl() { } break; case MDQ: - try { - if (generateSpMetaDataFile(trustRelationship)) { - if (!update) { - this.trustRelationship.setStatus(GluuStatus.ACTIVE); - } - } else { - log.error("Failed to generate SP meta-data file"); - return OxTrustConstants.RESULT_FAILURE; - } - } catch (Exception ex) { - log.error("Failed to download SP certificate", ex); - - return OxTrustConstants.RESULT_FAILURE; + //TODO: Implement MDQ save + if(!update) { + this.trustRelationship.setStatus(GluuStatus.ACTIVE); + this.trustRelationship.setValidationStatus(GluuValidationStatus.SUCCESS); } + if(this.trustRelationship.getEntityType().equals(GluuEntityType.SingleSP) && this.trustRelationship.getEntityId() == null) { + facesMessages.add(FacesMessage.SEVERITY_ERROR,"EntityID required for MDQ"); + return "invalid_entity_id"; + } break; default: @@ -433,10 +429,15 @@ public String saveImpl() { break; } updateReleasedAttributes(this.trustRelationship); + + if(trustRelationship.isMdqFederation()) { + trustRelationship.setFederation(true); + } if (trustRelationship.getSpMetaDataSourceType().equals(GluuMetadataSourceType.FEDERATION)) { boolean federation = shibboleth3ConfService.isFederation(this.trustRelationship); this.trustRelationship.setFederation(federation); } + trustContactsAction.saveContacts(); if (update) { try { @@ -1220,7 +1221,7 @@ public void setAvailableEntities(List availableEntities) { } public List getAvailableEntities() { - if (getContainerFederationTr() == null) { + if (!trustRelationship.isFederation() || getContainerFederationTr() == null) { return null; } else { if (!getContainerFederationTr().getGluuEntityId().contains(trustRelationship.getEntityId())) { @@ -1312,6 +1313,16 @@ public List getFederatees(GluuSAMLTrustRelationship t } + public List getAllMdqFederatedTrustRelationships() { + + try { + return trustService.getAllMdqFederatedTrustRelationships(); + }catch(Exception e) { + e.printStackTrace(); + return new ArrayList(); + } + } + public Saml2Settings getSaml2Settings() { return saml2Settings; } @@ -1344,17 +1355,7 @@ public void generateMetadata() throws MalformedURLException, CertificateExceptio } - private boolean generateSpMetaDataFile(GluuSAMLTrustRelationship trustRelationship) { - String spMetadataFileName = trustRelationship.getSpMetaDataFN(); - - if (StringHelper.isEmpty(spMetadataFileName)) { - // Generate new file name - spMetadataFileName = shibboleth3ConfService.getSpNewMetadataFileName(trustRelationship); - trustRelationship.setSpMetaDataFN(spMetadataFileName); - } - - return shibboleth3ConfService.generateMDQMetadataFile(trustRelationship); - } + public String getMetadataStr() { return metadataStr; diff --git a/server/src/main/java/org/gluu/oxtrust/exception/GlobalExceptionHandler.java b/server/src/main/java/org/gluu/oxtrust/exception/GlobalExceptionHandler.java index fd133f4531..87cfef920b 100644 --- a/server/src/main/java/org/gluu/oxtrust/exception/GlobalExceptionHandler.java +++ b/server/src/main/java/org/gluu/oxtrust/exception/GlobalExceptionHandler.java @@ -55,7 +55,7 @@ public void handle() throws FacesException { storeRequestURI(); performRedirect(externalContext, "/login.htm"); } else { - log.trace(t.getMessage(), t); + log.debug(t.getMessage(), t); performRedirect(externalContext, "/error.htm"); } fc.renderResponse(); diff --git a/server/src/main/java/org/gluu/oxtrust/ldap/cache/service/CacheRefreshTimer.java b/server/src/main/java/org/gluu/oxtrust/ldap/cache/service/CacheRefreshTimer.java index 720bc8423a..ea1f7700fb 100644 --- a/server/src/main/java/org/gluu/oxtrust/ldap/cache/service/CacheRefreshTimer.java +++ b/server/src/main/java/org/gluu/oxtrust/ldap/cache/service/CacheRefreshTimer.java @@ -39,7 +39,6 @@ import org.gluu.model.SchemaEntry; import org.gluu.model.custom.script.model.bind.BindCredentials; import org.gluu.model.ldap.GluuLdapConfiguration; -import org.gluu.oxtrust.service.config.ConfigurationFactory; import org.gluu.oxtrust.ldap.cache.model.CacheCompoundKey; import org.gluu.oxtrust.ldap.cache.model.GluuInumMap; import org.gluu.oxtrust.ldap.cache.model.GluuSimplePerson; @@ -59,6 +58,7 @@ import org.gluu.oxtrust.service.PairwiseIdService; import org.gluu.oxtrust.service.PersonService; import org.gluu.oxtrust.service.cdi.event.CacheRefreshEvent; +import org.gluu.oxtrust.service.config.ConfigurationFactory; import org.gluu.oxtrust.service.external.ExternalCacheRefreshService; import org.gluu.oxtrust.util.OxTrustConstants; import org.gluu.oxtrust.util.PropertyUtil; @@ -68,7 +68,6 @@ import org.gluu.persist.exception.BasePersistenceException; import org.gluu.persist.exception.EntryPersistenceException; import org.gluu.persist.exception.operation.SearchException; -import org.gluu.persist.ldap.impl.LdapEntryManager; import org.gluu.persist.ldap.impl.LdapEntryManagerFactory; import org.gluu.persist.ldap.operation.LdapOperationService; import org.gluu.persist.model.SearchScope; @@ -920,6 +919,7 @@ private List loadSourceServerEntriesWithoutLimits( // Add to result and ignore root entry if needed for (GluuSimplePerson currentSourcePerson : currentSourcePersons) { currentSourcePerson.setSourceServerName(sourceServerName); + externalCacheRefreshService.executeExternalUpdateSourceUserMethods(currentSourcePerson); // if (!StringHelper.equalsIgnoreCase(baseDn, // currentSourcePerson.getDn())) { String currentSourcePersonDn = currentSourcePerson.getDn().toLowerCase(); @@ -969,6 +969,7 @@ private List loadSourceServerEntries(CacheRefreshConfiguration // Add to result and ignore root entry if needed for (GluuSimplePerson currentSourcePerson : currentSourcePersons) { currentSourcePerson.setSourceServerName(sourceServerName); + externalCacheRefreshService.executeExternalUpdateSourceUserMethods(currentSourcePerson); // if (!StringHelper.equalsIgnoreCase(baseDn, // currentSourcePerson.getDn())) { String currentSourcePersonDn = currentSourcePerson.getDn().toLowerCase(); diff --git a/server/src/main/java/org/gluu/oxtrust/service/EntityIDMonitoringService.java b/server/src/main/java/org/gluu/oxtrust/service/EntityIDMonitoringService.java index fe574d7f6f..223f26b9e8 100644 --- a/server/src/main/java/org/gluu/oxtrust/service/EntityIDMonitoringService.java +++ b/server/src/main/java/org/gluu/oxtrust/service/EntityIDMonitoringService.java @@ -102,6 +102,7 @@ public void processMetadataValidationTimerEvent( } } catch (Throwable ex) { log.error("Exception happened while monitoring EntityId", ex); + ex.printStackTrace(); } finally { this.isActive.set(false); } @@ -111,7 +112,7 @@ public void process() { log.trace("Starting entityId monitoring process."); log.trace("EVENT_METADATA_ENTITY_ID_UPDATE Starting"); for (GluuSAMLTrustRelationship tr : trustService.getAllTrustRelationships().stream() - .filter(e -> e.isFederation()).collect(Collectors.toList())) { + .filter(e -> e.isFederation()).filter(e -> !e.isMdqFederation()).collect(Collectors.toList())) { log.info("==========================CURRENT TR " + tr.getInum()); String idpMetadataFolder = shibboleth3ConfService.getIdpMetadataDir(); String metadataFile = idpMetadataFolder + tr.getSpMetaDataFN(); diff --git a/server/src/main/java/org/gluu/oxtrust/service/MetadataValidationTimer.java b/server/src/main/java/org/gluu/oxtrust/service/MetadataValidationTimer.java index 97e66ff798..9daef05158 100644 --- a/server/src/main/java/org/gluu/oxtrust/service/MetadataValidationTimer.java +++ b/server/src/main/java/org/gluu/oxtrust/service/MetadataValidationTimer.java @@ -8,6 +8,8 @@ import java.util.ArrayList; import java.util.Arrays; +import java.util.Collections; +import java.util.Comparator; import java.util.HashSet; import java.util.LinkedList; import java.util.List; @@ -70,6 +72,7 @@ public class MetadataValidationTimer { private LinkedBlockingQueue metadataUpdates; + @PostConstruct public void init() { this.isActive = new AtomicBoolean(true); diff --git a/server/src/main/java/org/gluu/oxtrust/service/external/ExternalCacheRefreshService.java b/server/src/main/java/org/gluu/oxtrust/service/external/ExternalCacheRefreshService.java index 00149aec5f..5da32bf0b8 100644 --- a/server/src/main/java/org/gluu/oxtrust/service/external/ExternalCacheRefreshService.java +++ b/server/src/main/java/org/gluu/oxtrust/service/external/ExternalCacheRefreshService.java @@ -16,6 +16,7 @@ import org.gluu.model.custom.script.conf.CustomScriptConfiguration; import org.gluu.model.custom.script.model.bind.BindCredentials; import org.gluu.model.custom.script.type.user.CacheRefreshType; +import org.gluu.oxtrust.ldap.cache.model.GluuSimplePerson; import org.gluu.oxtrust.model.GluuCustomPerson; import org.gluu.service.custom.script.ExternalScriptService; import org.gluu.util.StringHelper; @@ -49,6 +50,25 @@ public boolean executeExternalUpdateUserMethod(CustomScriptConfiguration customS return false; } + public boolean executeExternalUpdateSourceUserMethod(CustomScriptConfiguration customScriptConfiguration, GluuSimplePerson user) { + try { + CacheRefreshType externalType = (CacheRefreshType) customScriptConfiguration.getExternalType(); + Map configurationAttributes = customScriptConfiguration.getConfigurationAttributes(); + + // Execute only if API > 3 + if (externalType.getApiVersion() > 3) { + log.debug("Executing python 'updateSourceUser' method"); + + return externalType.updateSourceUser(user, configurationAttributes); + } + } catch (Exception ex) { + log.error(ex.getMessage(), ex); + saveScriptError(customScriptConfiguration.getCustomScript(), ex); + } + + return false; + } + public BindCredentials executeExternalGetBindCredentialsMethod(CustomScriptConfiguration customScriptConfiguration, String configId) { try { log.debug("Executing python 'getBindCredentialsMethod' method"); @@ -97,6 +117,18 @@ public boolean executeExternalUpdateUserMethods(GluuCustomPerson user) { return result; } + public boolean executeExternalUpdateSourceUserMethods(GluuSimplePerson user) { + boolean result = true; + for (CustomScriptConfiguration customScriptConfiguration : this.customScriptConfigurations) { + result &= executeExternalUpdateSourceUserMethod(customScriptConfiguration, user); + if (!result) { + return result; + } + } + + return result; + } + public BindCredentials executeExternalGetBindCredentialsMethods(String configId) { BindCredentials result = null; for (CustomScriptConfiguration customScriptConfiguration : this.customScriptConfigurations) { diff --git a/server/src/main/java/org/gluu/oxtrust/util/PasswordValidator.java b/server/src/main/java/org/gluu/oxtrust/util/PasswordValidator.java index 4f4d87e527..3b02095315 100644 --- a/server/src/main/java/org/gluu/oxtrust/util/PasswordValidator.java +++ b/server/src/main/java/org/gluu/oxtrust/util/PasswordValidator.java @@ -49,6 +49,9 @@ public void validate(FacesContext arg0, UIComponent arg1, Object value) throws V if (hasValidation) { matcher = pattern.matcher(value.toString()); } + if (facesMessages == null) { + facesMessages = CdiUtil.bean(FacesMessages.class); + } if (hasValidation && !matcher.matches()) { FacesMessage msg = new FacesMessage( facesMessages.evalResourceAsString("#{msgs['password.validation.invalid']}")); diff --git a/server/src/main/resources/oxtrust.properties b/server/src/main/resources/oxtrust.properties index 422b76384b..b840f5e8e8 100644 --- a/server/src/main/resources/oxtrust.properties +++ b/server/src/main/resources/oxtrust.properties @@ -434,7 +434,7 @@ organization.lastRun = Last run organization.updatesAtTheLastRun = Updates at the last run organization.problemsAtTheLastRun = Problems at the last run organization.refreshMethod = Refresh Method -organization.sourceAttributeToDesitnation = Add source attribute to destination attribute mapping +organization.sourceAttributeToDesitnation = Change attribute name from source to destination: organization.pollingInterval = Polling interval (minutes) organization.serverIPAddress = Server IP Address organization.snapshotFolder = Snapshot Folder @@ -738,6 +738,10 @@ trustmanager.filter = Filter trustmanager.selectWhichMembers = Select which members of this federation you would like configure individually trustmanager.availableFederationMembers = Available federation members trustmanager.membersSelectedForIndividualsConfiguration = Members selected for individuals configuration +trustmanager.mdqUrl = MDQ Base Url +trustmanager.selectMdqProvider = Select MDQ Provider +trustmanager.mdqProviderSelectLabel = MDQ Provider +trustmanager.mdqEntityId = MDQ Entity ID uma.uma = UMA uma.scopes = Scopes @@ -996,7 +1000,7 @@ mail.verify.message.subject = SMTP Server Configuration Verification mail.verify.message.plain.body = SMTP Server Configuration Verification Successful. mail.verify.message.html.body = SMTP Server Configuration Verification Successful. -mail.reset.found.message.subject = Password reset was requested at #{organizationName} identity server +mail.reset.found.message.subject = Password reset was requested at #{renderParams.map['organizationName']} identity server mail.reset.found.message.plain.body =

Hello #{renderParams.map['givenName']},



We received a request to reset your password.

If you did not make this request, you can safely ignore this message.

You may click the button below to choose your new password.

This link will expire in #{renderParams.map['expirationTime']}.

mail.reset.found.message.html.body =

Hello #{renderParams.map['givenName']},



We received a request to reset your password.

If you did not make this request, you can safely ignore this message.

You may click the button below to choose your new password.

This link will expire in #{renderParams.map['expirationTime']}.

diff --git a/server/src/main/resources/oxtrust_en.properties b/server/src/main/resources/oxtrust_en.properties index 822f33e702..5d1ea43085 100644 --- a/server/src/main/resources/oxtrust_en.properties +++ b/server/src/main/resources/oxtrust_en.properties @@ -440,7 +440,7 @@ organization.lastRun = Last run organization.updatesAtTheLastRun = Updates at the last run organization.problemsAtTheLastRun = Problems at the last run organization.refreshMethod = Refresh Method -organization.sourceAttributeToDesitnation = Add source attribute to destination attribute mapping +organization.sourceAttributeToDesitnation = Change attribute name from source to destination: organization.pollingInterval = Polling interval (minutes) organization.serverIPAddress = Server IP Address organization.snapshotFolder = Snapshot Folder @@ -749,6 +749,10 @@ trustmanager.filter = Filter trustmanager.selectWhichMembers = Select which members of this federation you would like configure individually trustmanager.availableFederationMembers = Available federation members trustmanager.membersSelectedForIndividualsConfiguration = Members selected for individuals configuration +trustmanager.mdqUrl = MDQ Base Url +trustmanager.selectMdqProvider = Select MDQ Provider +trustmanager.mdqProviderSelectLabel = MDQ Provider +trustmanager.mdqEntityId = MDQ Entity ID uma.uma = UMA uma.scopes = Scopes @@ -1029,7 +1033,7 @@ mail.verify.message.subject = SMTP Server Configuration Verification mail.verify.message.plain.body = SMTP Server Configuration Verification Successful. mail.verify.message.html.body = SMTP Server Configuration Verification Successful. -mail.reset.found.message.subject = Password reset was requested at #{organizationName} identity server +mail.reset.found.message.subject = Password reset was requested at #{renderParams.map['organizationName']} identity server mail.reset.found.message.plain.body =

Hello #{renderParams.map['givenName']},



We received a request to reset your password.

If you did not make this request, you can safely ignore this message.

You may click the button below to choose your new password.

This link will expire in #{renderParams.map['expirationTime']}.

mail.reset.found.message.html.body =

Hello #{renderParams.map['givenName']},



We received a request to reset your password.

If you did not make this request, you can safely ignore this message.

You may click the button below to choose your new password.

This link will expire in #{renderParams.map['expirationTime']}.

diff --git a/server/src/main/resources/oxtrust_fr.properties b/server/src/main/resources/oxtrust_fr.properties index 28ca8bf3f4..eef30ba59e 100644 --- a/server/src/main/resources/oxtrust_fr.properties +++ b/server/src/main/resources/oxtrust_fr.properties @@ -729,7 +729,8 @@ trustmanager.selectEntityID = Choisir l'entityID de ce Trust Relationship trustmanager.filter = Filtre trustmanager.selectWhichMembers = Sélectionnez les membres de cette fédération que vous souhaitez configurer individuellement trustmanager.availableFederationMembers = Membres de la fédération disponibles -trustmanager.membersSelectedForIndividualsConfiguration = Membres sélectionnés pour la configuration des individus +trustmanager.membersSelectedForIndividualsConfiguration = Membres sélectionnés pour la configuration des individus +trustmanager.mdqUrl = URL De Base MDQ uma.uma = UMA uma.scopes = Scopes diff --git a/server/src/main/webapp/WEB-INF/incl/layout/topmenu.xhtml b/server/src/main/webapp/WEB-INF/incl/layout/topmenu.xhtml index 24949763c6..96e0d148be 100644 --- a/server/src/main/webapp/WEB-INF/incl/layout/topmenu.xhtml +++ b/server/src/main/webapp/WEB-INF/incl/layout/topmenu.xhtml @@ -24,18 +24,7 @@