ccc.security
Interface Database

All Known Implementing Classes:
JdbcDatabase

public interface Database

Database API used for authentication.

Author:
Civic Computing Ltd.

Method Summary
 java.util.Set<java.lang.String> lookupPerms(java.lang.String userId)
          Look up a user's permissions from the DB.
 java.lang.Object[] lookupUser(Username username)
          Lookup details of a user from the DB.
 void setOptions(java.util.Map<java.lang.String,?> options)
          Specify the options for the database.
 

Method Detail

lookupUser

java.lang.Object[] lookupUser(Username username)
                              throws java.sql.SQLException
Lookup details of a user from the DB. Details are returned in object array with the following structure:
[0] user id, as a string
[1] hashed password, as a byte array
[2] password salt, as a string

Parameters:
username - The username representing the user to look up.
Returns:
The user data as an object array; NULL if no valid user is found.
Throws:
java.sql.SQLException - If an error occurs while communicating with the DB.

lookupPerms

java.util.Set<java.lang.String> lookupPerms(java.lang.String userId)
                                            throws java.sql.SQLException
Look up a user's permissions from the DB.

Parameters:
userId - The user id whose permissions we will retrieve.
Returns:
A set of permissions, represented as strings.
Throws:
java.sql.SQLException - If an error occurs while communicating with the DB.

setOptions

void setOptions(java.util.Map<java.lang.String,?> options)
Specify the options for the database.

Parameters:
options - A map of key:value pairs.


Copyright © 2010. All Rights Reserved.