[java-identity-provider] branch main updated: JOIDC-18 - Work out better mechanism for overriding issuer in profiles
Scott Cantor
cantor.2 at osu.edu
Tue Nov 24 19:02:55 UTC 2020
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=ae48b5d107cdfefb6f642ed6e219de176d8bc6be
The following commit(s) were added to refs/heads/main by this push:
new ae48b5d10 JOIDC-18 - Work out better mechanism for overriding issuer in profiles
ae48b5d10 is described below
commit ae48b5d107cdfefb6f642ed6e219de176d8bc6be
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Tue Nov 24 14:02:16 2020 -0500
JOIDC-18 - Work out better mechanism for overriding issuer in profiles
https://issues.shibboleth.net/jira/browse/JOIDC-18
Add a hook for overriding issuer by profile.
---
.../OverriddenIssuerProfileConfiguration.java | 42 ++++++++++++++++++++++
.../navigate/ResponderIdLookupFunction.java | 23 +++++++++---
2 files changed, 60 insertions(+), 5 deletions(-)
diff --git a/idp-profile-api/src/main/java/net/shibboleth/idp/profile/config/OverriddenIssuerProfileConfiguration.java b/idp-profile-api/src/main/java/net/shibboleth/idp/profile/config/OverriddenIssuerProfileConfiguration.java
new file mode 100644
index 000000000..2d536747d
--- /dev/null
+++ b/idp-profile-api/src/main/java/net/shibboleth/idp/profile/config/OverriddenIssuerProfileConfiguration.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the University Corporation for Advanced Internet Development,
+ * Inc. (UCAID) under one or more contributor license agreements. See the
+ * NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The UCAID licenses this file to You 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.idp.profile.config;
+
+import javax.annotation.Nullable;
+
+import org.opensaml.profile.context.ProfileRequestContext;
+
+import net.shibboleth.utilities.java.support.annotation.constraint.NotEmpty;
+
+/**
+ * {@link ProfileConfiguration} with optional override of issuer setting.
+ *
+ * @since 4.1.0
+ */
+public interface OverriddenIssuerProfileConfiguration extends ProfileConfiguration {
+
+ /**
+ * Get overridden issuer value.
+ *
+ * @param profileRequestContext current profile request context
+ *
+ * @return issuer or null to use usual default
+ */
+ @Nullable @NotEmpty String getIssuer(@Nullable final ProfileRequestContext profileRequestContext);
+
+}
\ No newline at end of file
diff --git a/idp-profile-api/src/main/java/net/shibboleth/idp/profile/context/navigate/ResponderIdLookupFunction.java b/idp-profile-api/src/main/java/net/shibboleth/idp/profile/context/navigate/ResponderIdLookupFunction.java
index 227c6cb8d..fc0d505ad 100644
--- a/idp-profile-api/src/main/java/net/shibboleth/idp/profile/context/navigate/ResponderIdLookupFunction.java
+++ b/idp-profile-api/src/main/java/net/shibboleth/idp/profile/context/navigate/ResponderIdLookupFunction.java
@@ -19,6 +19,7 @@ package net.shibboleth.idp.profile.context.navigate;
import javax.annotation.Nullable;
+import net.shibboleth.idp.profile.config.OverriddenIssuerProfileConfiguration;
import net.shibboleth.idp.profile.context.RelyingPartyContext;
import org.opensaml.profile.context.ProfileRequestContext;
@@ -28,9 +29,10 @@ import org.opensaml.profile.context.ProfileRequestContext;
* available from a {@link RelyingPartyContext} obtained via a lookup function, by default a child of the
* {@link ProfileRequestContext}.
*
- * <p>
- * If a specific setting is unavailable, a null value is returned.
- * </p>
+ * <p>A special case applies if an active {@link OverriddenIssuerProfileConfiguration} is in effect, allowing the
+ * profile to override the usual value.</p>
+ *
+ * <p>If a specific setting is unavailable, a null value is returned.</p>
*/
public class ResponderIdLookupFunction extends AbstractRelyingPartyLookupFunction<String> {
@@ -38,8 +40,19 @@ public class ResponderIdLookupFunction extends AbstractRelyingPartyLookupFunctio
@Nullable public String apply(@Nullable final ProfileRequestContext input) {
if (input != null) {
final RelyingPartyContext rpc = getRelyingPartyContextLookupStrategy().apply(input);
- if (rpc != null && rpc.getConfiguration() != null) {
- return rpc.getConfiguration().getResponderId(input);
+ if (rpc != null) {
+
+ if (rpc.getProfileConfig() instanceof OverriddenIssuerProfileConfiguration) {
+ final String issuer =
+ ((OverriddenIssuerProfileConfiguration) rpc.getProfileConfig()).getIssuer(input);
+ if (issuer != null) {
+ return issuer;
+ }
+ }
+
+ if (rpc.getConfiguration() != null) {
+ return rpc.getConfiguration().getResponderId(input);
+ }
}
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list