[java-identity-provider] branch main updated: IDP-1866 - Module handling does not work when idpHome is classpath
Scott Cantor
cantor.2 at osu.edu
Tue Nov 2 21:58:41 UTC 2021
This is an automated email from the git hooks/post-receive script.
scantor pushed a commit to branch main
in repository java-identity-provider.
View the commit online:
http://git.shibboleth.net/view/?p=java-identity-provider.git;a=commit;h=33e363d9eebf2bac066dc9a2dbc36c460386487a
The following commit(s) were added to refs/heads/main by this push:
new 33e363d9e IDP-1866 - Module handling does not work when idpHome is classpath
33e363d9e is described below
commit 33e363d9eebf2bac066dc9a2dbc36c460386487a
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Tue Nov 2 17:58:34 2021 -0400
IDP-1866 - Module handling does not work when idpHome is classpath
https://shibboleth.atlassian.net/browse/IDP-1866
Support checking but not module enable/disable.
---
.../shibboleth/idp/module/AbstractIdPModule.java | 27 +++++++++++++++++++---
1 file changed, 24 insertions(+), 3 deletions(-)
diff --git a/idp-admin-api/src/main/java/net/shibboleth/idp/module/AbstractIdPModule.java b/idp-admin-api/src/main/java/net/shibboleth/idp/module/AbstractIdPModule.java
index fd7cc49c7..35a4e4e63 100644
--- a/idp-admin-api/src/main/java/net/shibboleth/idp/module/AbstractIdPModule.java
+++ b/idp-admin-api/src/main/java/net/shibboleth/idp/module/AbstractIdPModule.java
@@ -47,6 +47,8 @@ import org.apache.http.client.protocol.HttpClientContext;
import org.opensaml.security.httpclient.HttpClientSecuritySupport;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.springframework.core.io.ClassPathResource;
+import org.springframework.util.ResourceUtils;
import net.shibboleth.utilities.java.support.annotation.constraint.NonnullElements;
import net.shibboleth.utilities.java.support.annotation.constraint.NotEmpty;
@@ -109,9 +111,18 @@ public abstract class AbstractIdPModule implements IdPModule {
final Path resolved = moduleContext.getIdPHome().resolve(resource.getDestination());
log.debug("Module {}: resolved resource destination {}", getId(), resolved);
- if (!resolved.toFile().exists()) {
- log.debug("Module {}: resource destination {} missing, module is disabled", getId(), resolved);
- return false;
+ if (resolved.startsWith(ResourceUtils.CLASSPATH_URL_PREFIX)) {
+ final ClassPathResource cp = new ClassPathResource(
+ resolved.toString().substring(ResourceUtils.CLASSPATH_URL_PREFIX.length()));
+ if (!cp.exists()) {
+ log.debug("Module {}: resource destination {} missing, module is disabled", getId(), resolved);
+ return false;
+ }
+ } else {
+ if (!resolved.toFile().exists()) {
+ log.debug("Module {}: resource destination {} missing, module is disabled", getId(), resolved);
+ return false;
+ }
}
}
@@ -122,6 +133,11 @@ public abstract class AbstractIdPModule implements IdPModule {
/** {@inheritDoc} */
@Nonnull @NonnullElements public Map<ModuleResource, ResourceResult> enable(
@Nonnull final ModuleContext moduleContext) throws ModuleException {
+
+ if (moduleContext.getIdPHome().startsWith(ResourceUtils.CLASSPATH_URL_PREFIX)) {
+ throw new ModuleException("IdP location is a classpath");
+ }
+
if (isHttpClientRequired() && moduleContext.getHttpClient() == null) {
throw new ModuleException("HTTP client required but not available");
}
@@ -147,6 +163,11 @@ public abstract class AbstractIdPModule implements IdPModule {
/** {@inheritDoc} */
@Nonnull @NonnullElements public Map<ModuleResource, ResourceResult> disable(
@Nonnull final ModuleContext moduleContext, final boolean clean) throws ModuleException {
+
+ if (moduleContext.getIdPHome().startsWith(ResourceUtils.CLASSPATH_URL_PREFIX)) {
+ throw new ModuleException("IdP location is a classpath");
+ }
+
log.debug("Module {} disabling", getId());
final Map<ModuleResource,ResourceResult> results;
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list