[java-plugin-shibd] branch main updated: JSHIBDSAML-8 - SP self-entityID resolver for Artifact resolution

Codeberg noreply at shibboleth.net
Thu Oct 8 17:31:09 UTC 2026


This is an automated email from the git hooks/post-receive script.

codeberg pushed a commit to branch main
in repository java-plugin-shibd.

View the commit online:
https://codeberg.org/Shibboleth/java-plugin-shibd/commit/d8fe9f23f01952b4739bb3754f3d4e4d095c306a

The following commit(s) were added to refs/heads/main by this push:
     new d8fe9f2  JSHIBDSAML-8 - SP self-entityID resolver for Artifact resolution
d8fe9f2 is described below

commit d8fe9f23f01952b4739bb3754f3d4e4d095c306a
Author: Scott Cantor <scott at restingparrotsoftware.com>
AuthorDate: Thu Oct 8 13:30:53 2026 -0400

    JSHIBDSAML-8 - SP self-entityID resolver for Artifact resolution
    
    https://shibboleth.atlassian.net/browse/JSHIBDSAML-8
    
    Bridge IdP class back to Application as
    RelyingPartyConfigurationResolver.
---
 .../sp/service/impl/ActiveApplicationSupplier.java |  65 +++++++++++++
 .../impl/SupplierBackedReloadableService.java      | 105 +++++++++++++++++++++
 .../shibboleth/sp/service/impl/package-info.java   |  18 ++++
 3 files changed, 188 insertions(+)

diff --git a/sp-server-impl/src/main/java/net/shibboleth/sp/service/impl/ActiveApplicationSupplier.java b/sp-server-impl/src/main/java/net/shibboleth/sp/service/impl/ActiveApplicationSupplier.java
new file mode 100644
index 0000000..eb50318
--- /dev/null
+++ b/sp-server-impl/src/main/java/net/shibboleth/sp/service/impl/ActiveApplicationSupplier.java
@@ -0,0 +1,65 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package net.shibboleth.sp.service.impl;
+
+import java.util.function.Supplier;
+
+import javax.annotation.Nullable;
+
+import org.opensaml.profile.context.ProfileRequestContext;
+
+import jakarta.servlet.http.HttpServletRequest;
+import net.shibboleth.sp.Application;
+import net.shibboleth.sp.context.AgentRequestContext;
+
+/**
+ * Suoplies the active {@link Application} for components without access
+ * to the {@link ProfileRequestContext}.
+ */
+public class ActiveApplicationSupplier implements Supplier<Application> {
+
+    /** Source of servlet request. */
+    @Nullable private Supplier<HttpServletRequest> httpServletRequestSupplier;
+    
+    /**
+     * Sets the supplier of the {@link HttpServletRequest}, from which the {@link ProfileRequestContext}
+     * will be obtained.
+     * 
+     * @param supplier the supplier
+     */
+    public void setHttpServletRequestSupplier(@Nullable final Supplier<HttpServletRequest> supplier) {
+        httpServletRequestSupplier = supplier;
+    }
+    
+    /** {@inheritDoc} */
+    @Nullable public Application get() {
+        
+        if (httpServletRequestSupplier != null) {
+            final HttpServletRequest request = httpServletRequestSupplier.get();
+            if (request != null) {
+                final Object obj = request.getAttribute(ProfileRequestContext.BINDING_KEY);
+                if (obj instanceof ProfileRequestContext prc) {
+                    final AgentRequestContext arc = prc.getSubcontext(AgentRequestContext.class);
+                    if (arc != null) {
+                        return arc.getApplication();
+                    }
+                }
+            }
+        }
+        
+        return null;
+    }
+
+}
\ No newline at end of file
diff --git a/sp-server-impl/src/main/java/net/shibboleth/sp/service/impl/SupplierBackedReloadableService.java b/sp-server-impl/src/main/java/net/shibboleth/sp/service/impl/SupplierBackedReloadableService.java
new file mode 100644
index 0000000..3622d28
--- /dev/null
+++ b/sp-server-impl/src/main/java/net/shibboleth/sp/service/impl/SupplierBackedReloadableService.java
@@ -0,0 +1,105 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package net.shibboleth.sp.service.impl;
+
+import java.time.Instant;
+import java.util.function.Supplier;
+
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
+import net.shibboleth.shared.component.AbstractInitializableComponent;
+import net.shibboleth.shared.logic.Constraint;
+import net.shibboleth.shared.service.ReloadableService;
+import net.shibboleth.shared.service.ServiceException;
+import net.shibboleth.shared.service.ServiceableComponent;
+
+/**
+ * A "null" implementation of {@link ReloadableService} that obtains an instance of an
+ * object via a strategy and exposes it as though it were a component wrapped
+ * by a service by nulling the relevant methods and interfaces.
+ * 
+ * @param <T> component type 
+ */
+public class SupplierBackedReloadableService<T> extends AbstractInitializableComponent implements ReloadableService<T> {
+
+    /**
+     * The supplier of the component to expose.
+     */
+    @Nonnull private Supplier<T> componentSource;
+    
+    /**
+     * Constructor.
+     *
+     * @param supplier source of component called when the component is requested
+     */
+    public SupplierBackedReloadableService(@Nonnull final Supplier<T> supplier) {
+        componentSource = Constraint.isNotNull(supplier, "Supplier cannot be null");
+    }
+    
+    /** {@inheritDoc} */
+    @Nullable public Instant getLastSuccessfulReloadInstant() {
+        return null;
+    }
+
+    /** {@inheritDoc} */
+    @Nullable public Instant getLastReloadAttemptInstant() {
+        return null;
+    }
+
+    /** {@inheritDoc} */
+    @Nullable public Throwable getReloadFailureCause() {
+        return null;
+    }
+
+    /** {@inheritDoc} */
+    public void reload() {
+    }
+
+    /** {@inheritDoc} */
+    @Nonnull public ServiceableComponent<T> getServiceableComponent() throws ServiceException {
+        final T component = componentSource.get();
+        if (component != null) {
+            return new ServiceableWrapper<>(component);
+        }
+        throw new ServiceException();
+    }
+
+    /**
+     * Dummy wrapper.
+     *
+     * @param <U> component type
+     */
+    private class ServiceableWrapper<U> implements ServiceableComponent<U> {
+
+        /** Wrapped component. */
+        @Nonnull private U component;
+        
+        public ServiceableWrapper(@Nonnull final U comp) {
+            component = Constraint.isNotNull(comp, "Componnent cannot be null");
+        }
+        
+        /** {@inheritDoc} */
+        @Nonnull public U getComponent() {
+            return component;
+        }
+
+        /** {@inheritDoc} */
+        public void close() {
+        }
+        
+    }
+    
+}
\ No newline at end of file
diff --git a/sp-server-impl/src/main/java/net/shibboleth/sp/service/impl/package-info.java b/sp-server-impl/src/main/java/net/shibboleth/sp/service/impl/package-info.java
new file mode 100644
index 0000000..6aaed9f
--- /dev/null
+++ b/sp-server-impl/src/main/java/net/shibboleth/sp/service/impl/package-info.java
@@ -0,0 +1,18 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Supporting code for SP use of services, some to be moved over later.
+ */
+package net.shibboleth.sp.service.impl;
\ No newline at end of file

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list