View Javadoc
1   package com.randomnoun.common.security;
2   
3   /* (c) 2013 randomnoun. All Rights Reserved. This work is licensed under a
4    * BSD Simplified License. (http://www.randomnoun.com/bsd-simplified.html)
5    */
6   
7   import java.io.IOException;
8   import java.util.*;
9   
10  import com.randomnoun.common.security.User;
11  
12  
13  
14  /** Security authenticator object.
15   *
16   * <p>Just the authentication, none of the authorisation.
17   *
18   * 
19   * @author knoxg
20   */
21  public interface SecurityAuthenticator
22  {
23      /**
24       * Initialise this security loader. This method will be invoked by the SecurityContext
25       * object on initialisation
26       *
27       * @param properties Initialisation properties for this loader.
28       */
29      public void initialise(Map<String, Object> properties);
30  
31      /**
32       * Returns true if the supplied password authenticates the supplied user,
33       * false otherwise.
34       *
35       * @param username The username to authenticate
36       * @param password The password used to authenticate the user
37       *
38       * @return true if the username/password combination is valid.
39       * @throws IOException
40       */
41      public boolean authenticate(User user, String password)
42          throws IOException;
43       
44  }