1 /**
2 * Copyright 2005-2006 the original author or authors.
3 *
4 * Licensed under the Gnu General Pubic License, Version 2.0 (the
5 * "License"); you may not use this file except in compliance with
6 * the License. You may obtain a copy of the License at
7 *
8 * http://www.opensource.org/licenses/gpl-license.php
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 * See the Gnu General Public License for more details.
14 */
15 package org.figure8.join.services.security;
16
17 /**
18 * This interface allows Join system deployer to provide their own password
19 * encoding and validation methods for the Join application.
20 * @author <a href="mailto:laurent.broudoux@free.fr">Laurent Broudoux</a>
21 * @version $Revision: 1.2 $
22 */
23 public interface PasswordEncoder{
24
25
26
27 /**
28 * A hook that allows implementation to provide custom password
29 * encoding method using a set of arguments.
30 * @param userId The user identifier
31 * @param clearPassword The non encoded password of the user
32 * @param arguments Arguments for encoding process
33 * @return the encoded password.
34 */
35 public abstract String encodePassword(String userId, String clearPassword, Object[] arguments);
36
37 /**
38 * A hook that allows implementation to change the validation of the input
39 * password against the expected password.
40 * @param userId The user identifier
41 * @param inputPassword The password provided by the user
42 * @param expectedPassword The real user's pasword
43 * @return true if the inputPassword is valid, false otherwise.
44 */
45 public abstract boolean validatePassword(String userId, String inputPassword, String expectedPassword);
46 }