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
AuthenticationException
public AuthFile(java.lang.String passwordFile) throws AuthenticationException
passwordFile
- AuthenticationException
public boolean authenticate(java.lang.String user, java.lang.String password) throws AuthenticationException
AuthInterface
authenticate
in interface AuthInterface
user
- the name of the principal to authenticatepassword
- the password to use for authenticationAuthenticationException
public java.lang.String[][] getUsers(java.lang.String user, java.lang.String password) throws java.net.ConnectException
AuthInterface
getUsers
in interface AuthInterface
java.net.ConnectException
public java.lang.String[] getUserInfo(java.lang.String user, java.lang.String password) throws java.net.ConnectException
AuthInterface
getUserInfo
in interface AuthInterface
java.net.ConnectException
public java.lang.String[] getUsers(java.lang.String user, java.lang.String password, java.lang.String group) throws java.net.ConnectException
AuthInterface
getUsers
in interface AuthInterface
java.net.ConnectException
public java.lang.String[][] getGroups(java.lang.String user, java.lang.String password) throws java.net.ConnectException
AuthInterface
getGroups
in interface AuthInterface
java.net.ConnectException
public java.lang.String[][] getGroups(java.lang.String user, java.lang.String password, java.lang.String foruser) throws java.net.ConnectException
AuthInterface
getGroups
in interface AuthInterface
java.net.ConnectException
public java.util.HashMap<java.lang.String,java.util.Vector<java.lang.String>> getAttributes(java.lang.String foruser) throws java.net.ConnectException
AuthInterface
getAttributes
in interface AuthInterface
java.net.ConnectException
public 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
AuthInterface
getAttributes
in interface AuthInterface
user
- the user for which the attribute list is requestedpassword
- the password for authenticating against the servicejava.net.ConnectException
public java.lang.String getPrincipals(java.lang.String user, java.lang.String password) throws java.net.ConnectException
AuthInterface
getPrincipals
in interface AuthInterface
user
- the user which requests the informationpassword
- the user's passwordjava.net.ConnectException
public 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 userAuthenticationException
public void addGroup(java.lang.String groupName, java.lang.String description) throws AuthenticationException
groupName
- the name of groupAuthenticationException
public void modifyPassWithHash(java.lang.String userName, java.lang.String newHashPassword) throws AuthenticationException
usrName
- the specified user.newPassword
- the new password which will be setAuthenticationException
public void modifyPassWithPlain(java.lang.String userName, java.lang.String newPlainPassword) throws AuthenticationException
usrName
- the specified user.newPassword
- the new password which will be setAuthenticationException
public 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 existAuthenticationException
public 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 groupAuthenticationException
public static void main(java.lang.String[] argus) throws java.lang.Exception
argus
- java.lang.Exception
Copyright © 2020 Regents of the University of California. All Rights Reserved.