Bug 5494: Enforce authentication key-ID 77/36077/4
authorLorand Jakab <lojakab@cisco.com>
Fri, 11 Mar 2016 18:28:06 +0000 (10:28 -0800)
committerLorand Jakab <lojakab@cisco.com>
Fri, 11 Mar 2016 18:28:50 +0000 (10:28 -0800)
Change-Id: Ic8a8eb0e5c396a26523007a81095c7308abf37b9
Signed-off-by: Lorand Jakab <lojakab@cisco.com>
integrationtest/src/test/java/org/opendaylight/lispflowmapping/integrationtest/MappingServiceIntegrationTest.java
mappingservice/implementation/src/main/java/org/opendaylight/lispflowmapping/implementation/MappingSystem.java
mappingservice/implementation/src/main/java/org/opendaylight/lispflowmapping/implementation/authentication/LispAuthenticationUtil.java
mappingservice/implementation/src/main/java/org/opendaylight/lispflowmapping/implementation/authentication/LispMACAuthentication.java
mappingservice/implementation/src/main/java/org/opendaylight/lispflowmapping/implementation/lisp/MapServer.java
mappingservice/implementation/src/main/java/org/opendaylight/lispflowmapping/implementation/mapcache/SimpleMapCache.java
mappingservice/implementation/src/test/java/org/opendaylight/lispflowmapping/implementation/authentication/LispAuthenticationTest.java

