[java-identity-provider] branch main updated: Fix some unguarded getSubcontext calls via ensureSubcontext.

Scott Cantor cantor.2 at osu.edu
Tue Dec 17 14:06:55 UTC 2024


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=c9297bd97f486623de50f4a9e907adcea32fe64c

The following commit(s) were added to refs/heads/main by this push:
     new c9297bd97 Fix some unguarded getSubcontext calls via ensureSubcontext.
c9297bd97 is described below

commit c9297bd97f486623de50f4a9e907adcea32fe64c
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Tue Dec 17 09:06:52 2024 -0500

    Fix some unguarded getSubcontext calls via ensureSubcontext.
---
 .../net/shibboleth/idp/flows/intercept/impersonate-flow.xml       | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

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 535304c53..f2b96a27e 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
@@ -28,7 +28,7 @@
             <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="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().containsBean('shibboleth.CustomViewContext') ? flowRequestContext.getActiveFlow().getApplicationContext().getBean('shibboleth.CustomViewContext') : null" result="viewScope.custom" />
         </on-render>
         
@@ -55,9 +55,9 @@
     <action-state id="DoImpersonate">
         <on-entry>
             <!-- Clear existing attribute state. -->
-            <evaluate expression="opensamlProfileRequestContext.getSubcontext(T(net.shibboleth.profile.context.RelyingPartyContext)).removeSubcontext(T(net.shibboleth.idp.attribute.context.AttributeContext))" />
+            <evaluate expression="opensamlProfileRequestContext.ensureSubcontext(T(net.shibboleth.profile.context.RelyingPartyContext)).removeSubcontext(T(net.shibboleth.idp.attribute.context.AttributeContext))" />
             <!-- Log the impersonation. -->
-            <evaluate expression="opensamlProfileRequestContext.getSubcontext(T(net.shibboleth.profile.context.RelyingPartyContext)).getRelyingPartyId()" result="requestScope.relyingPartyId" />
+            <evaluate expression="opensamlProfileRequestContext.ensureSubcontext(T(net.shibboleth.profile.context.RelyingPartyContext)).getRelyingPartyId()" result="requestScope.relyingPartyId" />
             <evaluate expression="T(org.slf4j.LoggerFactory).getLogger('net.shibboleth.idp.profile.interceptor').info('Impersonation by principal ''{}'' as ''{}'' to relying party ''{}''', new Object[]{subjectContext.getPrincipalName(), principalToSpoof, relyingPartyId})" />
             <!-- Swap identities. -->
             <evaluate expression="subjectContext.setImpersonatingPrincipalName(subjectContext.getPrincipalName())" />
@@ -75,7 +75,7 @@
     <end-state id="ImpersonationViolation">
         <on-entry>
             <!-- Log violation. -->
-            <evaluate expression="opensamlProfileRequestContext.getSubcontext(T(net.shibboleth.profile.context.RelyingPartyContext)).getRelyingPartyId()" result="requestScope.relyingPartyId" />
+            <evaluate expression="opensamlProfileRequestContext.ensureSubcontext(T(net.shibboleth.profile.context.RelyingPartyContext)).getRelyingPartyId()" result="requestScope.relyingPartyId" />
             <evaluate expression="T(org.slf4j.LoggerFactory).getLogger('net.shibboleth.idp.profile.interceptor').warn('Unauthorized impersonation attempt by principal ''{}'' as ''{}'' to relying party ''{}''', new Object[]{subjectContext.getPrincipalName(), principalToSpoof, relyingPartyId})" />
         </on-entry>
     </end-state>

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


More information about the commits mailing list