src/core/net/sf/basedb/util/ssl/AllowAnyHostNameVerifyer.java

Code
Comments
Other
Rev Date Author Line
5362 16 Jun 10 nicklas 1 /**
5362 16 Jun 10 nicklas 2   $Id$
5362 16 Jun 10 nicklas 3
5362 16 Jun 10 nicklas 4   Copyright (C) 2010 Nicklas Nordborg
5362 16 Jun 10 nicklas 5
5362 16 Jun 10 nicklas 6   This file is part of BASE - BioArray Software Environment.
5362 16 Jun 10 nicklas 7   Available at http://base.thep.lu.se/
5362 16 Jun 10 nicklas 8
5362 16 Jun 10 nicklas 9   BASE is free software; you can redistribute it and/or
5362 16 Jun 10 nicklas 10   modify it under the terms of the GNU General Public License
5362 16 Jun 10 nicklas 11   as published by the Free Software Foundation; either version 3
5362 16 Jun 10 nicklas 12   of the License, or (at your option) any later version.
5362 16 Jun 10 nicklas 13
5362 16 Jun 10 nicklas 14   BASE is distributed in the hope that it will be useful,
5362 16 Jun 10 nicklas 15   but WITHOUT ANY WARRANTY; without even the implied warranty of
5362 16 Jun 10 nicklas 16   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
5362 16 Jun 10 nicklas 17   GNU General Public License for more details.
5362 16 Jun 10 nicklas 18
5362 16 Jun 10 nicklas 19   You should have received a copy of the GNU General Public License
5362 16 Jun 10 nicklas 20   along with BASE. If not, see <http://www.gnu.org/licenses/>.
5362 16 Jun 10 nicklas 21 */
5362 16 Jun 10 nicklas 22 package net.sf.basedb.util.ssl;
5362 16 Jun 10 nicklas 23
6904 12 May 15 nicklas 24 import javax.net.ssl.HostnameVerifier;
5362 16 Jun 10 nicklas 25 import javax.net.ssl.SSLSession;
5362 16 Jun 10 nicklas 26
5362 16 Jun 10 nicklas 27 import net.sf.basedb.core.FileServer;
5362 16 Jun 10 nicklas 28
5362 16 Jun 10 nicklas 29
5362 16 Jun 10 nicklas 30 /**
5362 16 Jun 10 nicklas 31   A simple implementation of a host name verifyer that allows all hosts.
5362 16 Jun 10 nicklas 32   We use it to make sure that a server certificate that has been registered
5362 16 Jun 10 nicklas 33   with a {@link FileServer} always work even if the server has a different name
5362 16 Jun 10 nicklas 34   than what is in the certificate.
5362 16 Jun 10 nicklas 35   
5362 16 Jun 10 nicklas 36   @author Nicklas
5362 16 Jun 10 nicklas 37   @since 2.16
5362 16 Jun 10 nicklas 38   @base.modified $Date$
5362 16 Jun 10 nicklas 39 */
5362 16 Jun 10 nicklas 40 public class AllowAnyHostNameVerifyer
6904 12 May 15 nicklas 41   implements HostnameVerifier
5362 16 Jun 10 nicklas 42 {
5362 16 Jun 10 nicklas 43
5362 16 Jun 10 nicklas 44   public AllowAnyHostNameVerifyer()
5362 16 Jun 10 nicklas 45   {}
5362 16 Jun 10 nicklas 46
5362 16 Jun 10 nicklas 47   @Override
5362 16 Jun 10 nicklas 48   public boolean verify(String hostname, SSLSession session)
5362 16 Jun 10 nicklas 49   {
5362 16 Jun 10 nicklas 50     return true;
5362 16 Jun 10 nicklas 51   }
5362 16 Jun 10 nicklas 52 }