Skip to content

Commit

Permalink
[SHIBUI-1237]
Browse files Browse the repository at this point in the history
fix conversion
add test
  • Loading branch information
jj committed Feb 21, 2019
1 parent 5c4465b commit ec8cc06
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -652,7 +652,7 @@ public EntityDescriptorRepresentation createRepresentationFromDescriptor(org.ope
}
if (overrideProperty.getPersistType() != null &&
!overrideProperty.getPersistType().equals(overrideProperty.getDisplayType())) {
attributeValues = getValueFromXMLObject(jpaAttribute.getAttributeValues().get(0));
attributeValues = overrideProperty.getPersistValue().equals(getValueFromXMLObject(jpaAttribute.getAttributeValues().get(0)));
} else {
attributeValues = Boolean.valueOf(((XSBoolean) jpaAttribute.getAttributeValues()
.get(0)).getStoredValue());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import edu.internet2.tier.shibboleth.admin.ui.ShibbolethUiApplication
import edu.internet2.tier.shibboleth.admin.ui.configuration.CoreShibUiConfiguration
import edu.internet2.tier.shibboleth.admin.ui.configuration.CustomPropertiesConfiguration
import edu.internet2.tier.shibboleth.admin.ui.domain.EntityDescriptor
import edu.internet2.tier.shibboleth.admin.ui.domain.SPSSODescriptor
import edu.internet2.tier.shibboleth.admin.ui.domain.XSAny
import edu.internet2.tier.shibboleth.admin.ui.domain.XSAnyBuilder
import edu.internet2.tier.shibboleth.admin.ui.domain.XSBoolean
Expand Down Expand Up @@ -54,7 +55,7 @@ class JPAEntityDescriptorServiceImplTests extends Specification {
it
}

def service
JPAEntityDescriptorServiceImpl service

JacksonTester<EntityDescriptorRepresentation> jacksonTester

Expand Down Expand Up @@ -857,6 +858,28 @@ class JPAEntityDescriptorServiceImplTests extends Specification {
thrown RuntimeException
}

def "SHIBUI-1237"() {
given:
// this is very inefficient, but it might work
def inputRepresentation = new EntityDescriptorRepresentation().with {
it.id = 'test'
it.entityId = 'test'
it.relyingPartyOverrides = [
'useSha': true,
'ignoreAuthenticationMethod': true
]
it
}

when:
def entityDescriptor = service.createDescriptorFromRepresentation(inputRepresentation)
def representation = service.createRepresentationFromDescriptor(entityDescriptor)

then:
assert representation.relyingPartyOverrides.get('useSha') instanceof Boolean
assert representation.relyingPartyOverrides.get('ignoreAuthenticationMethod') instanceof Boolean
}

EntityDescriptor generateRandomEntityDescriptor() {
EntityDescriptor ed = new EntityDescriptor()

Expand Down

0 comments on commit ec8cc06

Please sign in to comment.