[java-idp-plugin-oidc-rp] branch main updated: Move object mapper bean to global postconfig

Phil Smart philip.smart at jisc.ac.uk
Tue Mar 14 14:42:42 UTC 2023


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

philsmart pushed a commit to branch main
in repository java-idp-plugin-oidc-rp.

View the commit online:
http://git.shibboleth.net/view/?p=java-idp-plugin-oidc-rp.git;a=commit;h=575c6a133c9769db4fc9d788d494557e2622d868

The following commit(s) were added to refs/heads/main by this push:
     new 575c6a1  Move object mapper bean to global postconfig
575c6a1 is described below

commit 575c6a133c9769db4fc9d788d494557e2622d868
Author: Phil Smart <philip.smart at jisc.ac.uk>
AuthorDate: Tue Mar 14 14:42:40 2023 +0000

    Move object mapper bean to global postconfig
---
 .../META-INF/net.shibboleth.idp/postconfig.xml     | 24 ++++++++++++++++
 .../oidc-relying-party-authn-beans.xml             | 33 ++--------------------
 2 files changed, 27 insertions(+), 30 deletions(-)

diff --git a/idp-oidc-rp-impl/src/main/resources/META-INF/net.shibboleth.idp/postconfig.xml b/idp-oidc-rp-impl/src/main/resources/META-INF/net.shibboleth.idp/postconfig.xml
index cfafcb2..499e88c 100644
--- a/idp-oidc-rp-impl/src/main/resources/META-INF/net.shibboleth.idp/postconfig.xml
+++ b/idp-oidc-rp-impl/src/main/resources/META-INF/net.shibboleth.idp/postconfig.xml
@@ -180,6 +180,30 @@
                 c:claz="net.shibboleth.idp.plugin.authn.oidc.rp.principal.OIDCSubjectIdentifierPrincipal" c:name="subject" />
         </constructor-arg>
     </bean>
+    
+    <!-- ObjectMapper beans -->
+    <bean id="shibboleth.authn.oidc.rp.DefaultJSONObjectMapper" class="com.fasterxml.jackson.databind.ObjectMapper" />
+
+    <bean class="org.springframework.beans.factory.config.MethodInvokingBean"
+        p:targetObject-ref="shibboleth.authn.oidc.rp.DefaultJSONObjectMapper" p:targetMethod="setSerializationInclusion">
+        <property name="arguments">
+            <util:constant static-field="com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL" />
+        </property>
+    </bean>
+
+    <bean class="org.springframework.beans.factory.config.MethodInvokingBean"
+        p:targetObject-ref="shibboleth.authn.oidc.rp.DefaultJSONObjectMapper" p:targetMethod="registerModule">
+        <property name="arguments">
+            <bean class="com.fasterxml.jackson.datatype.jsr310.JavaTimeModule" />
+        </property>
+    </bean>
+
+    <bean class="org.springframework.beans.factory.config.MethodInvokingBean"
+        p:targetObject-ref="shibboleth.authn.oidc.rp.DefaultJSONObjectMapper" p:targetMethod="setDateFormat">
+        <property name="arguments">
+            <bean class="java.text.SimpleDateFormat" c:_0="yyyy-MM-dd'T'HH:mm:ss.SSSZZ" />
+        </property>
+    </bean>
         
     <!-- The authentication flow descriptor -->
 
diff --git a/idp-oidc-rp-impl/src/main/resources/META-INF/net/shibboleth/idp/flows/authn/OIDCRelyingParty/oidc-relying-party-authn-beans.xml b/idp-oidc-rp-impl/src/main/resources/META-INF/net/shibboleth/idp/flows/authn/OIDCRelyingParty/oidc-relying-party-authn-beans.xml
index 46274fb..9c4829b 100644
--- a/idp-oidc-rp-impl/src/main/resources/META-INF/net/shibboleth/idp/flows/authn/OIDCRelyingParty/oidc-relying-party-authn-beans.xml
+++ b/idp-oidc-rp-impl/src/main/resources/META-INF/net/shibboleth/idp/flows/authn/OIDCRelyingParty/oidc-relying-party-authn-beans.xml
@@ -387,41 +387,14 @@
     <!-- could these be singletons? -->
     <bean id="shibboleth.authn.oidc.rp.DefaultTokenResponseDecoder" scope="prototype"
         class="net.shibboleth.idp.plugin.authn.oidc.rp.decoding.impl.DefaultAccessTokenResponseDecoder"
