Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into feature/SHIBUI-1734
Browse files Browse the repository at this point in the history
  • Loading branch information
chasegawa committed May 5, 2021
2 parents ed2ec50 + 772de36 commit 1112662
Show file tree
Hide file tree
Showing 117 changed files with 1,594 additions and 1,400 deletions.
2 changes: 1 addition & 1 deletion backend/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ dependencies {

task copyUI(type: Copy) {
from tasks.findByPath(':ui:npm_run_buildProd').outputs
into new File(buildDir, 'generated/ui/static')
into new File(buildDir, 'generated/ui/resources')
}

task integrationTest(type: Test) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ class JPAMetadataResolverServiceImpl implements MetadataResolverService {

void constructXmlNodeForResolver(DynamicHttpMetadataResolver resolver, def markupBuilderDelegate, Closure childNodes) {
markupBuilderDelegate.MetadataProvider(id: resolver.xmlId,
'xsi:type': 'DynamicHttpMetadataProvider',
'xsi:type': 'DynamicHTTPMetadataProvider',
requireValidMetadata: !resolver.requireValidMetadata ?: null,
failFastInitialization: !resolver.failFastInitialization ?: null,
sortKey: resolver.sortKey,
Expand Down Expand Up @@ -559,4 +559,4 @@ class JPAMetadataResolverServiceImpl implements MetadataResolverService {

}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ public String index() {
public void indexHtml(HttpServletRequest request, HttpServletResponse response) throws IOException, URISyntaxException {
//This method is necessary in order for Angular framework to honor dynamic ServletContext
//under which shib ui application is deployed, both during initial index.html load and subsequest page refreshes
String content = new BufferedReader(new InputStreamReader(request.getServletContext()
.getResourceAsStream("/WEB-INF/classes/resources/index.html")))
String content = new BufferedReader(new InputStreamReader(this.getClass()
.getResourceAsStream("/resources/index.html")))
.lines()
.collect(Collectors.joining("\n"));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
import org.springframework.web.bind.annotation.RestControllerAdvice;
import org.springframework.web.client.HttpClientErrorException;

import java.util.ArrayList;
import java.util.List;
import static org.springframework.http.HttpStatus.BAD_REQUEST;
import static org.springframework.http.HttpStatus.INTERNAL_SERVER_ERROR;
import static org.springframework.http.HttpStatus.NOT_FOUND;
Expand Down Expand Up @@ -60,6 +62,23 @@ public final ResponseEntity<ErrorResponse> metadataFileNotFoundHandler(MetadataF

@ExceptionHandler(JsonSchemaValidationFailedException.class)
public final ResponseEntity<?> handleJsonSchemaValidationFailedException(JsonSchemaValidationFailedException ex) {
return ResponseEntity.status(BAD_REQUEST).body(new ErrorResponse("400", String.join("\n", ex.getErrors())));
return ResponseEntity.status(BAD_REQUEST).body(new ErrorResponse("400", String.join("\n", flattenErrorsList(ex.getErrors()))));
}

private List<String> flattenErrorsList(List<Object> errors) {
List<String> theseErrors = new ArrayList<>();
processErrorsList(theseErrors, errors);
return theseErrors;
}

private static void processErrorsList(List<String> outputErrorList, Object errors){
if(errors instanceof String){
outputErrorList.add((String)errors);
}
else if(errors instanceof List){
for(Object error2:(List)errors){
processErrorsList(outputErrorList, error2);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ public DigestMethod(String algorithm) {
@Nullable
@Override
public String getAlgorithm() {
return null;
return this.algorithm;
}

@Override
public void setAlgorithm(@Nullable String value) {

this.algorithm = value;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@
import javax.xml.namespace.QName;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;

@Entity
@EqualsAndHashCode(callSuper = true, exclude = {"storageAttributeMap"})
@EqualsAndHashCode(callSuper = true, onlyExplicitlyIncluded = true)
public class RequestInitiator extends AbstractElementExtensibleXMLObject implements org.opensaml.saml.ext.saml2mdreqinit.RequestInitiator {
@EqualsAndHashCode.Include
private String binding;
@Override
public String getBinding() {
Expand All @@ -27,6 +29,7 @@ public void setBinding(String binding) {
this.binding = binding;
}

@EqualsAndHashCode.Include
private String location;

@Override
Expand All @@ -39,6 +42,7 @@ public void setLocation(String location) {
this.location = location;
}

@EqualsAndHashCode.Include
private String responseLocation;

@Override
Expand All @@ -57,6 +61,11 @@ public void setResponseLocation(String location) {
@Transient
private AttributeMap attributeMap = new AttributeMap(this);

@EqualsAndHashCode.Include
private Set<Map.Entry<QName, String>> attributeMapEntrySet() {
return this.attributeMap.entrySet();
}

@PrePersist
void prePersist() {
this.storageAttributeMap = this.attributeMap;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package edu.internet2.tier.shibboleth.admin.ui.domain.frontend;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;

import javax.validation.constraints.NotNull;
Expand Down Expand Up @@ -38,10 +39,12 @@ public EntityDescriptorRepresentation(String id,
@NotNull
private String entityId;

private OrganizationRepresentation organization;
//TODO: review requirement
private OrganizationRepresentation organization = new OrganizationRepresentation();

private List<ContactRepresentation> contacts;

@JsonInclude(JsonInclude.Include.NON_EMPTY)
private MduiRepresentation mdui;

private ServiceProviderSsoDescriptorRepresentation serviceProviderSsoDescriptor;
Expand All @@ -58,8 +61,10 @@ public EntityDescriptorRepresentation(String id,

private LocalDateTime modifiedDate;

@JsonInclude(JsonInclude.Include.NON_EMPTY)
private Map<String, Object> relyingPartyOverrides;

@JsonInclude(JsonInclude.Include.NON_EMPTY)
private List<String> attributeRelease;

private int version;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
package edu.internet2.tier.shibboleth.admin.ui.domain.frontend;

import com.fasterxml.jackson.annotation.JsonInclude;

import java.io.Serializable;

public class OrganizationRepresentation implements Serializable {

private static final long serialVersionUID = 802722455433573538L;

@JsonInclude(JsonInclude.Include.NON_EMPTY)
private String name;

@JsonInclude(JsonInclude.Include.NON_EMPTY)
private String displayName;

@JsonInclude(JsonInclude.Include.NON_EMPTY)
private String url;

public String getName() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
@Getter
public class JsonSchemaValidationFailedException extends RuntimeException {

List<String> errors;
List errors;

JsonSchemaValidationFailedException(List<?> errors) {
this.errors = (List<String>) errors;
this.errors = errors;
}
}
Loading

0 comments on commit 1112662

Please sign in to comment.