1 |
8465
|
tao
|
/**
|
2 |
|
|
* '$RCSfile$'
|
3 |
|
|
* Copyright: 2013 Regents of the University of California and the
|
4 |
|
|
* National Center for Ecological Analysis and Synthesis
|
5 |
|
|
*
|
6 |
|
|
*
|
7 |
|
|
* This program is free software; you can redistribute it and/or modify
|
8 |
|
|
* it under the terms of the GNU General Public License as published by
|
9 |
|
|
* the Free Software Foundation; either version 2 of the License, or
|
10 |
|
|
* (at your option) any later version.
|
11 |
|
|
*
|
12 |
|
|
* This program is distributed in the hope that it will be useful,
|
13 |
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14 |
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15 |
|
|
* GNU General Public License for more details.
|
16 |
|
|
*
|
17 |
|
|
* You should have received a copy of the GNU General Public License
|
18 |
|
|
* along with this program; if not, write to the Free Software
|
19 |
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
20 |
|
|
*/
|
21 |
|
|
package edu.ucsb.nceas.metacat.authentication;
|
22 |
|
|
|
23 |
|
|
/**
|
24 |
|
|
* This an interface for different hash algorithms using to protect users' password
|
25 |
|
|
* in the username/password file
|
26 |
|
|
* @author tao
|
27 |
|
|
*
|
28 |
|
|
*/
|
29 |
|
|
public interface AuthFileHashInterface {
|
30 |
|
|
|
31 |
|
|
/**
|
32 |
|
|
* Check if the plain password matches the hashed password. Return true if they match;
|
33 |
|
|
* false otherwise.
|
34 |
|
|
* @param plain the plain password
|
35 |
|
|
* @param hashed the hashed password
|
36 |
|
|
* @return true if they match
|
37 |
|
|
* @throws Exception
|
38 |
|
|
*/
|
39 |
|
|
public boolean match(String plain, String hashed) throws Exception;
|
40 |
|
|
|
41 |
|
|
|
42 |
|
|
/**
|
43 |
|
|
* Generate the hash value for a specified plaint password
|
44 |
|
|
* @param plain the plain password
|
45 |
|
|
* @return the hash value of the password
|
46 |
|
|
*/
|
47 |
|
|
public String hash(String plain);
|
48 |
|
|
}
|