SimpleUserHandler (RabbIT/4)
Date: 2009-12-20

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## rabbit.util
Class SimpleUserHandler

    java.lang.Object
      rabbit.util.SimpleUserHandler

    public class SimpleUserHandler

extends Object

This is a class that handles users authentication using a simple text file.

Author:
  Robert Olofsson

Constructor Summary
`SimpleUserHandler()`

Method Summary
`Map<String,String>` | `getUsers()` Return the hash of users.
`boolean` | `isValidUser(String username, String password)` Check if a user/password combination is valid.
`Map<String,String>` | `loadUsers(Reader r)` Load the users from the given Reader.
`void` | `saveUsers(Reader r)` Saves the users from the given Reader.
`void` | `setFile(String userFile)` Set the file to use for users, will read the files.
`void` | `setUsers(Map<String,String> users)` Return the hash of users.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### SimpleUserHandler

    public SimpleUserHandler()

Method Detail

### setFile

    public void setFile(String userFile)

  Set the file to use for users, will read the files. Will discard any previous loaded users.

  Parameters:
    `userFile` - the filename to read the users from.

### loadUsers

    public Map<String,String> loadUsers(Reader r)
                                 throws IOException

  Load the users from the given Reader.

  Parameters:
    `r` - the Reader with the users.
  Throws:
    `IOException`

### saveUsers

    public void saveUsers(Reader r)
                   throws IOException

  Saves the users from the given Reader.

  Parameters:
    `r` - the Reader with the users.
  Throws:
    `IOException`

### getUsers

    public Map<String,String> getUsers()

  Return the hash of users.

### setUsers

    public void setUsers(Map<String,String> users)

  Return the hash of users.

### isValidUser

    public boolean isValidUser(String username,
                               String password)

  Check if a user/password combination is valid.

  Parameters:
    `username` - the username.
    `password` - the decrypted password.
  Returns:
    true if both username and password match a valid user.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD