Skip to content

Commit

Permalink
Merge branch 'master' into SHIBUI-1337
Browse files Browse the repository at this point in the history
  • Loading branch information
dima767 committed Jul 16, 2019
2 parents 33929b4 + 6c89c8b commit edec6bf
Show file tree
Hide file tree
Showing 82 changed files with 1,429 additions and 827 deletions.
6 changes: 6 additions & 0 deletions backend/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,12 @@ task generateSources {
xmlSecBuilders.ObjectProviders.ObjectProvider.BuilderClass.each {
processLine(it['@className'].toString(), 'src/main/templates/XMLSecBuilderTemplate.java')
}

new XmlSlurper().parse(file('src/main/resources/jpa-saml2-metadata-algorithm-config.xml')).with { builders ->
builders.ObjectProviders.ObjectProvider.BuilderClass.each {
processLine(it['@className'].toString(), 'src/main/templates/AlgorithmBuilderTemplate.java')
}
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,22 @@
import org.opensaml.core.xml.util.AttributeMap;

import javax.annotation.Nonnull;
import javax.persistence.ElementCollection;
import javax.persistence.MappedSuperclass;
import javax.persistence.PostLoad;
import javax.persistence.PrePersist;
import javax.persistence.Transient;
import javax.xml.namespace.QName;
import java.util.HashMap;
import java.util.Map;

@MappedSuperclass
@EqualsAndHashCode(callSuper = true, exclude={"unknownAttributes"})
@EqualsAndHashCode(callSuper = true, exclude={"storageAttributeMap"})
@Audited
public abstract class AbstractAttributeExtensibleXMLObject extends AbstractXMLObject implements AttributeExtensibleXMLObject {

private transient final AttributeMap unknownAttributes;
private transient final AttributeMap unknownAttributes = new AttributeMap(this);

AbstractAttributeExtensibleXMLObject() {
unknownAttributes = new AttributeMap(this);
}

@Nonnull
Expand All @@ -26,4 +30,17 @@ public abstract class AbstractAttributeExtensibleXMLObject extends AbstractXMLOb
public AttributeMap getUnknownAttributes() {
return this.unknownAttributes;
}
}

@ElementCollection
private Map<QName,String> storageAttributeMap = new HashMap<>();

@PrePersist
void prePersist() {
this.storageAttributeMap = this.unknownAttributes;
}

@PostLoad
void postLoad() {
this.unknownAttributes.putAll(this.storageAttributeMap);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package edu.internet2.tier.shibboleth.admin.ui.domain;

import lombok.EqualsAndHashCode;

import javax.annotation.Nullable;
import javax.persistence.Entity;

@Entity
@EqualsAndHashCode(callSuper = true)
public class DigestMethod extends AbstractElementExtensibleXMLObject implements org.opensaml.saml.ext.saml2alg.DigestMethod {
private String algorithm;

public DigestMethod() {}

public DigestMethod(String algorithm) {
this.algorithm = algorithm;
}

@Nullable
@Override
public String getAlgorithm() {
return null;
}

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

}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,20 @@
package edu.internet2.tier.shibboleth.admin.ui.domain;

import lombok.EqualsAndHashCode;
import org.opensaml.core.xml.util.AttributeMap;

import javax.annotation.Nonnull;
import javax.persistence.ElementCollection;
import javax.persistence.Entity;
import javax.persistence.PostLoad;
import javax.persistence.PrePersist;
import javax.persistence.Transient;
import javax.xml.namespace.QName;
import java.util.HashMap;
import java.util.Map;

@Entity
@EqualsAndHashCode(callSuper = true, exclude = {"storageAttributeMap"})
public class RequestInitiator extends AbstractElementExtensibleXMLObject implements org.opensaml.saml.ext.saml2mdreqinit.RequestInitiator {
private String binding;
@Override
Expand Down Expand Up @@ -40,10 +51,25 @@ public void setResponseLocation(String location) {
this.responseLocation = location;
}

@ElementCollection
private Map<QName,String> storageAttributeMap = new HashMap<>();

@Transient
private AttributeMap attributeMap = new AttributeMap(this);

@PrePersist
void prePersist() {
this.storageAttributeMap = this.attributeMap;
}

@PostLoad
void postLoad() {
this.attributeMap.putAll(this.storageAttributeMap);
}

@Nonnull
@Override
@Transient
public AttributeMap getUnknownAttributes() {
return this.attributeMap;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
package edu.internet2.tier.shibboleth.admin.ui.domain;

import lombok.EqualsAndHashCode;

import javax.annotation.Nullable;
import javax.persistence.Entity;

@Entity
@EqualsAndHashCode(callSuper = true)
public class SigningMethod extends AbstractElementExtensibleXMLObject implements org.opensaml.saml.ext.saml2alg.SigningMethod {
private String algorithm;
private Integer minKeySize;
private Integer maxKeySize;

public SigningMethod() {}

public SigningMethod(String algorithm, Integer minKeySize, Integer maxKeySize) {
this.algorithm = algorithm;
this.minKeySize = minKeySize;
this.maxKeySize = maxKeySize;
}

@Nullable
@Override
public String getAlgorithm() {
return this.algorithm;
}

@Override
public void setAlgorithm(@Nullable String value) {
this.algorithm = value;
}

@Nullable
@Override
public Integer getMinKeySize() {
return this.minKeySize;
}

@Override
public void setMinKeySize(@Nullable Integer value) {
this.minKeySize = value;
}

@Nullable
@Override
public Integer getMaxKeySize() {
return this.maxKeySize;
}

@Override
public void setMaxKeySize(@Nullable Integer value) {
this.maxKeySize = value;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ protected String[] getConfigResources() {
"/jpa-schema-config.xml",
"/jpa-saml2-metadata-ui-config.xml",
"/jpa-signature-config.xml",
"/jpa-saml2-metadata-algorithm-config.xml",
"/encryption-config.xml",
"/saml2-metadata-algorithm-config.xml",
"/jpa-saml2-metadata-reqinit-config.xml",
"/saml2-protocol-config.xml",
"/modified-saml2-assertion-config.xml"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,41 @@
{
"type": "object",
"required": [
"name",
"@type",
"xmlId",
"metadataURL",
"metadataRequestURLConstructionScheme"
],
"properties": {
"name": {
"title": "label.metadata-provider-name-dashboard-display-only",
"description": "tooltip.metadata-provider-name-dashboard-display-only",
"type": "string",
"widget": {
"id": "string",
"help": "message.must-be-unique"
}
},
"@type": {
"title": "label.metadata-provider-type",
"description": "tooltip.metadata-provider-type",
"placeholder": "label.select-metadata-type",
"type": "string",
"readOnly": true,
"widget": {
"id": "select",
"disabled": true
},
"oneOf": [
{
"enum": [
"DynamicHttpMetadataResolver"
],
"description": "value.dynamic-http-metadata-provider"
}
]
},
"enabled": {
"title": "label.enable-provider-upon-saving",
"description": "tooltip.enable-provider-upon-saving",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
],
"properties": {
"name": {
"title": "label.service-provider-name-dashboard-display-only",
"description": "tooltip.metadata-provider-name",
"title": "label.metadata-provider-name-dashboard-display-only",
"description": "tooltip.metadata-provider-name-dashboard-display-only",
"type": "string",
"widget": {
"id": "string",
Expand All @@ -29,7 +29,7 @@
"oneOf": [
{
"enum": [
"FileSystemMetadataResolver"
"FilesystemMetadataResolver"
],
"description": "value.file-system-metadata-provider"
}
Expand Down
5 changes: 3 additions & 2 deletions backend/src/main/resources/i18n/messages.properties
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ value.dynamic-http-metadata-provider=DynamicHttpMetadataProvider
value.entity-attributes-filter=EntityAttributes Filter
value.spdescriptor=SPSSODescriptor
value.attr-auth-descriptor=AttributeAuthorityDescriptor
value.dynamic-http-metadata-provider=DynamicHttpMetadataProvider
value.local-dynamic-metadata-provider=LocalDynamicMetadataProvider

value.md-query-protocol=MetadataQueryProtocol
Expand Down Expand Up @@ -393,6 +392,8 @@ label.title=Title
label.enabled=Enabled
label.author=Author
label.creation-date=Creation Date
label.order=Order
label.provider-type=Provider Type

label.metadata-resolver-history=Metadata resolver history
label.metadata-version-history=Metadata Version History
Expand All @@ -407,7 +408,7 @@ label.restore=Restore
label.compare-selected=Compare Selected

label.saved=Saved
label.by=by
label.by=By

message.delete-user-title=Delete User?
message.delete-user-body=You are requesting to delete a user. If you complete this process the user will be removed. This cannot be undone. Do you wish to continue?
Expand Down
34 changes: 34 additions & 0 deletions backend/src/main/resources/jpa-saml2-metadata-algorithm-config.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<XMLTooling xmlns="http://www.opensaml.org/xmltooling-config" xmlns:alg="urn:oasis:names:tc:SAML:metadata:algsupport" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opensaml.org/xmltooling-config ../../src/schema/xmltooling-config.xsd">

<!-- SAML v2.0 Metadata Profile for Algorithm Support Version 1.0 XMLObject providers -->
<ObjectProviders>

<!-- DigestMethod provider -->
<ObjectProvider qualifiedName="alg:DigestMethod">
<BuilderClass className="edu.internet2.tier.shibboleth.admin.ui.domain.DigestMethodBuilder"/>
<MarshallingClass className="org.opensaml.saml.ext.saml2alg.impl.DigestMethodMarshaller"/>
<UnmarshallingClass className="org.opensaml.saml.ext.saml2alg.impl.DigestMethodUnmarshaller"/>
</ObjectProvider>

<ObjectProvider qualifiedName="alg:DigestMethodType">
<BuilderClass className="edu.internet2.tier.shibboleth.admin.ui.domain.DigestMethodBuilder"/>
<MarshallingClass className="org.opensaml.saml.ext.saml2alg.impl.DigestMethodMarshaller"/>
<UnmarshallingClass className="org.opensaml.saml.ext.saml2alg.impl.DigestMethodUnmarshaller"/>
</ObjectProvider>

<!-- SigningMethod provider -->
<ObjectProvider qualifiedName="alg:SigningMethod">
<BuilderClass className="edu.internet2.tier.shibboleth.admin.ui.domain.SigningMethodBuilder"/>
<MarshallingClass className="org.opensaml.saml.ext.saml2alg.impl.SigningMethodMarshaller"/>
<UnmarshallingClass className="org.opensaml.saml.ext.saml2alg.impl.SigningMethodUnmarshaller"/>
</ObjectProvider>

<ObjectProvider qualifiedName="alg:SigningMethodType">
<BuilderClass className="edu.internet2.tier.shibboleth.admin.ui.domain.SigningMethodBuilder"/>
<MarshallingClass className="org.opensaml.saml.ext.saml2alg.impl.SigningMethodMarshaller"/>
<UnmarshallingClass className="org.opensaml.saml.ext.saml2alg.impl.SigningMethodUnmarshaller"/>
</ObjectProvider>

</ObjectProviders>
</XMLTooling>
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
],
"properties": {
"name": {
"title": "label.metadata-provider-name-display-only",
"description": "tooltip.metadata-provider-name-display-only",
"title": "label.metadata-provider-name-dashboard-display-only",
"description": "tooltip.metadata-provider-name-dashboard-display-only",
"type": "string",
"widget": {
"id": "string",
Expand All @@ -29,9 +29,9 @@
"oneOf": [
{
"enum": [
"FileSystemMetadataResolver"
"LocalDynamicMetadataResolver"
],
"description": "value.file-system-metadata-provider"
"description": "value.local-dynamic-metadata-provider"
}
]
},
Expand Down
22 changes: 22 additions & 0 deletions backend/src/main/templates/AlgorithmBuilderTemplate.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package edu.internet2.tier.shibboleth.admin.ui.domain;

import edu.internet2.tier.shibboleth.admin.ui.opensaml.xml.AbstractSAMLObjectBuilder;
import org.opensaml.saml.common.xml.SAMLConstants;

public class {{TOKEN}}Builder extends AbstractSAMLObjectBuilder<{{TOKEN}}> {
public {{TOKEN}}Builder() {
}

public {{TOKEN}} buildObject() {
return buildObject(SAMLConstants.SAML20ALG_NS, {{TOKEN}}.DEFAULT_ELEMENT_LOCAL_NAME,
SAMLConstants.SAML20ALG_PREFIX);
}

public {{TOKEN}} buildObject(final String namespaceURI, final String localName, final String namespacePrefix) {
{{TOKEN}} o = new {{TOKEN}}();
o.setNamespaceURI(namespaceURI);
o.setElementLocalName(localName);
o.setNamespacePrefix(namespacePrefix);
return o;
}
}
Loading

0 comments on commit edec6bf

Please sign in to comment.