play.modules.fileauth
Class FileAuth

java.lang.Object
  extended by play.modules.fileauth.FileAuth

public class FileAuth
extends java.lang.Object

Basic Wrapper for all FileAuth Functions.


Field Summary
static java.lang.String AUTH_FILE_GROUPS_CACHE_KEY
           
static java.lang.String AUTH_FILE_USERS_CACHE_KEY
           
static boolean IS_ENABLED
           
 
Constructor Summary
FileAuth()
           
 
Method Summary
static boolean contains(java.lang.String group, java.lang.String user)
          Checks if a group contains a given username.
static java.util.Map<java.lang.String,java.util.Set<java.lang.String>> getGroups()
          Returns a Map of all Groups (groups/usernames).
static java.util.Map<java.lang.String,java.lang.String> getUsers()
          Returns a Map of all Users (user/password hash).
static java.util.Map<java.lang.String,java.util.Set<java.lang.String>> scanGroups()
          Rescans the groups file.
static java.util.Map<java.lang.String,java.lang.String> scanUsers()
          Rescans the users file.
static boolean validate(java.lang.String user, java.lang.String password)
          Validates an user with a given password agains the user/password hash mapping.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

AUTH_FILE_USERS_CACHE_KEY

public static final java.lang.String AUTH_FILE_USERS_CACHE_KEY
See Also:
Constant Field Values

IS_ENABLED

public static final boolean IS_ENABLED

AUTH_FILE_GROUPS_CACHE_KEY

public static final java.lang.String AUTH_FILE_GROUPS_CACHE_KEY
See Also:
Constant Field Values
Constructor Detail

FileAuth

public FileAuth()
Method Detail

getUsers

public static java.util.Map<java.lang.String,java.lang.String> getUsers()
Returns a Map of all Users (user/password hash).

Returns:
the Map.

getGroups

public static java.util.Map<java.lang.String,java.util.Set<java.lang.String>> getGroups()
Returns a Map of all Groups (groups/usernames).

Returns:
the Map.

contains

public static boolean contains(java.lang.String group,
                               java.lang.String user)
Checks if a group contains a given username.

Parameters:
group - the Group to check.
user - the user to check.
Returns:
true if user is in group, otherwise false.

validate

public static boolean validate(java.lang.String user,
                               java.lang.String password)
Validates an user with a given password agains the user/password hash mapping.

Parameters:
user - the given user.
password - the given password (clear text).
Returns:
true if validation okay, otherwise false.

scanUsers

public static java.util.Map<java.lang.String,java.lang.String> scanUsers()
Rescans the users file.

Returns:
the updated Map of users.

scanGroups

public static java.util.Map<java.lang.String,java.util.Set<java.lang.String>> scanGroups()
Rescans the groups file.

Returns:
the updated Map of groups.