Fixed a bug that caused crypto handle expiration times to not take effect.
[java-idp.git] / src / edu / internet2 / middleware / shibboleth / hs / provider / CryptoShibHandle.java
index f76aa95..9d12371 100644 (file)
@@ -204,8 +204,7 @@ public class CryptoShibHandle extends AQHNameIdentifierMapping implements NameId
                        long decodedExpirationTime = dataStream.readLong();
                        String decodedPrincipal = dataStream.readUTF();
 
                        long decodedExpirationTime = dataStream.readLong();
                        String decodedPrincipal = dataStream.readUTF();
 
-                       HMACHandleEntry macHandleEntry = new HMACHandleEntry(
-                                       createHandleEntry(new AuthNPrincipal(decodedPrincipal)));
+                       HMACHandleEntry macHandleEntry = createHMACHandleEntry(new AuthNPrincipal(decodedPrincipal));
                        macHandleEntry.setExpirationTime(decodedExpirationTime);
                        byte[] generatedMac = macHandleEntry.getMAC(mac);
 
                        macHandleEntry.setExpirationTime(decodedExpirationTime);
                        byte[] generatedMac = macHandleEntry.getMAC(mac);
 
@@ -262,8 +261,7 @@ public class CryptoShibHandle extends AQHNameIdentifierMapping implements NameId
 
                        Mac mac = Mac.getInstance(macAlgorithm);
                        mac.init(secret);
 
                        Mac mac = Mac.getInstance(macAlgorithm);
                        mac.init(secret);
-                       HandleEntry handleEntry = createHandleEntry(principal);
-                       HMACHandleEntry macHandleEntry = new HMACHandleEntry(handleEntry);
+                       HMACHandleEntry macHandleEntry = createHMACHandleEntry(principal);
 
                        Cipher cipher = Cipher.getInstance(cipherAlgorithm);
                        byte[] iv = new byte[cipher.getBlockSize()];
 
                        Cipher cipher = Cipher.getInstance(cipherAlgorithm);
                        byte[] iv = new byte[cipher.getBlockSize()];
@@ -396,6 +394,11 @@ public class CryptoShibHandle extends AQHNameIdentifierMapping implements NameId
                return Arrays.equals(defaultKey, encodedKey);
        }
 
                return Arrays.equals(defaultKey, encodedKey);
        }
 
+       protected HMACHandleEntry createHMACHandleEntry(AuthNPrincipal principal) {
+
+               return new HMACHandleEntry(principal, handleTTL);
+       }
+
 }
 
 /**
 }
 
 /**
@@ -409,11 +412,6 @@ class HMACHandleEntry extends HandleEntry {
                super(principal, TTL);
        }
 
                super(principal, TTL);
        }
 
-       protected HMACHandleEntry(HandleEntry handleEntry) {
-
-               super(handleEntry.principal, handleEntry.expirationTime);
-       }
-
        private static byte[] getLongBytes(long longValue) {
 
                try {
        private static byte[] getLongBytes(long longValue) {
 
                try {