index 1a6b9f5a1e41204b7c8ae0762137a73c53312352..74766ba36613b943412e8745311cda85bf88fdf4 100644 (file)
@@ -77,6 +77,8 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.ma
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequestnotification.MapRequestBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.rloc.container.Rloc;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.rloc.container.RlocBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.mapping.authkey.container.MappingAuthkey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.mapping.authkey.container.MappingAuthkeyBuilder;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpAddress;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpPrefix;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Address;
@@ -137,6 +139,9 @@ public class MappingServiceIntegrationTest extends AbstractMdsalTestBase {
     public static final String YANG = "org.opendaylight.yangtools";
     public static final String JERSEY = "com.sun.jersey";
     private static final int MAX_NOTIFICATION_RETRYS = 20;
+    private static final MappingAuthkey NULL_AUTH_KEY = new MappingAuthkeyBuilder().setKeyType(0).build();
+    private static final MappingAuthkey AUTH_KEY =
+            new MappingAuthkeyBuilder().setKeyType(1).setKeyString("password").build();
 
     @Override
     public String getModuleName() {
@@ -396,6 +401,8 @@ public class MappingServiceIntegrationTest extends AbstractMdsalTestBase {
 
     public void mapRegisterWithMapNotify() throws SocketTimeoutException {
         cleanUP();
+        mapService.addAuthenticationKey(LispAddressUtil.asIpv4PrefixEid("153.16.254.1/32"), NULL_AUTH_KEY);
+        sleepForSeconds(1);
         sendPacket(mapRegisterPacketWithNotify);
         MapNotify reply = receiveMapNotify();
         assertEquals(7, reply.getNonce().longValue());
@@ -430,6 +437,9 @@ public class MappingServiceIntegrationTest extends AbstractMdsalTestBase {
     public void mapRequestMapRegisterAndMapRequest() throws SocketTimeoutException {
         cleanUP();
         Eid eid = LispAddressUtil.asIpv4PrefixEid("1.2.3.4/32");
+        mapService.addAuthenticationKey(eid, NULL_AUTH_KEY);
+        sleepForSeconds(1);
+
         MapRequestBuilder mapRequestBuilder = new MapRequestBuilder();
         mapRequestBuilder.setNonce((long) 4);
         mapRequestBuilder.setSourceEid(new SourceEidBuilder().setEid(LispAddressUtil.getNoAddressEid()).build());
@@ -523,6 +533,8 @@ public class MappingServiceIntegrationTest extends AbstractMdsalTestBase {
 
     private MapReply sendMapRegisterTwiceWithDiffrentValues(Eid eid, Rloc rloc1, Rloc rloc2)
             throws SocketTimeoutException {
+        mapService.addAuthenticationKey(eid, NULL_AUTH_KEY);
+        sleepForSeconds(1);
         MapRegister mb = createMapRegister(eid, rloc1);
         MapNotify mapNotify = lms.handleMapRegister(mb).getLeft();
         MapRequest mr = createMapRequest(eid);
@@ -563,6 +575,8 @@ public class MappingServiceIntegrationTest extends AbstractMdsalTestBase {
     public void registerQueryRegisterWithSmr() throws SocketTimeoutException {
         cleanUP();
         lms.setShouldUseSmr(true);
+        mapService.addAuthenticationKey(LispAddressUtil.asIpv4PrefixEid("153.16.254.1/32"), NULL_AUTH_KEY);
+        sleepForSeconds(1);
 
         sendPacket(mapRegisterPacketWithNotify);
         receiveMapNotify();
@@ -950,6 +964,8 @@ public class MappingServiceIntegrationTest extends AbstractMdsalTestBase {
 
     private void runPrefixTest(Eid registerEID, Eid matchedAddress, Eid unMatchedAddress)
             throws SocketTimeoutException {
+        mapService.addAuthenticationKey(registerEID, NULL_AUTH_KEY);
+        sleepForSeconds(1);
 
         MapRegisterBuilder mapRegister = new MapRegisterBuilder();
         mapRegister.setWantMapNotify(true);
@@ -1057,7 +1073,7 @@ public class MappingServiceIntegrationTest extends AbstractMdsalTestBase {
 
         sendMapRegister(mapRegister.build());
 
-        assertMapNotifyRecieved();
+        assertMapNotifyReceived();
     }
 
     public void testPasswordMaskMatch() throws Exception {
@@ -1096,7 +1112,7 @@ public class MappingServiceIntegrationTest extends AbstractMdsalTestBase {
 
         sendMapRegister(mapRegister.build());
 
-        assertMapNotifyRecieved();
+        assertMapNotifyReceived();
 
         etlr.setLispAddressContainer(LispAddressUtil.toContainer(addressOutOfRange));
         mapRegister
@@ -1108,6 +1124,8 @@ public class MappingServiceIntegrationTest extends AbstractMdsalTestBase {
 */
     // takes an address, packs it in a MapRegister and sends it
     private void registerAddress(Eid eid) throws SocketTimeoutException {
+        mapService.addAuthenticationKey(eid, NULL_AUTH_KEY);
+        sleepForSeconds(1);
         MapRegisterBuilder mapRegisterBuilder = new MapRegisterBuilder();
         mapRegisterBuilder.setWantMapNotify(true);
         mapRegisterBuilder.setKeyId((short) 0);
@@ -1164,6 +1182,8 @@ public class MappingServiceIntegrationTest extends AbstractMdsalTestBase {
     // takes an address, packs it in a MapRegister, sends it, returns the
     // MapReply
     private MapReply registerAddressAndQuery(Eid eid) throws SocketTimeoutException {
+        mapService.addAuthenticationKey(eid, NULL_AUTH_KEY);
+        sleepForSeconds(1);
         MapRegisterBuilder mapRegisterBuilder = new MapRegisterBuilder();
         mapRegisterBuilder.setWantMapNotify(true);
         mapRegisterBuilder.setKeyId((short) 0);
@@ -1345,8 +1365,8 @@ public class MappingServiceIntegrationTest extends AbstractMdsalTestBase {
         assertEquals(AfiListLcaf.class, receivedAddress.getAddressType());
 
         AfiList listAddrFromNetwork = (AfiList) receivedAddress.getAddress();
-        SimpleAddress receivedAddr1 = listAddrFromNetwork.getAfiList().getAddressList().get(0);
-        SimpleAddress receivedAddr2 = listAddrFromNetwork.getAfiList().getAddressList().get(1);
+        SimpleAddress receivedAddr1 = (SimpleAddress) listAddrFromNetwork.getAfiList().getAddressList().get(0);
+        SimpleAddress receivedAddr2 = (SimpleAddress) listAddrFromNetwork.getAfiList().getAddressList().get(1);
 
         assertNotNull(receivedAddr1.getIpAddress().getIpv4Address());
         assertNotNull(receivedAddr2.getMacAddress());
@@ -1404,8 +1424,8 @@ public class MappingServiceIntegrationTest extends AbstractMdsalTestBase {
 
         ExplicitLocatorPath receivedAddress = (ExplicitLocatorPath) reply.getMappingRecordItem().get(0).getMappingRecord().getEid().getAddress();
 
-        Hop receivedHop1 = receivedAddress.getExplicitLocatorPath().getHop().get(0);
-        Hop receivedHop2 = receivedAddress.getExplicitLocatorPath().getHop().get(1);
+        Hop receivedHop1 = (Hop) receivedAddress.getExplicitLocatorPath().getHop().get(0);
+        Hop receivedHop2 = (Hop) receivedAddress.getExplicitLocatorPath().getHop().get(1);
 
         assertEquals(true, receivedHop1.getLrsBits().isLookup());
         assertEquals(false, receivedHop1.getLrsBits().isRlocProbe());
@@ -1471,6 +1491,8 @@ public class MappingServiceIntegrationTest extends AbstractMdsalTestBase {
     public void mapRequestMapRegisterAndMapRequestTestTimeout() throws SocketTimeoutException {
         cleanUP();
         Eid eid = LispAddressUtil.asIpv4PrefixEid("1.2.3.4/32");
+        mapService.addAuthenticationKey(eid, NULL_AUTH_KEY);
+        sleepForSeconds(1);
         MapRequestBuilder mapRequestBuilder = new MapRequestBuilder();
         mapRequestBuilder.setNonce((long) 4);
         mapRequestBuilder.setSourceEid(new SourceEidBuilder().setEid(LispAddressUtil.getNoAddressEid()).build());
@@ -1564,7 +1586,7 @@ public class MappingServiceIntegrationTest extends AbstractMdsalTestBase {
     private void registerForTTL(Eid eid) throws SocketTimeoutException {
         MapRegister mapRegister = createMapRegister(eid);
         sendMapRegister(mapRegister);
-        assertMapNotifyRecieved();
+        assertMapNotifyReceived();
     }
 
     private void testTTLBeforeRegister(MapRequest mapRequest) throws SocketTimeoutException {
@@ -1727,11 +1749,11 @@ public class MappingServiceIntegrationTest extends AbstractMdsalTestBase {
         MapRequest mapRequest = createNonProxyMapRequest(eid, adLcaf);
         sendMapRequest(mapRequest);
         DatagramSocket nonProxySocket = new DatagramSocket(new InetSocketAddress(rloc, port));
-        MapRequest recievedMapRequest = receiveMapRequest(nonProxySocket);
-        assertEquals(mapRequest.getNonce(), recievedMapRequest.getNonce());
-        assertEquals(mapRequest.getSourceEid(), recievedMapRequest.getSourceEid());
-        assertEquals(mapRequest.getItrRloc(), recievedMapRequest.getItrRloc());
-        assertEquals(mapRequest.getEidItem(), recievedMapRequest.getEidItem());
+        MapRequest receivedMapRequest = receiveMapRequest(nonProxySocket);
+        assertEquals(mapRequest.getNonce(), receivedMapRequest.getNonce());
+        assertEquals(mapRequest.getSourceEid(), receivedMapRequest.getSourceEid());
+        assertEquals(mapRequest.getItrRloc(), receivedMapRequest.getItrRloc());
+        assertEquals(mapRequest.getEidItem(), receivedMapRequest.getEidItem());
         nonProxySocket.close();
     }
 
@@ -1741,7 +1763,7 @@ public class MappingServiceIntegrationTest extends AbstractMdsalTestBase {
                 .getLocatorRecord().get(0)).setRloc(adLcaf).build();
         mr.getMappingRecordItem().get(0).getMappingRecord().getLocatorRecord().set(0, record);
         sendMapRegister(mr);
-        assertMapNotifyRecieved();
+        assertMapNotifyReceived();
         MapRequest mapRequest = createMapRequest(LispAddressUtil.asIpv4PrefixEid(eid));
         MapRequestBuilder builder = new MapRequestBuilder(mapRequest);
         builder.setPitr(true);
@@ -1749,7 +1771,7 @@ public class MappingServiceIntegrationTest extends AbstractMdsalTestBase {
         return mapRequest;
     }
 
-    private void assertMapNotifyRecieved() throws SocketTimeoutException {
+    private void assertMapNotifyReceived() throws SocketTimeoutException {
         receiveMapNotify();
     }
 
@@ -1807,7 +1829,7 @@ public class MappingServiceIntegrationTest extends AbstractMdsalTestBase {
             LOG.trace("Waiting for packet from socket...");
             receivedSocket.setSoTimeout(timeout);
             receivedSocket.receive(receivePacket);
-            LOG.trace("Recieved packet from socket!");
+            LOG.trace("Received packet from socket!");
             return receivePacket;
         } catch (SocketTimeoutException ste) {
             throw ste;
@@ -1817,13 +1839,11 @@ public class MappingServiceIntegrationTest extends AbstractMdsalTestBase {
         }
     }
 
-
     private void sleepForSeconds(int seconds) {
         try {
             Thread.sleep(seconds*1000);
         } catch (InterruptedException e) {
-            LOG.warn("Interrupted while sleeping");
-            e.printStackTrace();
+            LOG.warn("Interrupted while sleeping", e);
         }
     }
 
@@ -1876,10 +1896,7 @@ public class MappingServiceIntegrationTest extends AbstractMdsalTestBase {
     }
 
     private void areWeReady() throws InvalidSyntaxException {
-        try {
-            Thread.sleep(5000);
-        } catch (InterruptedException e) {
-        }
+        sleepForSeconds(5);
 
         assertNotNull(bc);
         boolean debugit = false;
@@ -1927,10 +1944,7 @@ public class MappingServiceIntegrationTest extends AbstractMdsalTestBase {
         }
         */
 
-        try {
-            Thread.sleep(1000);
-        } catch (InterruptedException e) {
-        }
+        sleepForSeconds(1);
     }
 
     private void cleanUP() {
index 6764152ea8c8aa7baf526faa1118188b9810e161..3b3233e26fcda5371ef921d1aa3ab38d31b0923e 100644 (file)
@@ -239,7 +239,7 @@ public class MappingSystem implements IMappingSystem {
 
     @Override
     public void addAuthenticationKey(Eid key, MappingAuthkey authKey) {
-        LOG.debug("Adding authentication key '{}' for {}", authKey.getKeyString(),
+        LOG.debug("Adding authentication key '{}' with key-ID {} for {}", authKey.getKeyString(), authKey.getKeyType(),
                 LispAddressStringifier.getString(key));
         smc.addAuthenticationKey(key, authKey);
     }
index d7244016dcee2a566ecc312f761b59a42945ebeb..22a7aad6fe859281966d53ed061c18d72e34dad1 100644 (file)
@@ -8,24 +8,41 @@
 package org.opendaylight.lispflowmapping.implementation.authentication;
 
 import org.opendaylight.lispflowmapping.interfaces.lisp.ILispAuthentication;
+import org.opendaylight.lispflowmapping.lisp.util.LispAddressStringifier;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapNotify;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapRegister;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.mapping.authkey.container.MappingAuthkey;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public final class LispAuthenticationUtil {
+    protected static final Logger LOG = LoggerFactory.getLogger(LispAuthenticationUtil.class);
+
     // Utility class, should not be instantiated
     private LispAuthenticationUtil() {
     }
 
-    public static boolean validate(MapRegister mapRegister, String key) {
+    public static boolean validate(MapRegister mapRegister, Eid eid, MappingAuthkey key) {
+        if (key == null) {
+            LOG.warn("Authentication failed: mapping authentication key is null");
+            return false;
+        }
         short keyId = 0;
         if (mapRegister.getKeyId() != null) {
             keyId = mapRegister.getKeyId();
         }
+        if (keyId != key.getKeyType().shortValue()) {
+            LOG.warn("Authentication failed: key-ID in Map-Register is different from the one on file for {}",
+                    LispAddressStringifier.getString(eid));
+            return false;
+        }
         ILispAuthentication authentication = LispAuthenticationFactory.getAuthentication(LispKeyIDEnum.valueOf(keyId));
-        return authentication.validate(mapRegister, key);
+        return authentication.validate(mapRegister, key.getKeyString());
     }
 
     public static byte[] createAuthenticationData(MapNotify mapNotify, String key) {
+        // We assume that the key-ID is correctly set in the Map-Notify message
         ILispAuthentication authentication = LispAuthenticationFactory.getAuthentication(LispKeyIDEnum.valueOf(mapNotify.getKeyId()));
         return authentication.getAuthenticationData(mapNotify, key);
     }
index ed92ec9aa792dd0f18971b295fff971cd8b022cd..592d46719b37baf2988953bd683ed50fc7d6fa03 100644 (file)
@@ -43,7 +43,7 @@ public class LispMACAuthentication implements ILispAuthentication {
 
     public boolean validate(MapRegister mapRegister, String key) {
         if (key == null) {
-            LOG.warn("The authentication key is null!");
+            LOG.warn("Authentication failed: mapping authentication password is null!");
             return false;
         }
         ByteBuffer mapRegisterBuffer = MapRegisterSerializer.getInstance().serialize(mapRegister);
index 200cd691a24814fad1f4456b0899b66feb10e587..45c61431777a09127c106999e38c43ed3caba8d5 100644 (file)
@@ -101,19 +101,15 @@ public class MapServer implements IMapServerAsync, OdlMappingserviceListener {
     public void handleMapRegister(MapRegister mapRegister) {
         boolean authFailed = false;
         boolean mappingUpdated = false;
-        String password = null;
+        MappingAuthkey authkey = null;
         Set<SubscriberRLOC> subscribers = null;
         MappingRecord oldMapping;
 
         for (MappingRecordItem record : mapRegister.getMappingRecordItem()) {
             MappingRecord mapping = record.getMappingRecord();
             if (authenticate) {
-                MappingAuthkey authkey = mapService.getAuthenticationKey(mapping.getEid());
-                if (authkey != null) {
-                    password = authkey.getKeyString();
-                }
-                if (!LispAuthenticationUtil.validate(mapRegister, password)) {
-                    LOG.warn("Authentication failed");
+                authkey = mapService.getAuthenticationKey(mapping.getEid());
+                if (!LispAuthenticationUtil.validate(mapRegister, mapping.getEid(), authkey)) {
                     authFailed = true;
                     break;
                 }
@@ -165,7 +161,7 @@ public class MapServer implements IMapServerAsync, OdlMappingserviceListener {
             }
             if (authenticate) {
                 builder.setAuthenticationData(LispAuthenticationUtil.createAuthenticationData(builder.build(),
-                        password));
+                        authkey.getKeyString()));
             }
             notifyHandler.handleMapNotify(builder.build(), rlocs);
         }
index 4304809d39b332d70488f39b7fc95a0f9b885c34..cff40c8abb29f881378ffade5d98e5f69dfd04d0 100644 (file)
@@ -25,6 +25,8 @@ import org.opendaylight.lispflowmapping.interfaces.dao.SubKeys;
 import org.opendaylight.lispflowmapping.interfaces.mapcache.IMapCache;
 import org.opendaylight.lispflowmapping.lisp.util.MaskUtil;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpAddress;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv4Prefix;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv6Prefix;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.XtrId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.record.container.MappingRecord;
@@ -334,7 +336,7 @@ public class SimpleMapCache implements IMapCache {
         if (table == null) {
             return null;
         }
-        if (MaskUtil.isMaskable(eid.getAddress())) {
+        if (eid.getAddress() instanceof Ipv4Prefix || eid.getAddress() instanceof Ipv6Prefix) {
             return getAuthKeyLpm(eid, table);
         } else {
             Eid key = MaskUtil.normalize(eid);
index 9662400a0cd5593952f8422ba396767693f7aeb5..cd76b96dbb9690093f0eac4b887c440892b60b36 100644 (file)
@@ -19,13 +19,21 @@ import org.opendaylight.lispflowmapping.lisp.util.LispAddressUtil;
 import org.opendaylight.lispflowmapping.lisp.serializer.MapRegisterSerializer;
 import org.opendaylight.lispflowmapping.tools.junit.BaseTestCase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapRegister;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.locatorrecords.LocatorRecord;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapnotifymessage.MapNotifyBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.record.container.MappingRecordBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.record.list.MappingRecordItem;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.record.list.MappingRecordItemBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.mapping.authkey.container.MappingAuthkey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.mapping.authkey.container.MappingAuthkeyBuilder;
 
 public class LispAuthenticationTest extends BaseTestCase {
+    private static final MappingAuthkey PASSWORD =
+            new MappingAuthkeyBuilder().setKeyType(1).setKeyString("password").build();
+    private static final MappingAuthkey WRONG_PASSWORD =
+            new MappingAuthkeyBuilder().setKeyType(1).setKeyString("wrongPassword").build();
+    private static final Eid EID = LispAddressUtil.asIpv4PrefixEid("153.16.254.1/32");
 
     @Test
     public void validate_WrongAuthentication() throws Exception {
@@ -46,7 +54,7 @@ public class LispAuthenticationTest extends BaseTestCase {
                 + "00 0a 01 20 10 00 00 00 00 01 99 10 fe 01 01 64 " //
                 + "ff 00 00 05 00 01 c0 a8 88 0a"), null);
 
-        assertFalse(LispAuthenticationUtil.validate(mapRegister, "password"));
+        assertFalse(LispAuthenticationUtil.validate(mapRegister, EID, PASSWORD));
     }
 
     @Test
@@ -67,8 +75,8 @@ public class LispAuthenticationTest extends BaseTestCase {
                 + "00 0a 01 20 10 00 00 00 00 01 99 10 fe 01 01 64 " //
                 + "ff 00 00 05 00 01 c0 a8 88 0a"), null);
 
-        assertTrue(LispAuthenticationUtil.validate(mapRegister, "password"));
-        assertFalse(LispAuthenticationUtil.validate(mapRegister, "wrongPassword"));
+        assertTrue(LispAuthenticationUtil.validate(mapRegister, EID, PASSWORD));
+        assertFalse(LispAuthenticationUtil.validate(mapRegister, EID, WRONG_PASSWORD));
     }
 
     @Test
@@ -93,8 +101,8 @@ public class LispAuthenticationTest extends BaseTestCase {
                                 + "00 0a 01 20 10 00 00 00 00 01 99 10 fe 01 01 64 " //
                                 + "ff 00 00 05 00 01 c0 a8 88 0a"), null);
 
-        assertTrue(LispAuthenticationUtil.validate(mapRegister, "password"));
-        assertFalse(LispAuthenticationUtil.validate(mapRegister, "wrongPassword"));
+        assertTrue(LispAuthenticationUtil.validate(mapRegister, EID, PASSWORD));
+        assertFalse(LispAuthenticationUtil.validate(mapRegister, EID, WRONG_PASSWORD));
     }
 
     @Test
@@ -115,8 +123,8 @@ public class LispAuthenticationTest extends BaseTestCase {
                 + "00 0a 01 20 10 00 00 00 00 01 99 10 fe 01 01 64 " //
                 + "ff 00 00 05 00 01 c0 a8 88 0a"), null);
 
-        assertTrue(LispAuthenticationUtil.validate(mapRegister, "password"));
-        assertTrue(LispAuthenticationUtil.validate(mapRegister, "wrongPassword"));
+        assertTrue(LispAuthenticationUtil.validate(mapRegister, EID, PASSWORD));
+        assertTrue(LispAuthenticationUtil.validate(mapRegister, EID, WRONG_PASSWORD));
     }
 
     // @Test