[java-opensaml COMMIT] in /trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/profile/impl: AbstractDecry...

noreply at shibboleth.net noreply at shibboleth.net
Tue Apr 1 12:54:07 EDT 2014


Author: scantor
Date: Tue Apr  1 12:54:07 2014
New Revision: 3747

URL: http://svn.shibboleth.net/view/java-opensaml?rev=3747&view=rev
Log:
IDP-138 - added actions to decrypt attributes and assertions

Added:
    trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/profile/impl/AbstractDecryptAction.java   (with props)
    trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/profile/impl/DecryptAssertions.java   (with props)
    trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/profile/impl/DecryptAttributes.java   (with props)
Modified:
    trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/profile/impl/DecryptNameIDs.java

Modified: trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/profile/impl/DecryptNameIDs.java
URL: http://svn.shibboleth.net/view/java-opensaml/trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/profile/impl/DecryptNameIDs.java?rev=3747&r1=3746&r2=3747&view=diff
==============================================================================
--- trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/profile/impl/DecryptNameIDs.java (original)
+++ trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/profile/impl/DecryptNameIDs.java Tue Apr  1 12:54:07 2014
@@ -21,17 +21,10 @@
 import javax.annotation.Nullable;
 
 import net.shibboleth.utilities.java.support.collection.Pair;
-import net.shibboleth.utilities.java.support.component.ComponentSupport;
-import net.shibboleth.utilities.java.support.logic.Constraint;
-
-import org.opensaml.messaging.context.navigate.ChildContextLookup;
-import org.opensaml.messaging.context.navigate.MessageLookup;
+
 import org.opensaml.profile.ProfileException;
-import org.opensaml.profile.action.AbstractProfileAction;
 import org.opensaml.profile.action.ActionSupport;
-import org.opensaml.profile.action.EventIds;
 import org.opensaml.profile.context.ProfileRequestContext;
-import org.opensaml.profile.context.navigate.InboundMessageContextLookup;
 import org.opensaml.saml.common.SAMLObject;
 import org.opensaml.saml.common.profile.SAMLEventIds;
 import org.opensaml.saml.ext.saml2delrestrict.Delegate;
@@ -52,17 +45,9 @@
 import org.opensaml.saml.saml2.core.Subject;
 import org.opensaml.saml.saml2.core.SubjectConfirmation;
 import org.opensaml.saml.saml2.core.SubjectQuery;
-import org.opensaml.saml.saml2.encryption.Decrypter;
-import org.opensaml.xmlsec.DecryptionParameters;
-import org.opensaml.xmlsec.context.SecurityParametersContext;
 import org.opensaml.xmlsec.encryption.support.DecryptionException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-
-import com.google.common.base.Function;
-import com.google.common.base.Functions;
-import com.google.common.base.Predicate;
-import com.google.common.base.Predicates;
 
 /**
  * Action to decrypt an {@link EncryptedID} element and replace it with the decrypted {@link NameID}
@@ -76,123 +61,19 @@
  * strategy, by default a child of the inbound message context.</p>
  * 
  * @event {@link EventIds#PROCEED_EVENT_ID}
- * @event {@link EventIds#INVALID_MSG_CTX}
- * @event {@link EventIds#INVALID_PROFILE_CTX}
  * @event {@link SAMLEventIds#DECRYPT_NAMEID_FAILED}
  */
-public class DecryptNameIDs extends AbstractProfileAction {
+public class DecryptNameIDs extends AbstractDecryptAction {
 
     /** Class logger. */
     @Nonnull private final Logger log = LoggerFactory.getLogger(DecryptNameIDs.class);
-    
-    /** Are decryption failures a fatal condition? */
-    private boolean errorFatal;
-
-    /** Strategy used to locate the {@link SecurityParametersContext}. */
-    @Nonnull private Function<ProfileRequestContext, SecurityParametersContext> securityParamsLookupStrategy;
-
-    /** Strategy used to locate the SAML message to operate on. */
-    @Nonnull private Function<ProfileRequestContext, Object> messageLookupStrategy;
-    
-    /** Predicate dertermining whether to attempt decryption. */
-    @Nonnull private Predicate<Pair<ProfileRequestContext,EncryptedElementType>> decryptionPredicate;
-    
-    /** The decryption object. */
-    @Nullable private Decrypter decrypter;
-    
-    /** Message to operate on. */
-    @Nullable private SAMLObject message;
-    
-    /** Constructor. */
-    public DecryptNameIDs() {
-        errorFatal = true;
-        securityParamsLookupStrategy = Functions.compose(new ChildContextLookup<>(SecurityParametersContext.class),
-                new InboundMessageContextLookup());
-        messageLookupStrategy = Functions.compose(new MessageLookup<>(Object.class), new InboundMessageContextLookup());
-        decryptionPredicate = Predicates.alwaysTrue();
-    }
-    
-    /**
-     * Set whether decryption failure should be treated as an error or ignored.
-     * 
-     * @param flag  true iff decryption failure should be fatal
-     */
-    public synchronized void setErrorFatal(final boolean flag) {
-        ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);
-        
-        errorFatal = flag;
-    }
-    
-    /**

[... 160 lines stripped ...]


More information about the commits mailing list