[java-identity-provider COMMIT] /trunk/idp-session-impl/src/main/java/net/shibboleth/idp/session/impl/PopulateSession...

noreply at shibboleth.net noreply at shibboleth.net
Sun Oct 13 15:10:50 EDT 2013


Author: scantor
Date: Sun Oct 13 15:10:50 2013
New Revision: 4848

URL: http://svn.shibboleth.net/view/java-identity-provider?rev=4848&view=rev
Log:
Create a knob to turn on or off the session layer actions.

Modified:
    trunk/idp-session-impl/src/main/java/net/shibboleth/idp/session/impl/PopulateSessionContext.java

Modified: trunk/idp-session-impl/src/main/java/net/shibboleth/idp/session/impl/PopulateSessionContext.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-session-impl/src/main/java/net/shibboleth/idp/session/impl/PopulateSessionContext.java?rev=4848&r1=4847&r2=4848&view=diff
==============================================================================
--- trunk/idp-session-impl/src/main/java/net/shibboleth/idp/session/impl/PopulateSessionContext.java (original)
+++ trunk/idp-session-impl/src/main/java/net/shibboleth/idp/session/impl/PopulateSessionContext.java Sun Oct 13 15:10:50 2013
@@ -54,6 +54,14 @@
     /** Session resolver. */
     @NonnullAfterInit private SessionResolver sessionResolver;
 
+    /** Flag to turn action on or off. */
+    private boolean enabled;
+    
+    /** Constructor. */
+    public PopulateSessionContext() {
+        enabled = true;
+    }
+    
     /**
      * Set the {@link SessionResolver} to use.
      * 
@@ -65,13 +73,27 @@
         sessionResolver = Constraint.isNotNull(resolver, "SessionResolver cannot be null");
     }
     
+    /**
+     * Set whether the action should run or not.
+     * 
+     * @param flag flag to set
+     */
+    public void setEnabled(final boolean flag) {
+        enabled = flag;
+    }
+    
     /** {@inheritDoc} */
     protected void doInitialize() throws ComponentInitializationException {
         super.doInitialize();
         
-        if (sessionResolver == null) {
+        if (enabled && sessionResolver == null) {
             throw new ComponentInitializationException("SessionResolver cannot be null");
         }
+    }
+    
+    /** {@inheritDoc} */
+    protected boolean doPreExecute(ProfileRequestContext profileRequestContext) throws ProfileException {
+        return enabled;
     }
 
     /** {@inheritDoc} */



More information about the commits mailing list