[java-identity-provider COMMIT] /trunk/idp-authn-api/src/main/java/net/shibboleth/idp/authn/AbstractAuthenticationAct...

noreply at shibboleth.net noreply at shibboleth.net
Sat Sep 7 13:22:48 EDT 2013


Author: scantor
Date: Sat Sep  7 13:22:47 2013
New Revision: 4752

URL: http://svn.shibboleth.net/view/java-identity-provider?rev=4752&view=rev
Log:
Eliminate redundant context lookup.

Modified:
    trunk/idp-authn-api/src/main/java/net/shibboleth/idp/authn/AbstractAuthenticationAction.java

Modified: trunk/idp-authn-api/src/main/java/net/shibboleth/idp/authn/AbstractAuthenticationAction.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-authn-api/src/main/java/net/shibboleth/idp/authn/AbstractAuthenticationAction.java?rev=4752&r1=4751&r2=4752&view=diff
==============================================================================
--- trunk/idp-authn-api/src/main/java/net/shibboleth/idp/authn/AbstractAuthenticationAction.java (original)
+++ trunk/idp-authn-api/src/main/java/net/shibboleth/idp/authn/AbstractAuthenticationAction.java Sat Sep  7 13:22:47 2013
@@ -18,6 +18,7 @@
 package net.shibboleth.idp.authn;
 
 import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
 
 import net.shibboleth.idp.authn.context.AuthenticationContext;
 import net.shibboleth.utilities.java.support.logic.Constraint;
@@ -49,6 +50,9 @@
      * {@link ProfileRequestContext}.
      */
     @Nonnull private Function<ProfileRequestContext, AuthenticationContext> authnCtxLookupStrategy;
+    
+    /** AuthenticationContext to operate on. */
+    @Nullable private AuthenticationContext authnContext;
 
     /** Constructor. */
     public AbstractAuthenticationAction() {
@@ -70,13 +74,13 @@
     protected final boolean doPreExecute(@Nonnull final ProfileRequestContext profileRequestContext)
             throws ProfileException {
 
-        final AuthenticationContext authenticationContext = authnCtxLookupStrategy.apply(profileRequestContext);
-        if (authenticationContext == null) {
+        authnContext = authnCtxLookupStrategy.apply(profileRequestContext);
+        if (authnContext == null) {
             ActionSupport.buildEvent(profileRequestContext, EventIds.INVALID_PROFILE_CTX);
             return false;
         }
 
-        if (doPreExecute(profileRequestContext, authenticationContext)) {
+        if (doPreExecute(profileRequestContext, authnContext)) {
             return super.doPreExecute(profileRequestContext);
         } else {
             return false;
@@ -86,13 +90,7 @@
     /** {@inheritDoc} */
     protected final void doExecute(@Nonnull final ProfileRequestContext profileRequestContext) throws ProfileException {
 
-        final AuthenticationContext authenticationContext = authnCtxLookupStrategy.apply(profileRequestContext);
-        if (authenticationContext == null) {
-            ActionSupport.buildEvent(profileRequestContext, EventIds.INVALID_PROFILE_CTX);
-            return;
-        }
-
-        doExecute(profileRequestContext, authenticationContext);
+        doExecute(profileRequestContext, authnContext);
     }
 
     /**



More information about the commits mailing list