public class AuthUtil
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DELIMITER |
static java.lang.String |
ESCAPECHAR |
static org.apache.log4j.Logger |
logMetacat |
Modifier and Type | Method and Description |
---|---|
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.
|
static java.util.Vector<java.lang.String> |
split(java.lang.String text,
java.lang.String delimiter,
java.lang.String escapeChar)
Convert a delimited string to a Vector by splitting on a particular character
|
public static org.apache.log4j.Logger logMetacat
public static java.lang.String DELIMITER
public static java.lang.String ESCAPECHAR
public static java.util.Vector<java.lang.String> getAdministrators() throws MetacatUtilException
MetacatUtilException
public static java.util.Vector<java.lang.String> getAllowedSubmitters() throws MetacatUtilException
MetacatUtilException
public static java.util.Vector<java.lang.String> getDeniedSubmitters() throws MetacatUtilException
MetacatUtilException
public static java.util.Vector<java.lang.String> getModerators() throws MetacatUtilException
MetacatUtilException
public static boolean logUserIn(javax.servlet.http.HttpServletRequest request, java.lang.String userName, java.lang.String password) throws MetacatUtilException
request
- the http request.MetacatUtilException
public static boolean isUserLoggedIn(javax.servlet.http.HttpServletRequest request) throws MetacatUtilException
request
- the http request that holds the login sessionMetacatUtilException
public static boolean isUserLoggedInAsAdmin(javax.servlet.http.HttpServletRequest request) throws MetacatUtilException
request
- the http request that holds the login sessionMetacatUtilException
public static java.lang.String getUserName(javax.servlet.http.HttpServletRequest request)
request
- the http request that holds the login sessionpublic static java.lang.String[] getGroupNames(javax.servlet.http.HttpServletRequest request)
request
- the http request that holds the login sessionpublic static java.lang.String createLDAPString(java.lang.String username, java.lang.String organization, java.util.Vector<java.lang.String> dnList) throws MetacatUtilException
username
- the user nameorganization
- the organizationdnList
- a list of dnsMetacatUtilException
public static boolean isAuthConfigured() throws MetacatUtilException
MetacatUtilException
public static boolean isAdministrator(java.lang.String username, java.lang.String[] groups) throws MetacatUtilException
username
- the user login credentailsgroups
- a list of the user's groupsMetacatUtilException
public static boolean isModerator(java.lang.String username, java.lang.String[] groups) throws MetacatUtilException
username
- the user login credentailsgroups
- a list of the user's groupsMetacatUtilException
public static boolean isAllowedSubmitter(java.lang.String username, java.lang.String[] groups) throws MetacatUtilException
username
- the user login credentailsgroups
- a list of the user's groupsMetacatUtilException
public static boolean isDeniedSubmitter(java.lang.String username, java.lang.String[] groups) throws MetacatUtilException
username
- the user login credentailsgroups
- a list of the user's groupsMetacatUtilException
public static boolean canInsertOrUpdate(java.lang.String username, java.lang.String[] groups) throws MetacatUtilException
username
- the user login credentailsgroups
- a list of the user's groupsMetacatUtilException
public static java.util.Vector<java.lang.String> split(java.lang.String text, java.lang.String delimiter, java.lang.String escapeChar)
text
- the text to be split into componentsdelimiter
- the string to specify the delimiterescapeChar
- the string to escape a delimiter.Copyright © 2020 Regents of the University of California. All Rights Reserved.