[java-identity-provider] branch main updated: IDP-2233 - Evaluate complex logic in views for possible abstraction

Scott Cantor cantor.2 at osu.edu
Wed Feb 7 14:09:00 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=f3961968db598809ece53713ad8423eb57109c3b

The following commit(s) were added to refs/heads/main by this push:
     new f3961968d IDP-2233 - Evaluate complex logic in views for possible abstraction
f3961968d is described below

commit f3961968db598809ece53713ad8423eb57109c3b
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Wed Feb 7 09:08:53 2024 -0500

    IDP-2233 - Evaluate complex logic in views for possible abstraction
    
    https://shibboleth.atlassian.net/browse/IDP-2233
    
    Simple changes, added username and rpContext to built-in context.
---
 .../net/shibboleth/idp/flows/authn/password-authn-flow.xml          | 6 ++++--
 .../src/main/resources/net/shibboleth/idp/module/views/login.vm     | 5 ++---
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/idp-conf-impl/src/main/resources/net/shibboleth/idp/flows/authn/password-authn-flow.xml b/idp-conf-impl/src/main/resources/net/shibboleth/idp/flows/authn/password-authn-flow.xml
index 757000afc..51f7b5d91 100644
--- a/idp-conf-impl/src/main/resources/net/shibboleth/idp/flows/authn/password-authn-flow.xml
+++ b/idp-conf-impl/src/main/resources/net/shibboleth/idp/flows/authn/password-authn-flow.xml
@@ -17,7 +17,7 @@
         <transition on="proceed" to="ValidateUsernamePassword" />
         
         <!-- Fall through to a different flow if basic-auth extract fails on a passive or non-browser request. -->
-        <transition on="#{ opensamlProfileRequestContext.getSubcontext(T(net.shibboleth.idp.authn.context.AuthenticationContext)).isPassive() || !opensamlProfileRequestContext.isBrowserProfile() }" to="ReselectFlow" />
+        <transition on="#{ opensamlProfileRequestContext.ensureSubcontext(T(net.shibboleth.idp.authn.context.AuthenticationContext)).isPassive() || !opensamlProfileRequestContext.isBrowserProfile() }" to="ReselectFlow" />
         
         <transition on="NoCredentials" to="PrePopulateUsername" />
         <transition on="InvalidCredentials" to="PrePopulateUsername" />
@@ -36,10 +36,12 @@
             <evaluate expression="environment" result="viewScope.environment" />
             <evaluate expression="opensamlProfileRequestContext" result="viewScope.profileRequestContext" />
             <evaluate expression="opensamlProfileRequestContext.getSubcontext(T(net.shibboleth.idp.authn.context.AuthenticationContext))" result="viewScope.authenticationContext" />
+            <evaluate expression="opensamlProfileRequestContext.getSubcontext(T(net.shibboleth.profile.context.RelyingPartyContext))" result="viewScope.rpContext" />
             <evaluate expression="authenticationContext.getSubcontext(T(net.shibboleth.idp.ui.context.RelyingPartyUIContext))" result="viewScope.rpUIContext" />
             <evaluate expression="authenticationContext.getSubcontext(T(net.shibboleth.idp.authn.context.AuthenticationErrorContext))" result="viewScope.authenticationErrorContext" />
             <evaluate expression="authenticationContext.getSubcontext(T(net.shibboleth.idp.authn.context.AuthenticationWarningContext))" result="viewScope.authenticationWarningContext" />
             <evaluate expression="authenticationContext.getSubcontext(T(net.shibboleth.idp.authn.context.LDAPResponseContext))" result="viewScope.ldapResponseContext" />
+            <evaluate expression="authenticationContext.ensureSubcontext(T(net.shibboleth.idp.authn.context.UsernamePasswordContext)).getUsername()" result="viewScope.username" />
             <evaluate expression="T(net.shibboleth.shared.codec.HTMLEncoder)" result="viewScope.encoder" />
             <evaluate expression="flowRequestContext.getActiveFlow().getApplicationContext().getBean('shibboleth.CSPDigester')" result="viewScope.cspDigester" />
             <evaluate expression="flowRequestContext.getActiveFlow().getApplicationContext().getBean('shibboleth.CSPNonce')" result="viewScope.cspNonce" />
@@ -70,7 +72,7 @@
         <transition on="proceed" to="ContinueSuccessfulAuthentication" />
         
         <!-- Fall through to a different flow if login fails on a passive or non-browser request. -->
-        <transition on="#{ opensamlProfileRequestContext.getSubcontext(T(net.shibboleth.idp.authn.context.AuthenticationContext)).isPassive() || !opensamlProfileRequestContext.isBrowserProfile() }" to="ReselectFlow" />
+        <transition on="#{ opensamlProfileRequestContext.ensureSubcontext(T(net.shibboleth.idp.authn.context.AuthenticationContext)).isPassive() || !opensamlProfileRequestContext.isBrowserProfile() }" to="ReselectFlow" />
 
         <!-- Other event transitions are determined by deployer in /flows/authn/conditions/conditions-flow.xml -->
     </action-state>
diff --git a/idp-conf-impl/src/main/resources/net/shibboleth/idp/module/views/login.vm b/idp-conf-impl/src/main/resources/net/shibboleth/idp/module/views/login.vm
index 16fe5e9a8..838eb5e2c 100644
--- a/idp-conf-impl/src/main/resources/net/shibboleth/idp/module/views/login.vm
+++ b/idp-conf-impl/src/main/resources/net/shibboleth/idp/module/views/login.vm
@@ -10,6 +10,8 @@
 ## authenticationErrorContext - context with login error state
 ## authenticationWarningContext - context with login warning state
 ## ldapResponseContext - context with LDAP state (if using native LDAP)
+## username - username from previous rendering of form
+## rpContext - the context with information about the relying party (SP)
 ## rpUIContext - the context with SP UI information from the metadata
 ## encoder - HTMLEncoder class
 ## cspDigester - Calculates base64-encoded SHA-2 hashes (call apply)
@@ -19,9 +21,6 @@
 ## environment - Spring Environment object for property resolution
 ## custom - arbitrary object injected by deployer
 ##
-#set ($rpContext = $profileRequestContext.getSubcontext('net.shibboleth.profile.context.RelyingPartyContext'))
-#set ($username = $authenticationContext.ensureSubcontext('net.shibboleth.idp.authn.context.UsernamePasswordContext').getUsername())
-##
 #set ($nonce = $cspNonce.generateIdentifier())
 $response.addHeader("Content-Security-Policy", "script-src-elem 'nonce-$nonce'")
 #set ($onClick = "this.childNodes[0].nodeValue='#springMessageText('idp.login.pleasewait', 'Logging in, please wait...')'")

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


More information about the commits mailing list