Skip to content

Commit

Permalink
SHIBUI-2380
Browse files Browse the repository at this point in the history
Incremental commit:
- Adding Oauth/OIDC binding type to the AssertionConsumerService list
- Updating how the SPSSODESCRIPTOR identifies OIDC protocol
  • Loading branch information
chasegawa committed Sep 20, 2022
1 parent e63841d commit 7afc474
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package edu.internet2.tier.shibboleth.admin.ui.domain;

import edu.internet2.tier.shibboleth.admin.ui.domain.oidc.OAuthRPExtensions;
import lombok.EqualsAndHashCode;
import org.hibernate.envers.Audited;
import org.opensaml.core.xml.XMLObject;
Expand Down Expand Up @@ -76,6 +77,10 @@ public void setID(String id) {

@Override
public List<String> getSupportedProtocols() {
// This protocol must be included if this is OIDC data
if (isOidcType() && !supportedProtocols.contains("http://openid.net/specs/openid-connect-core-1_0.html")) {
supportedProtocols.add("http://openid.net/specs/openid-connect-core-1_0.html");
}
return supportedProtocols;
}

Expand Down Expand Up @@ -195,4 +200,16 @@ public List<XMLObject> getOrderedChildren() {

return Collections.unmodifiableList(children);
}
}

@Transient
public boolean isOidcType() {
if (getExtensions().getOrderedChildren().size() > 0) {
for (XMLObject e : getExtensions().getOrderedChildren()) {
if (e.getElementQName().getLocalPart().equals(OAuthRPExtensions.TYPE_LOCAL_NAME)) {
return true;
}
}
}
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -177,14 +177,7 @@ public EntityDescriptorRepresentation createNewEntityDescriptorFromXMLOrigin(Ent
}

private EntityDescriptorProtocol determineEntityDescriptorProtocol(EntityDescriptor ed) {
boolean oidcType = false;
if (ed.getSPSSODescriptor("") != null && ed.getSPSSODescriptor("").getExtensions().getOrderedChildren().size() > 0) {
for (XMLObject e : ed.getSPSSODescriptor("").getExtensions().getOrderedChildren()) {
if (e.getElementQName().getLocalPart().equals(OAuthRPExtensions.TYPE_LOCAL_NAME)) {
oidcType = true;
}
}
}
boolean oidcType = ed.getSPSSODescriptor("") != null && ed.getSPSSODescriptor("").isOidcType();
return oidcType ? EntityDescriptorProtocol.OIDC : EntityDescriptorProtocol.SAML;
}

Expand Down Expand Up @@ -462,6 +455,7 @@ public EntityDescriptor getEntityDescriptorByResourceId(String resourceId) throw
if (!userService.isAuthorizedFor(ed)) {
throw new ForbiddenException();
}

return ed;
}

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 @@ -329,6 +329,12 @@
"urn:oasis:names:tc:SAML:1.0:profiles:artifact-01"
],
"description": "urn:oasis:names:tc:SAML:1.0:profiles:artifact-01"
},
{
"enum": [
"https://tools.ietf.org/html/rfc6749#section-3.1.2"
],
"description": "OIDC / OAUTH Binding"
}
]
},
Expand Down

0 comments on commit 7afc474

Please sign in to comment.