2 * Copyright (c) 2014 Contextream, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.lispflowmapping.implementation.authentication;
10 import java.util.HashMap;
13 import org.opendaylight.lispflowmapping.interfaces.lisp.ILispAuthentication;
15 public final class LispAuthenticationFactory {
17 private static Map<LispKeyIDEnum, ILispAuthentication> keyIDToAuthenticationMap;
19 // Class should not be instantiated
20 private LispAuthenticationFactory() {
23 private static void initializeMap() {
24 keyIDToAuthenticationMap = new HashMap<LispKeyIDEnum, ILispAuthentication>();
25 keyIDToAuthenticationMap.put(LispKeyIDEnum.NONE, LispNoAuthentication.getInstance());
26 keyIDToAuthenticationMap.put(LispKeyIDEnum.SHA1,
27 new LispMACAuthentication(LispKeyIDEnum.SHA1.getAuthenticationName()));
28 keyIDToAuthenticationMap.put(LispKeyIDEnum.SHA256,
29 new LispMACAuthentication(LispKeyIDEnum.SHA256.getAuthenticationName()));
30 keyIDToAuthenticationMap.put(LispKeyIDEnum.UNKNOWN, LispNoAuthentication.getInstance());
34 public static ILispAuthentication getAuthentication(LispKeyIDEnum keyID) {
35 if (keyIDToAuthenticationMap == null) {
38 return keyIDToAuthenticationMap.get(keyID);