org.eaglei.repository.admin
Class AuthUser

java.lang.Object
  extended by org.eaglei.repository.admin.AuthUser

public class AuthUser
extends java.lang.Object

Simple lightweight class to manage RDBMS authorization system users for the purpose of importing and exporting auth. users. XXX this should eventually be folded into or merged with the AuthAdminBean but that code was too monolithic to give these functions.

Author:
Larry Stone Started June 24 2010

Method Summary
static void abortTransaction(java.sql.Connection c)
          Hook to rollback and close the current transaction.
static void commitTransaction(java.sql.Connection c)
          Hook to commit and close the current transaction.
static void create(java.sql.Connection c, java.lang.String ausername, java.lang.String apassword, boolean aisSuperuser)
          Create a new auth user in the DB with indicated username, password, and superuser status.
static AuthUser find(java.lang.String targetUsername)
          Get the auth-db description of the indicated user, if present.
static java.util.Map<java.lang.String,AuthUser> findAllAsMap()
          Get a Map of each username key to AuthUser object.
static java.util.Set<java.lang.String> getAllUsernames()
          Get all username keys in the DB.
 java.lang.String getPassword()
           
 java.lang.String getUsername()
          Getters
 boolean isSuperuser()
           
 void setIsSuperuser(boolean su)
           
 void setPassword(java.lang.String pw)
           
static java.sql.Connection startTransaction()
          Hook to create a connection to manage one transaction.
 void update()
          Update auth DB entries if any values have changed.
 void update(java.sql.Connection c)
          Update auth DB entries if any values have changed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

find

public static AuthUser find(java.lang.String targetUsername)
                     throws javax.naming.NamingException,
                            java.sql.SQLException
Get the auth-db description of the indicated user, if present. Returns a new AuthUser object or null if not found.

Throws:
javax.naming.NamingException
java.sql.SQLException

findAllAsMap

public static java.util.Map<java.lang.String,AuthUser> findAllAsMap()
                                                             throws javax.naming.NamingException,
                                                                    java.sql.SQLException
Get a Map of each username key to AuthUser object.

Throws:
javax.naming.NamingException
java.sql.SQLException

getAllUsernames

public static java.util.Set<java.lang.String> getAllUsernames()
                                                       throws javax.naming.NamingException,
                                                              java.sql.SQLException
Get all username keys in the DB.

Throws:
javax.naming.NamingException
java.sql.SQLException

startTransaction

public static java.sql.Connection startTransaction()
                                            throws javax.naming.NamingException,
                                                   java.sql.SQLException
Hook to create a connection to manage one transaction.

Throws:
javax.naming.NamingException
java.sql.SQLException

commitTransaction

public static void commitTransaction(java.sql.Connection c)
                              throws javax.naming.NamingException,
                                     java.sql.SQLException
Hook to commit and close the current transaction.

Throws:
javax.naming.NamingException
java.sql.SQLException

abortTransaction

public static void abortTransaction(java.sql.Connection c)
                             throws javax.naming.NamingException,
                                    java.sql.SQLException
Hook to rollback and close the current transaction.

Throws:
javax.naming.NamingException
java.sql.SQLException

create

public static void create(java.sql.Connection c,
                          java.lang.String ausername,
                          java.lang.String apassword,
                          boolean aisSuperuser)
                   throws javax.naming.NamingException,
                          java.sql.SQLException
Create a new auth user in the DB with indicated username, password, and superuser status. Always add a role of "authenticated", since the web container security has to see *some* role to recognize the user.

Throws:
javax.naming.NamingException
java.sql.SQLException

update

public void update()
            throws javax.naming.NamingException,
                   java.sql.SQLException
Update auth DB entries if any values have changed. This version creates its own transaction.

Throws:
javax.naming.NamingException
java.sql.SQLException

update

public void update(java.sql.Connection c)
            throws javax.naming.NamingException,
                   java.sql.SQLException
Update auth DB entries if any values have changed. Pass in a DB connection so it can share an external transaction with other operations - create and update.

Throws:
javax.naming.NamingException
java.sql.SQLException

getUsername

public java.lang.String getUsername()
Getters


getPassword

public java.lang.String getPassword()

isSuperuser

public boolean isSuperuser()

setPassword

public void setPassword(java.lang.String pw)

setIsSuperuser

public void setIsSuperuser(boolean su)


Copyright © 2009-2010 Eagle-I. All Rights Reserved.