Skip to content

Commit

Permalink
SHIBUI-2380
Browse files Browse the repository at this point in the history
Changes per code review
  • Loading branch information
chasegawa committed Oct 26, 2022
1 parent 2e8f4e6 commit d69bce9
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,6 @@ public void setVersionModifiedTimestamp(Long versionModifiedTimestamp) {
public String toString() {
return MoreObjects.toStringHelper(this)
.add("entityID", entityID)
// .add("organization", organization)
.add("id", id)
.toString();
}
Expand All @@ -320,4 +319,27 @@ public OwnableType getOwnableType() {
@Override public ActivatableType getActivatableType() {
return ENTITY_DESCRIPTOR;
}

@JsonIgnore
public boolean wantsAssertionsSigned() {
SPSSODescriptor spssoDescriptor = getSPSSODescriptor("");
return spssoDescriptor != null && spssoDescriptor.getWantAssertionsSigned() != null && spssoDescriptor.getWantAssertionsSigned();
}

@JsonIgnore
public boolean isAuthnRequestsSigned() {
SPSSODescriptor spssoDescriptor = getSPSSODescriptor("");
return spssoDescriptor != null && spssoDescriptor.isAuthnRequestsSigned() != null && spssoDescriptor.isAuthnRequestsSigned();
}

@JsonIgnore
public boolean isOidcProtocol() {
return getSPSSODescriptor("") != null && getProtocol() == EntityDescriptorProtocol.OIDC;
}

@JsonIgnore
public boolean hasKeyDescriptors() {
SPSSODescriptor spssoDescriptor = getSPSSODescriptor("");
return spssoDescriptor != null && spssoDescriptor.getKeyDescriptors().size() > 0;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ public EntityDescriptorRepresentation createRepresentationFromDescriptor(org.ope
);
}

if (ed.getSPSSODescriptor("") != null && ed.getProtocol() == EntityDescriptorProtocol.OIDC) {
if (ed.isOidcProtocol()) {
ServiceProviderSsoDescriptorRepresentation serviceProviderSsoDescriptorRepresentation = representation.getServiceProviderSsoDescriptor(true);
serviceProviderSsoDescriptorRepresentation.addExtensions("OAuthRPExtensions", buildOAuthRPExtensionsMap(ed));
}
Expand Down Expand Up @@ -480,14 +480,14 @@ public Map<String, Object> getRelyingPartyOverridesRepresentationFromAttributeLi

private void setupSecurityRepresentationFromEntityDescriptor(EntityDescriptor ed, EntityDescriptorRepresentation representation) {
SecurityInfoRepresentation securityInfoRepresentation = representation.getSecurityInfo();
if (ed.getSPSSODescriptor("") != null && ed.getSPSSODescriptor("").getWantAssertionsSigned() != null && ed.getSPSSODescriptor("").getWantAssertionsSigned()) {
if (ed.wantsAssertionsSigned()) {
if (securityInfoRepresentation == null) {
securityInfoRepresentation = new SecurityInfoRepresentation();
representation.setSecurityInfo(securityInfoRepresentation);
}
securityInfoRepresentation.setWantAssertionsSigned(true);
}
if (ed.getSPSSODescriptor("") != null && ed.getSPSSODescriptor("").isAuthnRequestsSigned() != null && ed.getSPSSODescriptor("").isAuthnRequestsSigned()) {
if (ed.isAuthnRequestsSigned()) {
if (securityInfoRepresentation == null) {
securityInfoRepresentation = new SecurityInfoRepresentation();
representation.setSecurityInfo(securityInfoRepresentation);
Expand All @@ -496,7 +496,7 @@ private void setupSecurityRepresentationFromEntityDescriptor(EntityDescriptor ed
}

// If the EntityDescriptor has key descriptors - parse them out.
if (ed.getSPSSODescriptor("") != null && ed.getSPSSODescriptor("").getKeyDescriptors().size() > 0) {
if (ed.hasKeyDescriptors()) {
if (securityInfoRepresentation == null) {
securityInfoRepresentation = new SecurityInfoRepresentation();
representation.setSecurityInfo(securityInfoRepresentation);
Expand Down

0 comments on commit d69bce9

Please sign in to comment.