-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extended ChainingMetadataResolver and swapped it in for the original. It now includes a mutable collection of resolvers.
- Loading branch information
Bill Smith
committed
Aug 23, 2018
1 parent
77b208b
commit a2fe5b4
Showing
3 changed files
with
64 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
.../tier/shibboleth/admin/ui/domain/resolvers/opensaml/OpenSamlChainingMetadataResolver.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
package edu.internet2.tier.shibboleth.admin.ui.domain.resolvers.opensaml; | ||
|
||
import com.google.common.base.Predicates; | ||
import com.google.common.collect.Collections2; | ||
import net.shibboleth.utilities.java.support.annotation.constraint.NonnullElements; | ||
import net.shibboleth.utilities.java.support.component.ComponentInitializationException; | ||
import net.shibboleth.utilities.java.support.resolver.ResolverException; | ||
import org.opensaml.saml.metadata.resolver.ChainingMetadataResolver; | ||
import org.opensaml.saml.metadata.resolver.MetadataResolver; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
import javax.annotation.Nonnull; | ||
import java.util.ArrayList; | ||
import java.util.Collections; | ||
import java.util.List; | ||
|
||
/** | ||
* @author Bill Smith (wsmith@unicon.net) | ||
*/ | ||
public class OpenSamlChainingMetadataResolver extends ChainingMetadataResolver { | ||
@Nonnull private final Logger log = LoggerFactory.getLogger(OpenSamlChainingMetadataResolver.class); | ||
|
||
@Nonnull @NonnullElements private List<MetadataResolver> mutableResolvers; | ||
|
||
public OpenSamlChainingMetadataResolver() { | ||
this.mutableResolvers = Collections.emptyList(); | ||
} | ||
|
||
public OpenSamlChainingMetadataResolver(@Nonnull List<MetadataResolver> mutableResolvers) { | ||
this.mutableResolvers = mutableResolvers; | ||
} | ||
|
||
@Override | ||
public void setResolvers(@Nonnull @NonnullElements final List<? extends MetadataResolver> newResolvers) | ||
throws ResolverException { | ||
if (newResolvers == null || newResolvers.isEmpty()) { | ||
mutableResolvers = Collections.emptyList(); | ||
return; | ||
} | ||
|
||
mutableResolvers = new ArrayList<>(Collections2.filter(newResolvers, Predicates.notNull())); | ||
} | ||
|
||
@Nonnull | ||
@NonnullElements | ||
@Override | ||
public List<MetadataResolver> getResolvers() { | ||
return mutableResolvers; | ||
} | ||
|
||
@Override | ||
protected void doInitialize() throws ComponentInitializationException { | ||
super.doInitialize(); | ||
if (mutableResolvers == null) { | ||
log.warn("OpenSamlChainingMetadataResolver was not configured with any member MetadataResolvers"); | ||
mutableResolvers = Collections.emptyList(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters