X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fnetconf%2Fnetconf-ssh%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fnetconf%2Fssh%2Fauthentication%2FAuthProvider.java;h=92f3861c05351cacf9b93dd38d6771a58141fb9a;hp=2e9a0b9d8bbd256154ff82689e85e556b60c9e90;hb=63b36aa3537d77bd9be323e1113716ef2cd54098;hpb=566366999b698db162e61b034750e798f133b2ac diff --git a/opendaylight/netconf/netconf-ssh/src/main/java/org/opendaylight/controller/netconf/ssh/authentication/AuthProvider.java b/opendaylight/netconf/netconf-ssh/src/main/java/org/opendaylight/controller/netconf/ssh/authentication/AuthProvider.java index 2e9a0b9d8b..92f3861c05 100644 --- a/opendaylight/netconf/netconf-ssh/src/main/java/org/opendaylight/controller/netconf/ssh/authentication/AuthProvider.java +++ b/opendaylight/netconf/netconf-ssh/src/main/java/org/opendaylight/controller/netconf/ssh/authentication/AuthProvider.java @@ -1,47 +1,16 @@ /* - * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. + * Copyright (c) 2014 Cisco Systems, 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.controller.netconf.ssh.authentication; - -import java.io.IOException; -import org.opendaylight.controller.sal.authorization.AuthResultEnum; -import org.opendaylight.controller.usermanager.IUserManager; -import static com.google.common.base.Preconditions.checkNotNull; - -public class AuthProvider implements AuthProviderInterface { - private IUserManager um; - private final String pem; - - public AuthProvider(IUserManager ium, String pemCertificate) throws IllegalArgumentException, IOException { - checkNotNull(pemCertificate, "Parameter 'pemCertificate' is null"); - checkNotNull(ium, "No user manager service available."); - this.um = ium; - pem = pemCertificate; - } - - @Override - public boolean authenticated(String username, String password) { - AuthResultEnum authResult = this.um.authenticate(username, password); - return authResult.equals(AuthResultEnum.AUTH_ACCEPT) || authResult.equals(AuthResultEnum.AUTH_ACCEPT_LOC); - } +package org.opendaylight.controller.netconf.ssh.authentication; - @Override - public char[] getPEMAsCharArray() { - return pem.toCharArray(); - } +public interface AuthProvider { - @Override - public void removeUserManagerService() { - this.um = null; - } + boolean authenticated(String username, String password); - @Override - public void addUserManagerService(IUserManager userManagerService) { - this.um = userManagerService; - } + char[] getPEMAsCharArray(); }