[java-identity-provider] branch main updated: IDP-2240 Improve adding attributes to views

Rod Widdowson rdw at steadingsoftware.com
Fri Feb 9 15:12:37 UTC 2024


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

rdw 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=8f8b5335a6be0271a5022460ffd3f4e83a51ed8b

The following commit(s) were added to refs/heads/main by this push:
     new 8f8b5335a IDP-2240 Improve adding attributes to views
8f8b5335a is described below

commit 8f8b5335a6be0271a5022460ffd3f4e83a51ed8b
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Fri Feb 9 15:11:25 2024 +0000

    IDP-2240 Improve adding attributes to views
    
    https://shibboleth.atlassian.net/browse/IDP-2240
    
    Make the class user api rather than impl and wired the bean (with a prooperty override) into
    the intercept views
---
 .../net/shibboleth/idp/conf/global-system.xml       |  7 ++++++-
 .../idp/flows/intercept/attribute-release-flow.xml  |  2 ++
 .../idp/flows/intercept/expiring-password-flow.xml  |  1 +
 .../idp/flows/intercept/impersonate-flow.xml        |  1 +
 .../idp/flows/intercept/terms-of-use-flow.xml       |  1 +
 .../shibboleth/idp/flows/intercept/warning-flow.xml |  1 +
 .../idp/ui/{impl => helper}/AttributeHelper.java    |  2 +-
 .../net/shibboleth/idp/ui/helper/package-info.java  | 21 +++++++++++++++++++++
 .../net/shibboleth/idp/ui/AttributeHelperTest.java  |  2 +-
 9 files changed, 35 insertions(+), 3 deletions(-)

diff --git a/idp-conf-impl/src/main/resources/net/shibboleth/idp/conf/global-system.xml b/idp-conf-impl/src/main/resources/net/shibboleth/idp/conf/global-system.xml
index 3d7d25874..2531cba92 100644
--- a/idp-conf-impl/src/main/resources/net/shibboleth/idp/conf/global-system.xml
+++ b/idp-conf-impl/src/main/resources/net/shibboleth/idp/conf/global-system.xml
@@ -489,4 +489,9 @@
         </constructor-arg>    
     </bean>
 
- </beans>
+    <!-- Bean to inject into any view where we need Attribute assistance. -->
+    <alias name="%{idp.attribute.helper:shibboleth.DefaultAttributeHelper}" alias="shibboleth.AttributeHelper"/>
+
+    <bean id="shibboleth.DefaultAttributeHelper" class="net.shibboleth.idp.ui.helper.AttributeHelper"/>
+
+</beans>
diff --git a/idp-conf-impl/src/main/resources/net/shibboleth/idp/flows/intercept/attribute-release-flow.xml b/idp-conf-impl/src/main/resources/net/shibboleth/idp/flows/intercept/attribute-release-flow.xml
index dbe161d86..0d9cd6ca0 100644
--- a/idp-conf-impl/src/main/resources/net/shibboleth/idp/flows/intercept/attribute-release-flow.xml
+++ b/idp-conf-impl/src/main/resources/net/shibboleth/idp/flows/intercept/attribute-release-flow.xml
@@ -153,7 +153,9 @@
             <evaluate expression="opensamlProfileRequestContext.getSubcontext(T(net.shibboleth.idp.consent.context.ConsentContext))" result="viewScope.consentContext" />
             <evaluate expression="opensamlProfileRequestContext.getSubcontext(T(net.shibboleth.idp.consent.context.AttributeReleaseContext))" result="viewScope.attributeReleaseContext" />
             <evaluate expression="opensamlProfileRequestContext.ensureSubcontext(T(net.shibboleth.idp.authn.context.AuthenticationContext)).getSubcontext(T(net.shibboleth.idp.ui.context.RelyingPartyUIContext))" result="viewScope.rpUIContext" />
+            <evaluate expression="flowRequestContext.getActiveFlow().getApplicationContext().getBean('shibboleth.AttributeHelper')" result="viewScope.attributeHelper" />
             <evaluate expression="flowRequestContext.getActiveFlow().getApplicationContext().containsBean('shibboleth.CustomViewContext') ? flowRequestContext.getActiveFlow().getApplicationContext().getBean('shibboleth.CustomViewContext') : null" result="viewScope.custom" />
+
         </on-render>
         <transition on="AttributeReleaseRejected" to="WriteAttributeReleaseConsentAuditLog" />
         <transition on="proceed" to="TestForGlobalConsent" />
diff --git a/idp-conf-impl/src/main/resources/net/shibboleth/idp/flows/intercept/expiring-password-flow.xml b/idp-conf-impl/src/main/resources/net/shibboleth/idp/flows/intercept/expiring-password-flow.xml
index 4fb754f79..25d1de6f8 100644
--- a/idp-conf-impl/src/main/resources/net/shibboleth/idp/flows/intercept/expiring-password-flow.xml
+++ b/idp-conf-impl/src/main/resources/net/shibboleth/idp/flows/intercept/expiring-password-flow.xml
@@ -38,6 +38,7 @@
             <evaluate expression="flowRequestContext.getExternalContext().getNativeRequest()" result="viewScope.request" />
             <evaluate expression="flowRequestContext.getExternalContext().getNativeResponse()" result="viewScope.response" />
             <evaluate expression="opensamlProfileRequestContext" result="viewScope.profileRequestContext" />
+            <evaluate expression="flowRequestContext.getActiveFlow().getApplicationContext().getBean('shibboleth.AttributeHelper')" result="viewScope.attributeHelper" />
             <evaluate expression="flowRequestContext.getActiveFlow().getApplicationContext().containsBean('shibboleth.CustomViewContext') ? flowRequestContext.getActiveFlow().getApplicationContext().getBean('shibboleth.CustomViewContext') : null" result="viewScope.custom" />
         </on-render>
         
diff --git a/idp-conf-impl/src/main/resources/net/shibboleth/idp/flows/intercept/impersonate-flow.xml b/idp-conf-impl/src/main/resources/net/shibboleth/idp/flows/intercept/impersonate-flow.xml
index 06f522ddd..535304c53 100644
--- a/idp-conf-impl/src/main/resources/net/shibboleth/idp/flows/intercept/impersonate-flow.xml
+++ b/idp-conf-impl/src/main/resources/net/shibboleth/idp/flows/intercept/impersonate-flow.xml
@@ -27,6 +27,7 @@
             <evaluate expression="flowRequestContext.getExternalContext().getNativeRequest()" result="viewScope.request" />
             <evaluate expression="flowRequestContext.getExternalContext().getNativeResponse()" result="viewScope.response" />
             <evaluate expression="opensamlProfileRequestContext" result="viewScope.profileRequestContext" />
+            <evaluate expression="flowRequestContext.getActiveFlow().getApplicationContext().getBean('shibboleth.AttributeHelper')" result="viewScope.attributeHelper" />
             <evaluate expression="opensamlProfileRequestContext.getSubcontext(T(net.shibboleth.idp.authn.context.AuthenticationContext)).getSubcontext(T(net.shibboleth.idp.ui.context.RelyingPartyUIContext))" result="viewScope.rpUIContext" />
             <evaluate expression="flowRequestContext.getActiveFlow().getApplicationContext().containsBean('shibboleth.CustomViewContext') ? flowRequestContext.getActiveFlow().getApplicationContext().getBean('shibboleth.CustomViewContext') : null" result="viewScope.custom" />
         </on-render>
diff --git a/idp-conf-impl/src/main/resources/net/shibboleth/idp/flows/intercept/terms-of-use-flow.xml b/idp-conf-impl/src/main/resources/net/shibboleth/idp/flows/intercept/terms-of-use-flow.xml
index 48868529d..bb9dd9f92 100644
--- a/idp-conf-impl/src/main/resources/net/shibboleth/idp/flows/intercept/terms-of-use-flow.xml
+++ b/idp-conf-impl/src/main/resources/net/shibboleth/idp/flows/intercept/terms-of-use-flow.xml
@@ -36,6 +36,7 @@
             <evaluate expression="flowRequestContext.getExternalContext().getNativeRequest()" result="viewScope.request" />
             <evaluate expression="flowRequestContext.getExternalContext().getNativeResponse()" result="viewScope.response" />
             <evaluate expression="opensamlProfileRequestContext.ensureSubcontext(T(net.shibboleth.idp.authn.context.AuthenticationContext)).getSubcontext(T(net.shibboleth.idp.ui.context.RelyingPartyUIContext))" result="viewScope.rpUIContext" />
+            <evaluate expression="flowRequestContext.getActiveFlow().getApplicationContext().getBean('shibboleth.AttributeHelper')" result="viewScope.attributeHelper" />
             <evaluate expression="opensamlProfileRequestContext.getSubcontext(T(net.shibboleth.idp.consent.context.ConsentContext)).getCurrentConsents().keySet().iterator().next()" result="viewScope.termsOfUseId" />
             <evaluate expression="flowRequestContext.getActiveFlow().getApplicationContext().containsBean('shibboleth.CustomViewContext') ? flowRequestContext.getActiveFlow().getApplicationContext().getBean('shibboleth.CustomViewContext') : null" result="viewScope.custom" />
         </on-render>