-        p:objectMapper-ref="shibboleth.authn.oidc.rp.JSONObjectMapper" />
+        p:objectMapper="#{getObject('shibboleth.authn.oidc.rp.JSONObjectMapper') ?: getObject('shibboleth.authn.oidc.rp.DefaultJSONObjectMapper')}" />
 
     <bean id="shibboleth.authn.oidc.rp.DefaultAuthCodeTokenResponseEncoder" scope="prototype"
         class="net.shibboleth.idp.plugin.authn.oidc.rp.encoding.impl.NimbusAuthCodeTokenRequestEncoder" />
 
-    <!-- Create a default object mapper. Setup should not change once injected -->
-    <!-- TODO can we not use more global versions? -->
-    <bean id="shibboleth.authn.oidc.rp.JSONObjectMapper" class="com.fasterxml.jackson.databind.ObjectMapper" />
 
-    <bean class="org.springframework.beans.factory.config.MethodInvokingBean"
-        p:targetObject-ref="shibboleth.authn.oidc.rp.JSONObjectMapper" p:targetMethod="setSerializationInclusion">
-        <property name="arguments">
-            <util:constant static-field="com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL" />
-        </property>
-    </bean>
-
-    <bean class="org.springframework.beans.factory.config.MethodInvokingBean"
-        p:targetObject-ref="shibboleth.authn.oidc.rp.JSONObjectMapper" p:targetMethod="registerModule">
-        <property name="arguments">
-            <bean class="com.fasterxml.jackson.datatype.jsr310.JavaTimeModule" />
-        </property>
-    </bean>
-
-    <bean class="org.springframework.beans.factory.config.MethodInvokingBean"
-        p:targetObject-ref="shibboleth.authn.oidc.rp.JSONObjectMapper" p:targetMethod="setDateFormat">
-        <property name="arguments">
-            <bean class="java.text.SimpleDateFormat" c:_0="yyyy-MM-dd'T'HH:mm:ss.SSSZZ" />
-        </property>
-    </bean>
-
-
-    <!-- ID TOKEN Decryption -->
+    <!-- ID TOKEN Decryption (TODO: should this be a message handler chain for consistency) -->
 
-    <!-- TODO should we use an activation condition to decide if decryption params are needed e.g. JWT is not a JWE to stop 
-        redundent resolution of credentials -->
     <bean id="PopulateIDTokenDecryptionParameters"
         class="net.shibboleth.oidc.profile.impl.PopulateJWTDecryptionParameters" scope="prototype"
         p:profileContextLookupStrategy-ref="shibboleth.ChildLookup.ProxyProfileRequestContext"
@@ -680,7 +653,7 @@
 
     <bean id="shibboleth.authn.oidc.rp.DefaultUserInfoResponseDecoder" scope="prototype"
         class="net.shibboleth.idp.plugin.authn.oidc.rp.decoding.impl.DefaultUserInfoResponseDecoder"
-        p:objectMapper-ref="shibboleth.authn.oidc.rp.JSONObjectMapper" />
+        p:objectMapper="#{getObject('shibboleth.authn.oidc.rp.JSONObjectMapper') ?: getObject('shibboleth.authn.oidc.rp.DefaultJSONObjectMapper')}"/>
 
     <bean id="shibboleth.authn.oidc.rp.DefaultUserInfoRequestEncoder" scope="prototype"
         class="net.shibboleth.idp.plugin.authn.oidc.rp.encoding.impl.DefaultUserInfoRequestEncoder" />

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


More information about the commits mailing list