-
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.
Merged in SHIBUI-723 (pull request #158)
SHIBUI-723 Approved-by: Shibui Jenkins <shibui.jenkins@gmail.com>
- Loading branch information
Showing
23 changed files
with
639 additions
and
98 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
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
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
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
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
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
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
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
68 changes: 68 additions & 0 deletions
68
...shibboleth/admin/ui/domain/resolvers/opensaml/OpenSamlFileBackedHTTPMetadataResolver.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,68 @@ | ||
| package edu.internet2.tier.shibboleth.admin.ui.domain.resolvers.opensaml; | ||
|
|
||
| import edu.internet2.tier.shibboleth.admin.ui.domain.resolvers.FileBackedHttpMetadataResolver; | ||
| import net.shibboleth.utilities.java.support.component.ComponentInitializationException; | ||
| import net.shibboleth.utilities.java.support.resolver.ResolverException; | ||
| import org.apache.http.HttpResponse; | ||
| import org.apache.http.impl.client.HttpClients; | ||
| import org.apache.lucene.index.IndexWriter; | ||
| import org.joda.time.DateTime; | ||
| import org.opensaml.saml.metadata.resolver.impl.FileBackedHTTPMetadataResolver; | ||
|
|
||
| import javax.annotation.Nullable; | ||
|
|
||
| import static edu.internet2.tier.shibboleth.admin.util.DurationUtility.toMillis; | ||
|
|
||
| /** | ||
| * @author Bill Smith (wsmith@unicon.net) | ||
| */ | ||
| public class OpenSamlFileBackedHTTPMetadataResolver extends FileBackedHTTPMetadataResolver { | ||
| private IndexWriter indexWriter; | ||
| private FileBackedHttpMetadataResolver sourceResolver; | ||
|
|
||
| private OpenSamlMetadataResolverDelegate delegate; | ||
|
|
||
| public OpenSamlFileBackedHTTPMetadataResolver(IndexWriter indexWriter, | ||
| FileBackedHttpMetadataResolver sourceResolver) throws ResolverException { | ||
| super(HttpClients.createMinimal(), sourceResolver.getMetadataURL(), sourceResolver.getBackingFile()); | ||
| this.indexWriter = indexWriter; | ||
| this.sourceResolver = sourceResolver; | ||
| this.delegate = new OpenSamlMetadataResolverDelegate(); | ||
|
|
||
| this.setId(sourceResolver.getResourceId()); | ||
|
|
||
| OpenSamlMetadataResolverConstructorHelper.updateOpenSamlMetadataResolverFromHttpMetadataResolverAttributes( | ||
| this, sourceResolver.getHttpMetadataResolverAttributes()); | ||
| OpenSamlMetadataResolverConstructorHelper.updateOpenSamlMetadataResolverFromReloadableMetadataResolverAttributes( | ||
| this, sourceResolver.getReloadableMetadataResolverAttributes()); | ||
|
|
||
| this.setBackupFile(sourceResolver.getBackingFile()); | ||
| this.setBackupFileInitNextRefreshDelay(toMillis(sourceResolver.getBackupFileInitNextRefreshDelay())); | ||
| this.setInitializeFromBackupFile(sourceResolver.getInitializeFromBackupFile()); | ||
|
|
||
| //TODO: Where does this get set in OpenSAML land? | ||
| // sourceResolver.getMetadataURL(); | ||
| } | ||
|
|
||
| // TODO: this is still probably not the best way to do this? | ||
| @Nullable | ||
| @Override | ||
| public DateTime getLastRefresh() { | ||
| return null; | ||
| } | ||
|
|
||
| // TODO: this is still probably not the best way to do this? | ||
| @Override | ||
| protected void processConditionalRetrievalHeaders(HttpResponse response) { | ||
| // let's do nothing 'cause we want to allow a refresh | ||
| } | ||
|
|
||
| @Override | ||
| protected void initMetadataResolver() throws ComponentInitializationException { | ||
| super.initMetadataResolver(); | ||
|
|
||
| delegate.addIndexedDescriptorsFromBackingStore(this.getBackingStore(), | ||
| this.sourceResolver.getResourceId(), | ||
| indexWriter); | ||
| } | ||
| } |
49 changes: 49 additions & 0 deletions
49
...ier/shibboleth/admin/ui/domain/resolvers/opensaml/OpenSamlFilesystemMetadataResolver.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,49 @@ | ||
| package edu.internet2.tier.shibboleth.admin.ui.domain.resolvers.opensaml; | ||
|
|
||
| import net.shibboleth.utilities.java.support.component.ComponentInitializationException; | ||
| import net.shibboleth.utilities.java.support.resolver.ResolverException; | ||
| import org.apache.lucene.index.IndexWriter; | ||
| import org.joda.time.DateTime; | ||
| import org.opensaml.saml.metadata.resolver.impl.FilesystemMetadataResolver; | ||
|
|
||
| import javax.annotation.Nullable; | ||
| import java.io.File; | ||
|
|
||
| /** | ||
| * @author Bill Smith (wsmith@unicon.net) | ||
| */ | ||
| public class OpenSamlFilesystemMetadataResolver extends FilesystemMetadataResolver { | ||
| private IndexWriter indexWriter; | ||
| private edu.internet2.tier.shibboleth.admin.ui.domain.resolvers.FilesystemMetadataResolver sourceResolver; | ||
| private OpenSamlMetadataResolverDelegate delegate; | ||
|
|
||
| public OpenSamlFilesystemMetadataResolver(File metadataFile, | ||
| IndexWriter indexWriter, | ||
| edu.internet2.tier.shibboleth.admin.ui.domain.resolvers.FilesystemMetadataResolver sourceResolver) throws ResolverException { | ||
| super(metadataFile); | ||
| this.indexWriter = indexWriter; | ||
| this.sourceResolver = sourceResolver; | ||
| this.delegate = new OpenSamlMetadataResolverDelegate(); | ||
|
|
||
| this.setId(sourceResolver.getResourceId()); | ||
|
|
||
| OpenSamlMetadataResolverConstructorHelper.updateOpenSamlMetadataResolverFromReloadableMetadataResolverAttributes( | ||
| this, sourceResolver.getReloadableMetadataResolverAttributes()); | ||
| } | ||
|
|
||
| // TODO: this is still probably not the best way to do this? | ||
| @Nullable | ||
| @Override | ||
| public DateTime getLastRefresh() { | ||
| return null; | ||
| } | ||
|
|
||
| @Override | ||
| protected void initMetadataResolver() throws ComponentInitializationException { | ||
| super.initMetadataResolver(); | ||
|
|
||
| delegate.addIndexedDescriptorsFromBackingStore(this.getBackingStore(), | ||
| this.sourceResolver.getResourceId(), | ||
| indexWriter); | ||
| } | ||
| } |
Oops, something went wrong.