diff --git a/idp-conf-impl/src/main/resources/net/shibboleth/idp/flows/intercept/warning-flow.xml b/idp-conf-impl/src/main/resources/net/shibboleth/idp/flows/intercept/warning-flow.xml
index d03b67316..8d7c4cbea 100644
--- a/idp-conf-impl/src/main/resources/net/shibboleth/idp/flows/intercept/warning-flow.xml
+++ b/idp-conf-impl/src/main/resources/net/shibboleth/idp/flows/intercept/warning-flow.xml
@@ -49,6 +49,7 @@
             <evaluate expression="flowRequestContext.getActiveFlow().getApplicationContext().getBean('shibboleth.CSPNonce')" result="viewScope.cspNonce" />
             <evaluate expression="flowRequestContext.getExternalContext().getNativeRequest()" result="viewScope.request" />
             <evaluate expression="flowRequestContext.getExternalContext().getNativeResponse()" result="viewScope.response" />
+            <evaluate expression="flowRequestContext.getActiveFlow().getApplicationContext().getBean('shibboleth.AttributeHelper')" result="viewScope.attributeHelper" />
             <evaluate expression="opensamlProfileRequestContext" result="viewScope.profileRequestContext" />
             <evaluate expression="flowRequestContext.getActiveFlow().getApplicationContext().containsBean('shibboleth.CustomViewContext') ? flowRequestContext.getActiveFlow().getApplicationContext().getBean('shibboleth.CustomViewContext') : null" result="viewScope.custom" />
         </on-render>
diff --git a/idp-ui/src/main/java/net/shibboleth/idp/ui/impl/AttributeHelper.java b/idp-ui/src/main/java/net/shibboleth/idp/ui/helper/AttributeHelper.java
similarity index 99%
rename from idp-ui/src/main/java/net/shibboleth/idp/ui/impl/AttributeHelper.java
rename to idp-ui/src/main/java/net/shibboleth/idp/ui/helper/AttributeHelper.java
index d478e2b3c..581794365 100644
--- a/idp-ui/src/main/java/net/shibboleth/idp/ui/impl/AttributeHelper.java
+++ b/idp-ui/src/main/java/net/shibboleth/idp/ui/helper/AttributeHelper.java
@@ -11,7 +11,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package net.shibboleth.idp.ui.impl;
+package net.shibboleth.idp.ui.helper;
 
 import java.util.List;
 import java.util.function.Function;
diff --git a/idp-ui/src/main/java/net/shibboleth/idp/ui/helper/package-info.java b/idp-ui/src/main/java/net/shibboleth/idp/ui/helper/package-info.java
new file mode 100644
index 000000000..9c0322597
--- /dev/null
+++ b/idp-ui/src/main/java/net/shibboleth/idp/ui/helper/package-info.java
@@ -0,0 +1,21 @@
+/*
+ * 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.
+ */
+
+/**
+ * Helper classes for the UI
+ */
+ at NonnullElements
+package net.shibboleth.idp.ui.helper;
+
+import net.shibboleth.shared.annotation.constraint.NonnullElements;
diff --git a/idp-ui/src/test/java/net/shibboleth/idp/ui/AttributeHelperTest.java b/idp-ui/src/test/java/net/shibboleth/idp/ui/AttributeHelperTest.java
index beb14d1fb..377b2c63b 100644
--- a/idp-ui/src/test/java/net/shibboleth/idp/ui/AttributeHelperTest.java
+++ b/idp-ui/src/test/java/net/shibboleth/idp/ui/AttributeHelperTest.java
@@ -8,7 +8,7 @@ import org.testng.annotations.Test;
 import net.shibboleth.idp.attribute.IdPAttribute;
 import net.shibboleth.idp.attribute.context.AttributeContext;
 import net.shibboleth.idp.attribute.resolver.testing.ResolverTestSupport;
-import net.shibboleth.idp.ui.impl.AttributeHelper;
+import net.shibboleth.idp.ui.helper.AttributeHelper;
 import net.shibboleth.profile.context.RelyingPartyContext;
 import net.shibboleth.shared.collection.CollectionSupport;
 import net.shibboleth.shared.component.ComponentInitializationException;

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


More information about the commits mailing list