org.objectweb.cjdbc.controller.authentication
Class AuthenticationManager

java.lang.Object
  extended byorg.objectweb.cjdbc.controller.authentication.AuthenticationManager

public class AuthenticationManager
extends java.lang.Object

The AuthenticationManager manages the mapping between virtual login/password (to the VirtualDatabase) and the real login/password for each backend.

Version:
1.0
Author:
Emmanuel Cecchet , Mathieu Peltier , Nicolas Modrzyk

Field Summary
private  java.util.ArrayList adminUsers
          ArrayList of AdminUser objects.
private  java.util.HashMap realLogins
          HashMap of HashMap of DatabaseBackendUser objects hashed by the backend name, hashed by their virtual database login.
private  java.util.ArrayList virtualLogins
          ArrayList of VirtualDatabaseUser objects.
 
Constructor Summary
AuthenticationManager()
          Creates a new AuthenticationManager instance.
 
Method Summary
 void addAdminUser(AdminUser user)
          Add an admin user for this authentication manager.
 void addRealUser(java.lang.String vLogin, DatabaseBackendUser rUser)
          Associates a new database backend user to a virtual database login.
 void addVirtualUser(VirtualDatabaseUser vUser)
          Registers a new virtual database user.
 java.util.ArrayList getAdminUsers()
           
 DatabaseBackendUser getDatabaseBackendUser(java.lang.String vLogin, java.lang.String backendName)
          Gets the DatabaseBackendUser given a virtual database login and a database backend logical name.
 java.util.HashMap getRealLogins()
           
 java.util.ArrayList getVirtualLogins()
           
 java.lang.String getXml()
          Format to xml
 boolean isValidAdminUser(AdminUser user)
          Checks whether this administrator user has been registered to this AuthenticationManager or not.
 boolean isValidVirtualLogin(java.lang.String vLogin)
          Checks whether a given virtual login has been registered to this AuthenticationManager or not.
 boolean isValidVirtualUser(VirtualDatabaseUser vUser)
          Checks whether a given virtual database user has been registered to this AuthenticationManager or not.
 boolean removeAdminUser(AdminUser user)
          Remove an admin user from the admin list
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

virtualLogins

private java.util.ArrayList virtualLogins
ArrayList of VirtualDatabaseUser objects.


adminUsers

private java.util.ArrayList adminUsers
ArrayList of AdminUser objects.


realLogins

private java.util.HashMap realLogins
HashMap of HashMap of DatabaseBackendUser objects hashed by the backend name, hashed by their virtual database login. A virtual user can have several real logins, but has only one real login for a given backend.

Constructor Detail

AuthenticationManager

public AuthenticationManager()
Creates a new AuthenticationManager instance.

Method Detail

isValidAdminUser

public boolean isValidAdminUser(AdminUser user)
Checks whether this administrator user has been registered to this AuthenticationManager or not. Returns false if no admin user has been set.

Parameters:
user - administrator user login/password to check.
Returns:
true if it matches the registered admin user.

isValidVirtualUser

public boolean isValidVirtualUser(VirtualDatabaseUser vUser)
Checks whether a given virtual database user has been registered to this AuthenticationManager or not.

Parameters:
vUser - the virtual database user.
Returns:
true if the user login/password is valid.

isValidVirtualLogin

public boolean isValidVirtualLogin(java.lang.String vLogin)
Checks whether a given virtual login has been registered to this AuthenticationManager or not.

Parameters:
vLogin - the virtual database login.
Returns:
true if the virtual database login is valid.

addVirtualUser

public void addVirtualUser(VirtualDatabaseUser vUser)
Registers a new virtual database user.

Parameters:
vUser - the VirtualDatabaseUser to register.

addRealUser

public void addRealUser(java.lang.String vLogin,
                        DatabaseBackendUser rUser)
                 throws AuthenticationManagerException
Associates a new database backend user to a virtual database login.

Parameters:
vLogin - the virtual database login.
rUser - the database backend user to add.
Throws:
AuthenticationManagerException - if a real user already exists for this backend.

getDatabaseBackendUser

public DatabaseBackendUser getDatabaseBackendUser(java.lang.String vLogin,
                                                  java.lang.String backendName)
Gets the DatabaseBackendUser given a virtual database login and a database backend logical name.

Parameters:
vLogin - virtual database login.
backendName - database backend logical name.
Returns:
a DatabaseBackendUser value or null if not found.

getRealLogins

public java.util.HashMap getRealLogins()
Returns:
Returns the realLogins.

getVirtualLogins

public java.util.ArrayList getVirtualLogins()
Returns:
Returns the virtualLogins.

getXml

public java.lang.String getXml()
Format to xml

Returns:
xml formatted representation

addAdminUser

public void addAdminUser(AdminUser user)
Add an admin user for this authentication manager.

Parameters:
user - the AdminUser to add to this AuthenticationManager

removeAdminUser

public boolean removeAdminUser(AdminUser user)
Remove an admin user from the admin list

Parameters:
user - the admin to remove
Returns:
true if was removed.

getAdminUsers

public java.util.ArrayList getAdminUsers()
Returns:
Returns the adminUsers.


Copyright © 2002, 2005 - ObjectWeb Consortium - All Rights Reserved.