edu.ucsb.nceas.metacat.util
Class AuthUtil

java.lang.Object
  extended by edu.ucsb.nceas.metacat.util.AuthUtil

public class AuthUtil
extends java.lang.Object


Method Summary
static boolean canInsertOrUpdate(java.lang.String username, java.lang.String[] groups)
          Check if the specified user can insert the document
static java.lang.String createLDAPString(java.lang.String username, java.lang.String organization, java.util.Vector<java.lang.String> dnList)
          Creates an ldap credentail string from the username, organization and dn list.
static java.util.Vector<java.lang.String> getAdministrators()
          Get the administrators from metacat.properties
static java.util.Vector<java.lang.String> getAllowedSubmitters()
          Get the allowed submitters from metacat.properties
static java.util.Vector<java.lang.String> getDeniedSubmitters()
          Get the denied submitters from metacat.properties
static java.lang.String[] getGroupNames(javax.servlet.http.HttpServletRequest request)
          Gets the user group names from the login session on the http request
static java.util.Vector<java.lang.String> getModerators()
          Get the moderators from metacat.properties
static java.lang.String getUserName(javax.servlet.http.HttpServletRequest request)
          Gets the user name from the login session on the http request
static boolean isAdministrator(java.lang.String username, java.lang.String[] groups)
          Check if the specified user is part of the administrators list
static boolean isAllowedSubmitter(java.lang.String username, java.lang.String[] groups)
          Check if the specified user is part of the moderators list
static boolean isAuthConfigured()
          Reports whether LDAP is fully configured.
static boolean isDeniedSubmitter(java.lang.String username, java.lang.String[] groups)
          Check if the specified user is part of the moderators list
static boolean isModerator(java.lang.String username, java.lang.String[] groups)
          Check if the specified user is part of the moderators list
static boolean isUserLoggedIn(javax.servlet.http.HttpServletRequest request)
          Checks to see if the user is logged in by grabbing the session from the request and seeing if it exists in the global session list.
static boolean isUserLoggedInAsAdmin(javax.servlet.http.HttpServletRequest request)
          Checks to see if the user is logged in as admin by first checking if the user is logged in and then seeing if the user's account is on the administrators list in metacat.properties.
static boolean logUserIn(javax.servlet.http.HttpServletRequest request, java.lang.String userName, java.lang.String password)
          log the user in against ldap.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getAdministrators

public static java.util.Vector<java.lang.String> getAdministrators()
                                                            throws MetacatUtilException
Get the administrators from metacat.properties

Returns:
a Vector of Strings holding the administrators
Throws:
MetacatUtilException

getAllowedSubmitters

public static java.util.Vector<java.lang.String> getAllowedSubmitters()
                                                               throws MetacatUtilException
Get the allowed submitters from metacat.properties

Returns:
a Vector of Strings holding the submitters
Throws:
MetacatUtilException

getDeniedSubmitters

public static java.util.Vector<java.lang.String> getDeniedSubmitters()
                                                              throws MetacatUtilException
Get the denied submitters from metacat.properties

Returns:
a Vector of Strings holding the denied submitters
Throws:
MetacatUtilException

getModerators

public static java.util.Vector<java.lang.String> getModerators()
                                                        throws MetacatUtilException
Get the moderators from metacat.properties

Returns:
a Vector of Strings holding the moderators
Throws:
MetacatUtilException

logUserIn

public static boolean logUserIn(javax.servlet.http.HttpServletRequest request,
                                java.lang.String userName,
                                java.lang.String password)
                         throws MetacatUtilException
log the user in against ldap. If the login is successful, add the session information to the session list in SessionUtil.

Parameters:
request - the http request.
Throws:
MetacatUtilException

isUserLoggedIn

public static boolean isUserLoggedIn(javax.servlet.http.HttpServletRequest request)
                              throws MetacatUtilException
Checks to see if the user is logged in by grabbing the session from the request and seeing if it exists in the global session list.

Parameters:
request - the http request that holds the login session
Returns:
boolean that is true if the user is logged in, false otherwise
Throws:
MetacatUtilException

isUserLoggedInAsAdmin

public static boolean isUserLoggedInAsAdmin(javax.servlet.http.HttpServletRequest request)
                                     throws MetacatUtilException
Checks to see if the user is logged in as admin by first checking if the user is logged in and then seeing if the user's account is on the administrators list in metacat.properties.

Parameters:
request - the http request that holds the login session
Returns:
boolean that is true if the user is logged in as admin, false otherwise
Throws:
MetacatUtilException

getUserName

public static java.lang.String getUserName(javax.servlet.http.HttpServletRequest request)
Gets the user name from the login session on the http request

Parameters:
request - the http request that holds the login session
Returns:
String that holds the user name

getGroupNames

public static java.lang.String[] getGroupNames(javax.servlet.http.HttpServletRequest request)
Gets the user group names from the login session on the http request

Parameters:
request - the http request that holds the login session
Returns:
String array that holds the user groups

createLDAPString

public static java.lang.String createLDAPString(java.lang.String username,
                                                java.lang.String organization,
                                                java.util.Vector<java.lang.String> dnList)
                                         throws MetacatUtilException
Creates an ldap credentail string from the username, organization and dn list.

Parameters:
username - the user name
organization - the organization
dnList - a list of dns
Returns:
String holding the ldap login string
Throws:
MetacatUtilException

isAuthConfigured

public static boolean isAuthConfigured()
                                throws MetacatUtilException
Reports whether LDAP is fully configured.

Returns:
a boolean that is true if all sections are configured and false otherwise
Throws:
MetacatUtilException

isAdministrator

public static boolean isAdministrator(java.lang.String username,
                                      java.lang.String[] groups)
                               throws MetacatUtilException
Check if the specified user is part of the administrators list

Parameters:
username - the user login credentails
groups - a list of the user's groups
Throws:
MetacatUtilException

isModerator

public static boolean isModerator(java.lang.String username,
                                  java.lang.String[] groups)
                           throws MetacatUtilException
Check if the specified user is part of the moderators list

Parameters:
username - the user login credentails
groups - a list of the user's groups
Throws:
MetacatUtilException

isAllowedSubmitter

public static boolean isAllowedSubmitter(java.lang.String username,
                                         java.lang.String[] groups)
                                  throws MetacatUtilException
Check if the specified user is part of the moderators list

Parameters:
username - the user login credentails
groups - a list of the user's groups
Throws:
MetacatUtilException

isDeniedSubmitter

public static boolean isDeniedSubmitter(java.lang.String username,
                                        java.lang.String[] groups)
                                 throws MetacatUtilException
Check if the specified user is part of the moderators list

Parameters:
username - the user login credentails
groups - a list of the user's groups
Throws:
MetacatUtilException

canInsertOrUpdate

public static boolean canInsertOrUpdate(java.lang.String username,
                                        java.lang.String[] groups)
                                 throws MetacatUtilException
Check if the specified user can insert the document

Parameters:
username - the user login credentails
groups - a list of the user's groups
Throws:
MetacatUtilException


Copyright © 2000 National Center for Ecological Analysis and Synthesis. All Rights Reserved.