Skip to content

Commit

Permalink
Merge branch 'master' into version_4.5.4
Browse files Browse the repository at this point in the history
Signed-off-by: Yuriy Movchan <[email protected]>
  • Loading branch information
yurem authored Feb 9, 2024
2 parents 66e8825 + 00459fa commit 97c2131
Show file tree
Hide file tree
Showing 33 changed files with 560 additions and 264 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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="[email protected]"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,28 @@
-->

#foreach( $trustRelationship in $trustParams.trusts )

#if($trustRelationship.spMetaDataSourceType.value == "file")
#if($trustRelationship.isFileMetadataSourceType())

<MetadataProvider id="SiteSP$trustParams.trustIds.get($trustRelationship.inum)"
xsi:type="FilesystemMetadataProvider"
metadataFile="$medataFolder$trustRelationship.spMetaDataFN">

#elseif($trustRelationship.spMetaDataSourceType.value == "uri")
#elseif($trustRelationship.isUriMetadataSourceType())

<MetadataProvider id="SiteSP$trustParams.trustIds.get($trustRelationship.inum)"
xsi:type="FileBackedHTTPMetadataProvider"
maxRefreshDelay="$trustRelationship.maxRefreshDelay"
metadataURL="$trustRelationship.spMetaDataURL"
backingFile="$medataFolder$trustRelationship.spMetaDataFN">


#elseif($trustRelationship.isMdqMetadataSourceType() and $trustRelationship.entityTypeIsFederation())
<MetadataProvider id="SiteSP$trustParams.trustIds.get($trustRelationship.inum)"
xsi:type="DynamicHTTPMetadataProvider" connectionRequestTimeout="PT0S"
connectionTimeout="PT0S" socketTimeout="PT0S">

<MetadataFilter xsi:type="RequiredValidUntil" maxValidityInterval="P1D"/>
<MetadataQueryProtocol>$trustRelationship.url</MetadataQueryProtocol>

#end

#if( $trustRelationship.gluuSAMLMetaDataFilter and $trustRelationship.getGluuSAMLMetaDataFilter().size() > 0 )
Expand All @@ -59,10 +66,11 @@

#end

#if($trustRelationship.spMetaDataSourceType.value == 'file' || $trustRelationship.spMetaDataSourceType.value == 'uri')
#if($trustRelationship.isFileMetadataSourceType() or $trustRelationship.isUriMetadataSourceType())
</MetadataProvider>
#end
#if($trustRelationship.isMdqMetadataSourceType() and $trustRelationship.entityTypeIsFederation())
</MetadataProvider>
#end

#end

</MetadataProvider>
Original file line number Diff line number Diff line change
@@ -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 + "]";
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

import java.util.HashMap;
import java.util.Map;

import org.gluu.persist.annotation.AttributeEnum;

/**
Expand All @@ -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<String, GluuMetadataSourceType> mapByValues = new HashMap<String, GluuMetadataSourceType>();
static {
Expand All @@ -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
Expand All @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand Down Expand Up @@ -140,6 +141,7 @@ public class GluuSAMLTrustRelationship extends InumEntry implements Serializable

private String certificate;


public String getCertificate() {
return certificate;
}
Expand Down Expand Up @@ -222,15 +224,6 @@ public boolean getSpecificRelyingPartyConfig() {
return Boolean.parseBoolean(gluuSpecificRelyingPartyConfig);
}

/*public List<DeconstructedTrustRelationship> getDeconstructedTrustRelationships() {
return deconstructedTrustRelationships;
}
public void setDeconstructedTrustRelationships(
List<DeconstructedTrustRelationship> deconstructedTrustRelationships) {
this.deconstructedTrustRelationships = deconstructedTrustRelationships;
}*/

public String getDescription() {
return description;
}
Expand Down Expand Up @@ -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<GluuSAMLTrustRelationship> {

public int compare(GluuSAMLTrustRelationship first, GluuSAMLTrustRelationship second) {

return first.getSpMetaDataSourceType().getRank() - second.getSpMetaDataSourceType().getRank();
}
}

public static void sortByDataSourceType(List<GluuSAMLTrustRelationship> trustRelationships) {
Collections.sort(trustRelationships,new SortByDatasourceTypeComparator());
}
}
8 changes: 4 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.min-version>3.3.9</maven.min-version>

<gluu.parent.version>4.5.3.Final</gluu.parent.version>
<oxcore.version>4.5.3.Final</oxcore.version>
<oxauth.version>4.5.3.Final</oxauth.version>
<gluu.parent.version>4.5.4-SNAPSHOT</gluu.parent.version>
<oxcore.version>4.5.4-SNAPSHOT</oxcore.version>
<oxauth.version>4.5.4-SNAPSHOT</oxauth.version>

<jettison.version>1.5.4</jettison.version>

Expand Down Expand Up @@ -202,7 +202,7 @@
<dependency>
<groupId>org.gluu</groupId>
<artifactId>uma-rs-resteasy</artifactId>
<version>4.5.3.Final</version>
<version>4.5.4-SNAPSHOT</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,16 +87,23 @@ public List<String> getBulkEntities() {
trustRelationship = trustService.getTrustContainerFederation(trustRelationship) ;
}

bulkEntities.addAll(trustRelationship.getGluuEntityId());
List<String> gluuEntityIds = trustRelationship.getGluuEntityId();
if(gluuEntityIds != null) {
bulkEntities.addAll(gluuEntityIds);
}

List<GluuSAMLTrustRelationship> currentDeconstruction = trustService.getDeconstructedTrustRelationships(trustRelationship);
for (GluuSAMLTrustRelationship configuredTR : currentDeconstruction) {
bulkEntities.remove(configuredTR.getEntityId());
}

}
bulkFiltered = new ArrayList<String>();
bulkFiltered.addAll(bulkEntities);

if(bulkEntities != null) {
bulkFiltered.addAll(bulkEntities);
}

if (filteredEntities != null) {
bulkFiltered.retainAll(filteredEntities);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
Loading

0 comments on commit 97c2131

Please sign in to comment.