[java-identity-provider COMMIT] /trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/impl/profile/saml2/Decrypt...

noreply at shibboleth.net noreply at shibboleth.net
Wed Feb 5 22:54:54 EST 2014


Author: scantor
Date: Wed Feb  5 22:54:53 2014
New Revision: 5320

URL: http://svn.shibboleth.net/view/java-identity-provider?rev=5320&view=rev
Log:
Replace approach to decrypter configuration with TODO.

Modified:
    trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/impl/profile/saml2/DecryptNameIDs.java

Modified: trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/impl/profile/saml2/DecryptNameIDs.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/impl/profile/saml2/DecryptNameIDs.java?rev=5320&r1=5319&r2=5320&view=diff
==============================================================================
--- trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/impl/profile/saml2/DecryptNameIDs.java (original)
+++ trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/impl/profile/saml2/DecryptNameIDs.java Wed Feb  5 22:54:53 2014
@@ -89,8 +89,8 @@
     /** Strategy used to locate the SAML message to operate on. */
     @Nonnull private Function<ProfileRequestContext, Object> messageLookupStrategy;
     
-    /** Configuration supporting decryption. */
-    @Nullable private DecryptionConfiguration decryptionConfig;
+    /** The decryption object. */
+    @Nullable private Decrypter decrypter;
     
     /** Message to operate on. */
     @Nullable private Object message;
@@ -165,13 +165,16 @@
             return false;
         }
         
-        decryptionConfig = rpCtx.getProfileConfig().getSecurityConfiguration().getDecryptionConfiguration();
-        if (decryptionConfig == null) {
-            log.debug("{} No DecryptionConfiguration available in security configuration", getLogPrefix());
-            if (errorFatal) {
-                ActionSupport.buildEvent(profileRequestContext, SAMLEventIds.DECRYPT_NAMEID_FAILED);
-            }
-            return false;
+        // TODO: this will be replaced by some accessor of a DecryptionParameters instance.
+        // For now, just construct directly off the DecryptionConfiguration.
+        
+        final DecryptionConfiguration decryptionConfig =
+                rpCtx.getProfileConfig().getSecurityConfiguration().getDecryptionConfiguration();
+        if (decryptionConfig != null) {
+            decrypter = new Decrypter(decryptionConfig.getDataKeyInfoCredentialResolver(),
+                    decryptionConfig.getKEKKeyInfoCredentialResolver(), decryptionConfig.getEncryptedKeyResolver());
+        } else {
+            decrypter = new Decrypter(null, null, null);
         }
         
         return super.doPreExecute(profileRequestContext);
@@ -224,7 +227,6 @@
      * @return the decrypted name, or null
      */
     @Nullable private NameID processEncryptedID(@Nonnull final EncryptedID encID) {
-        final Decrypter decrypter = new Decrypter(decryptionConfig);
         try {
             final SAMLObject object = decrypter.decrypt(encID);
             if (object instanceof NameID) {
@@ -245,7 +247,6 @@
      * @return the decrypted name, or null
      */
     @Nullable private NewID processNewEncryptedID(@Nonnull final NewEncryptedID encID) {
-        final Decrypter decrypter = new Decrypter(decryptionConfig);
         try {
             return decrypter.decrypt(encID);
         } catch (DecryptionException e) {



More information about the commits mailing list