All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.opendaylight.lispflowmapping.lisp.authentication.LispAuthenticationFactory Maven / Gradle / Ivy

There is a newer version: 1.20.1
Show newest version
/*
 * Copyright (c) 2014 Contextream, Inc. and others.  All rights reserved.
 *
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
 * and is available at http://www.eclipse.org/legal/epl-v10.html
 */
package org.opendaylight.lispflowmapping.lisp.authentication;

import java.util.HashMap;
import java.util.Map;

public final class LispAuthenticationFactory {

    private static Map keyIDToAuthenticationMap;

    // Class should not be instantiated
    private LispAuthenticationFactory() {
    }

    private static void initializeMap() {
        keyIDToAuthenticationMap = new HashMap();
        keyIDToAuthenticationMap.put(LispKeyIDEnum.NONE, LispNoAuthentication.getInstance());
        keyIDToAuthenticationMap.put(LispKeyIDEnum.SHA1,
                new LispMACAuthentication(LispKeyIDEnum.SHA1.getAuthenticationName()));
        keyIDToAuthenticationMap.put(LispKeyIDEnum.SHA256,
                new LispMACAuthentication(LispKeyIDEnum.SHA256.getAuthenticationName()));
        keyIDToAuthenticationMap.put(LispKeyIDEnum.UNKNOWN, LispNoAuthentication.getInstance());

    }

    public static ILispAuthentication getAuthentication(LispKeyIDEnum keyID) {
        if (keyIDToAuthenticationMap == null) {
            initializeMap();
        }
        return keyIDToAuthenticationMap.get(keyID);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy