public class AuthFile extends java.lang.Object implements AuthInterface
GROUPDESINDEX, GROUPNAMEINDEX, USERCNINDEX, USERDNINDEX, USEREMAILINDEX, USERINFOCNINDEX, USERINFOEMAILINDEX, USERINFOORGANIDEX, USERORGINDEX, USERORGUNITINDEX| Constructor and Description |
|---|
AuthFile()
Constructor
|
AuthFile(java.lang.String passwordFile) |
| Modifier and Type | Method and Description |
|---|---|
void |
addGroup(java.lang.String groupName,
java.lang.String description)
Add a group into the file
|
void |
addUser(java.lang.String dn,
java.lang.String[] groups,
java.lang.String plainPass,
java.lang.String hashedPass,
java.lang.String email,
java.lang.String surName,
java.lang.String givenName,
java.lang.String organization)
Add a user to the file
|
void |
addUserToGroup(java.lang.String userName,
java.lang.String group)
Add a user to a group
|
boolean |
authenticate(java.lang.String user,
java.lang.String password)
Determine if a user/password are valid according to the authentication
service.
|
java.util.HashMap<java.lang.String,java.util.Vector<java.lang.String>> |
getAttributes(java.lang.String foruser)
Get attributes describing a user or group
|
java.util.HashMap<java.lang.String,java.util.Vector<java.lang.String>> |
getAttributes(java.lang.String user,
java.lang.String password,
java.lang.String foruser)
Get attributes describing a user or group
|
java.lang.String[][] |
getGroups(java.lang.String user,
java.lang.String password)
Get all groups from the authentication service
|
java.lang.String[][] |
getGroups(java.lang.String user,
java.lang.String password,
java.lang.String foruser)
Get the groups for a particular user from the authentication service
|
java.lang.String |
getPrincipals(java.lang.String user,
java.lang.String password)
Get all groups and users from authentication service.
|
java.lang.String[] |
getUserInfo(java.lang.String user,
java.lang.String password)
Get information for a user - name, organization and email address.
|
java.lang.String[][] |
getUsers(java.lang.String user,
java.lang.String password)
Get all users from the authentication service
|
java.lang.String[] |
getUsers(java.lang.String user,
java.lang.String password,
java.lang.String group)
Get the users for a particular group from the authentication service
|
static void |
main(java.lang.String[] argus)
A method is used to help administrator to manage users and groups
|
void |
modifyPassWithHash(java.lang.String userName,
java.lang.String newHashPassword)
Change the password of the user to the new one which is hashed
|
void |
modifyPassWithPlain(java.lang.String userName,
java.lang.String newPlainPassword)
Change the password of the user to the new one which is plain.
|
void |
removeUserFromGroup(java.lang.String userName,
java.lang.String group)
Remove a user from a group.
|
public AuthFile()
throws AuthenticationException
AuthenticationExceptionpublic AuthFile(java.lang.String passwordFile)
throws AuthenticationException
passwordFile - AuthenticationExceptionpublic boolean authenticate(java.lang.String user,
java.lang.String password)
throws AuthenticationException
AuthInterfaceauthenticate in interface AuthInterfaceuser - the name of the principal to authenticatepassword - the password to use for authenticationAuthenticationExceptionpublic java.lang.String[][] getUsers(java.lang.String user,
java.lang.String password)
throws java.net.ConnectException
AuthInterfacegetUsers in interface AuthInterfacejava.net.ConnectExceptionpublic java.lang.String[] getUserInfo(java.lang.String user,
java.lang.String password)
throws java.net.ConnectException
AuthInterfacegetUserInfo in interface AuthInterfacejava.net.ConnectExceptionpublic java.lang.String[] getUsers(java.lang.String user,
java.lang.String password,
java.lang.String group)
throws java.net.ConnectException
AuthInterfacegetUsers in interface AuthInterfacejava.net.ConnectExceptionpublic java.lang.String[][] getGroups(java.lang.String user,
java.lang.String password)
throws java.net.ConnectException
AuthInterfacegetGroups in interface AuthInterfacejava.net.ConnectExceptionpublic java.lang.String[][] getGroups(java.lang.String user,
java.lang.String password,
java.lang.String foruser)
throws java.net.ConnectException
AuthInterfacegetGroups in interface AuthInterfacejava.net.ConnectExceptionpublic java.util.HashMap<java.lang.String,java.util.Vector<java.lang.String>> getAttributes(java.lang.String foruser)
throws java.net.ConnectException
AuthInterfacegetAttributes in interface AuthInterfacejava.net.ConnectExceptionpublic java.util.HashMap<java.lang.String,java.util.Vector<java.lang.String>> getAttributes(java.lang.String user,
java.lang.String password,
java.lang.String foruser)
throws java.net.ConnectException
AuthInterfacegetAttributes in interface AuthInterfaceuser - the user for which the attribute list is requestedpassword - the password for authenticating against the servicejava.net.ConnectExceptionpublic java.lang.String getPrincipals(java.lang.String user,
java.lang.String password)
throws java.net.ConnectException
AuthInterfacegetPrincipals in interface AuthInterfaceuser - the user which requests the informationpassword - the user's passwordjava.net.ConnectExceptionpublic void addUser(java.lang.String dn,
java.lang.String[] groups,
java.lang.String plainPass,
java.lang.String hashedPass,
java.lang.String email,
java.lang.String surName,
java.lang.String givenName,
java.lang.String organization)
throws AuthenticationException
userName - the name of the usergroups - the groups the user belong to. The group should exist in the filepassword - the password of the userAuthenticationExceptionpublic void addGroup(java.lang.String groupName,
java.lang.String description)
throws AuthenticationException
groupName - the name of groupAuthenticationExceptionpublic void modifyPassWithHash(java.lang.String userName,
java.lang.String newHashPassword)
throws AuthenticationException
usrName - the specified user.newPassword - the new password which will be setAuthenticationExceptionpublic void modifyPassWithPlain(java.lang.String userName,
java.lang.String newPlainPassword)
throws AuthenticationException
usrName - the specified user.newPassword - the new password which will be setAuthenticationExceptionpublic void addUserToGroup(java.lang.String userName,
java.lang.String group)
throws AuthenticationException
userName - the name of the user. the user should already existgroup - the name of the group. the group should already existAuthenticationExceptionpublic void removeUserFromGroup(java.lang.String userName,
java.lang.String group)
throws AuthenticationException
userName - the name of the user. the user should already exist.group - the name of the groupAuthenticationExceptionpublic static void main(java.lang.String[] argus)
throws java.lang.Exception
argus - java.lang.ExceptionCopyright © 2020 Regents of the University of California. All Rights Reserved.