Skip to content

Commit

Permalink
SHIBUI-2380/2410
Browse files Browse the repository at this point in the history
Fixing copy issues
  • Loading branch information
chasegawa committed Oct 4, 2022
1 parent 86012a7 commit 904c611
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ private EntityDescriptor buildDescriptorFromRepresentation(final EntityDescripto
setupLogout(ed, representation);
setupRelyingPartyOverrides(ed, representation);

if (ed.getProtocol() == EntityDescriptorProtocol.OIDC) {
if (ed.getProtocol() == EntityDescriptorProtocol.OIDC && ed.getSPSSODescriptor("") != null) {
ed.getSPSSODescriptor("").addSupportedProtocol("http://openid.net/specs/openid-connect-core-1_0.html");
}
//Let envers recognize update revision type for EntityDescriptor type
Expand All @@ -114,6 +114,9 @@ private EntityDescriptor buildDescriptorFromRepresentation(final EntityDescripto
*/
private Map<String, Object> buildOAuthRPExtensionsMap(EntityDescriptor ed) {
HashMap<String, Object> result = new HashMap<>();
if (!ed.getSPSSODescriptor("").getOptionalExtensions().isPresent()) {
return result;
}
for(XMLObject extension : ed.getSPSSODescriptor("").getExtensions().getOrderedChildren()) {
if (extension.getElementQName().getLocalPart().equals(OAuthRPExtensions.TYPE_LOCAL_NAME)){
OAuthRPExtensions oAuthRPExtensions = (OAuthRPExtensions) extension;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ public static void setupSPSSODescriptor(EntityDescriptor ed, EntityDescriptorRep
SPSSODescriptor spssoDescriptor = getSPSSODescriptorFromEntityDescriptor(ed);

spssoDescriptor.setSupportedProtocols(new ArrayList<>());
if (!Strings.isNullOrEmpty(representation.getServiceProviderSsoDescriptor().getProtocolSupportEnum())) {
if (representation.getServiceProviderSsoDescriptor() != null && !Strings.isNullOrEmpty(representation.getServiceProviderSsoDescriptor().getProtocolSupportEnum())) {
spssoDescriptor.setSupportedProtocols(
Arrays.stream(representation.getServiceProviderSsoDescriptor().getProtocolSupportEnum().split(",")).map(p -> MDDCConstants.PROTOCOL_BINDINGS.get(p.trim())).collect(Collectors.toList())
);
Expand All @@ -347,7 +347,7 @@ public static void setupSPSSODescriptor(EntityDescriptor ed, EntityDescriptorRep
}

// Setup Extensions
if (representation.getProtocol() == EntityDescriptorProtocol.OIDC) {
if (representation.getProtocol() == EntityDescriptorProtocol.OIDC && representation.getServiceProviderSsoDescriptor(false) != null) {
spssoDescriptor.setExtensions(buildOAuthRPExtensionsFromRepresentation(representation.getServiceProviderSsoDescriptor(false)));
}
} else {
Expand Down

0 comments on commit 904c611

Please sign in to comment.