[java-shib-profile] 01/02: Move delegating RelyingPartyConfig class into profile library from SP.
Codeberg
noreply at shibboleth.net
Tue Nov 17 16:19:15 UTC 2026
This is an automated email from the git hooks/post-receive script.
codeberg pushed a commit to branch main
in repository java-shib-profile.
View the commit online:
https://codeberg.org/Shibboleth/java-shib-profile/commit/c583a367f83d017c833c619d2ca200f7dec3a7a3
commit c583a367f83d017c833c619d2ca200f7dec3a7a3
Author: Scott Cantor <scott at restingparrotsoftware.com>
AuthorDate: Tue Nov 17 11:15:48 2026 -0500
Move delegating RelyingPartyConfig class into profile library from SP.
---
.../DelegatingRelyingPartyConfiguration.java | 126 +++++++++++++++++++++
1 file changed, 126 insertions(+)
diff --git a/shib-profile-api/src/main/java/net/shibboleth/profile/relyingparty/DelegatingRelyingPartyConfiguration.java b/shib-profile-api/src/main/java/net/shibboleth/profile/relyingparty/DelegatingRelyingPartyConfiguration.java
new file mode 100644
index 0000000..41fcb81
--- /dev/null
+++ b/shib-profile-api/src/main/java/net/shibboleth/profile/relyingparty/DelegatingRelyingPartyConfiguration.java
@@ -0,0 +1,126 @@
+/*
+ * 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.profile.relyingparty;
+
+import java.util.Map;
+import java.util.function.Predicate;
+
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
+import org.opensaml.profile.context.ProfileRequestContext;
+import org.opensaml.security.config.SecurityConfiguration;
+
+import net.shibboleth.profile.config.ProfileConfiguration;
+import net.shibboleth.shared.annotation.constraint.NotLive;
+import net.shibboleth.shared.annotation.constraint.Unmodifiable;
+import net.shibboleth.shared.component.AbstractIdentifiableInitializableComponent;
+import net.shibboleth.shared.logic.Constraint;
+import net.shibboleth.shared.primitive.StringSupport;
+
+/**
+ * Wrapper for {@link RelyingPartyConfiguration} that will handle absent settings
+ * by delegating to an injected parent instance of {@link RelyingPartyConfiguration}.
+ */
+public class DelegatingRelyingPartyConfiguration extends AbstractIdentifiableInitializableComponent
+ implements RelyingPartyConfiguration, Predicate<ProfileRequestContext> {
+
+ /** Inheritance source. */
+ @Nonnull private RelyingPartyConfiguration parentConfig;
+
+ /** Delegation target. */
+ @Nonnull private RelyingPartyConfiguration relyingPartyConfiguration;
+
+ /** Whether to treat an empty profile configuration set as a valid outcome. */
+ private boolean honorEmptyProfileCollection;
+
+ /**
+ * Constructor.
+ *
+ * @param parent inheritance source
+ * @param config delegation target
+ * @param honorEmpty whether to treat empty profile configuration collection as legitimate
+ */
+ public DelegatingRelyingPartyConfiguration(@Nonnull final RelyingPartyConfiguration parent,
+ @Nonnull final RelyingPartyConfiguration config, final boolean honorEmpty) {
+ parentConfig = Constraint.isNotNull(parent, "Parent configuration cannot be null");
+ relyingPartyConfiguration = Constraint.isNotNull(config, "RelyingPartyConfiguration cannot be null");
+ honorEmptyProfileCollection = honorEmpty;
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ @Nullable public String getId() {
+ return relyingPartyConfiguration.getId();
+ }
+
+ /** {@inheritDoc} */
+ public boolean test(@Nullable final ProfileRequestContext input) {
+ return relyingPartyConfiguration.test(input);
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("removal")
+ public void setResponderId(@Nullable final String issuer) {
+ relyingPartyConfiguration.setResponderId(issuer);
+ }
+
+ /** {@inheritDoc} */
+ @Nullable public String getIssuer(@Nullable final ProfileRequestContext profileRequestContext) {
+ final String issuer = relyingPartyConfiguration.getIssuer(profileRequestContext);
+ if (issuer != null) {
+ return issuer;
+ }
+ return parentConfig.getIssuer(profileRequestContext);
+ }
+
+ /** {@inheritDoc} */
+ @Nullable public SecurityConfiguration getSecurityConfiguration(
+ @Nullable final ProfileRequestContext profileRequestContext) {
+
+ final SecurityConfiguration config = relyingPartyConfiguration.getSecurityConfiguration(profileRequestContext);
+ if (config != null) {
+ return config;
+ }
+ return parentConfig.getSecurityConfiguration(profileRequestContext);
+ }
+
+ /** {@inheritDoc} */
+ @Nonnull @Unmodifiable @NotLive public Map<String,ProfileConfiguration> getProfileConfigurations(
+ @Nullable final ProfileRequestContext profileRequestContext) {
+
+ final var profiles = relyingPartyConfiguration.getProfileConfigurations(profileRequestContext);
+ if (honorEmptyProfileCollection || !profiles.isEmpty()) {
+ return profiles;
+ }
+ return parentConfig.getProfileConfigurations(profileRequestContext);
+ }
+
+ /** {@inheritDoc} */
+ public ProfileConfiguration getProfileConfiguration(ProfileRequestContext profileRequestContext, String profileId) {
+ final String trimmedId = StringSupport.trimOrNull(profileId);
+ if (trimmedId == null) {
+ return null;
+ }
+
+ return getProfileConfigurations(profileRequestContext).get(trimmedId);
+ }
+
+ /** {@inheritDoc} */
+ public boolean isDetailedErrors(ProfileRequestContext profileRequestContext) {
+ return relyingPartyConfiguration.isDetailedErrors(profileRequestContext);
+ }
+
+}
\ 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