001package com.randomnoun.common.security;
002
003/* (c) 2013 randomnoun. All Rights Reserved. This work is licensed under a
004 * BSD Simplified License. (http://www.randomnoun.com/bsd-simplified.html)
005 */
006
007import java.io.IOException;
008import java.util.*;
009
010import com.randomnoun.common.security.User;
011
012
013
014/** Security authenticator object.
015 *
016 * <p>Just the authentication, none of the authorisation.
017 *
018 * 
019 * @author knoxg
020 */
021public interface SecurityAuthenticator
022{
023    /**
024     * Initialise this security loader. This method will be invoked by the SecurityContext
025     * object on initialisation
026     *
027     * @param properties Initialisation properties for this loader.
028     */
029    public void initialise(Map<String, Object> properties);
030
031    /**
032     * Returns true if the supplied password authenticates the supplied user,
033     * false otherwise.
034     *
035     * @param username The username to authenticate
036     * @param password The password used to authenticate the user
037     *
038     * @return true if the username/password combination is valid.
039     * @throws IOException
040     */
041    public boolean authenticate(User user, String password)
042        throws IOException;
043     
044}