Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
jj committed Apr 21, 2021
2 parents e0faf47 + cae95af commit a512c8e
Show file tree
Hide file tree
Showing 108 changed files with 1,497 additions and 615 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -400,3 +400,9 @@ rdurable
build-no-tests

beacon/spring/out

# Eclipse junk
*.classpath
*.settings
*.project
*bin
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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@
"title": "label.match",
"description": "tooltip.match",
"type": "string",
"widget": {
"id": "string",
"required": true
},
"visibleIf": {
"@type": [
"Regex"
Expand Down
1 change: 1 addition & 0 deletions backend/src/main/resources/i18n/messages.properties
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,7 @@ message.protocol-support-required=Protocol Support Enumeration is required if an
message.conflict=Conflict
message.data-version-contention=Data Version Contention
message.contention-new-version=A newer version of this metadata source has been saved. Below are a list of changes. You can use your changes or their changes.
message.contention-error=There was a problem saving due to a mismatched version.
message.organization-feedback=These three fields must all be entered if any single field has a value.
message.valid-email=Must be a valid Email Address
message.valid-url=Must be a valid URL
Expand Down
6 changes: 6 additions & 0 deletions backend/src/main/resources/metadata-sources-ui-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,12 @@
"urn:oasis:names:tc:SAML:2.0:bindings:SOAP"
],
"description": "urn:oasis:names:tc:SAML:2.0:bindings:SOAP"
},
{
"enum": [
"urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Artifact"
],
"description": "urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Artifact"
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class EntitiesControllerIntegrationTests extends Specification {
this.webClient.webClient.uriBuilderFactory.encodingMode = DefaultUriBuilderFactory.EncodingMode.NONE
}*/

//todo review
def "GET /api/entities returns the proper json"() {
given:
def expectedBody = '''
Expand All @@ -54,7 +55,6 @@ class EntitiesControllerIntegrationTests extends Specification {
{"locationUrl":"https://test.scaldingspoon.org/test1/acs","binding":"urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST","makeDefault":false}
],
"serviceEnabled":false,
"relyingPartyOverrides":{},
"attributeRelease":["givenName","employeeNumber"]
}
'''
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,16 +72,16 @@ class EntitiesControllerTests extends Specification {
result.andExpect(status().isNotFound())
}

//todo review
def 'GET /api/entities/http%3A%2F%2Ftest.scaldingspoon.org%2Ftest1'() {
given:
def expectedBody = '''
{
"id":null,
"serviceProviderName":null,
"entityId":"http://test.scaldingspoon.org/test1",
"organization":null,
"organization": {},
"contacts":null,
"mdui":null,
"serviceProviderSsoDescriptor": {
"protocolSupportEnum":"SAML 2",
"nameIdFormats":["urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified"]
Expand All @@ -94,8 +94,10 @@ class EntitiesControllerTests extends Specification {
"serviceEnabled":false,
"createdDate":null,
"modifiedDate":null,
"relyingPartyOverrides":{},
"attributeRelease":["givenName","employeeNumber"]
"attributeRelease":["givenName","employeeNumber"],
"version":-1891841119,
"createdBy":null,
"current":false
}
'''
when:
Expand Down
Loading

0 comments on commit a512c8e

Please sign in to comment.