|
JAFS API v2 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--org.openafs.jafs.Token
An abstract representation of an AFS authentication token. It conveniently
maintains the handle associated with token and the cell to which the token
is authenticated.
Constructing a Token object results in an immediate attempt to
authenticate the user within the specified cell. If this attempt fails, an
will be thrown. Therefore, if the
construction of the object succeeds without an exception, then the
AFSExceptionToken is considered authenticated.
The construction of a Token object acts as an entry point
for authentication into the AFS system. Thus, when you construct a
object, you must pass in an instance of a
CellToken that has been authenticated within the AFS cell that
Cell is intended to represent. You will only be
allowed to perform actions that the user, used to authenticate
Token, is authorized to perform. You must construct a
Token object before constructing a Cell object,
which is required by all other objects within this package either directly
or indirectly.
If an error occurs during a method call, an
AFSException will be thrown. This class is the Java
equivalent of errors thrown by AFS; see AFSException
for a complete description.
The following is a simple example of how to construct and use a
Token object. It shows how to construct a Cell
using a Token. See Cell for a more detailed example
of constructing and using a Cell object.
import org.openafs.jafs.AFSException;
import org.openafs.jafs.Cell;
import org.openafs.jafs.Token;
...
public class ...
{
...
private Cell cell;
private Token token;
...
public static void main(String[] args) throws Exception
{
String username = arg[0];
String password = arg[1];
String cellName = arg[2];
String serverName = arg[3];
token = new Token(username, password, cellName);
cell = new Cell(token);
...
}
...
}
| Field Summary | |
static int |
ANYUSER_PAG_ID
|
protected String |
cellName
|
protected int |
errno
|
protected int |
pagID
|
protected int |
tokenHandle
|
protected String |
username
|
| Constructor Summary | |
|
Token(String username,
String password,
String cellName)
Constructs a new Token object instance given
the name of the AFS cell it represents and the username and password
of the user to be Tokend for
administrative access. |
protected |
Token(String username,
String password,
String cellName,
boolean automaticallyLogin)
Constructs a new Token object instance given
the name of the AFS cell it represents and the username and password
of the user to be Tokend for
administrative access. |
| Method Summary | |
void |
close()
Closes the given currently open token. |
protected void |
close(int tokenHandle)
Closes the given currently open token. |
int |
compareTo(Object obj)
Comparable interface method. |
int |
compareTo(Token token)
Compares two ACL objects respective to their paths and does not factor any other attribute. |
boolean |
equals(Token token)
Tests whether two Cell objects are equal, based on their
names. |
String |
getCellName()
Returns the name of the AFS cell that this Token was
authenticated against. |
long |
getExpiration()
Gets the expiration time for a given token. |
protected long |
getExpiration(int tokenHandle)
Gets the expiration time for a given token. |
protected int |
getHandle()
Returns a token handle that can be used to prove this authentication later. |
protected int |
getToken(String cellName,
String username,
String password)
Returns a token handle that can be used to prove this authentication later. |
String |
getUsername()
Returns the username of user to whom this token belongs. |
protected static void |
initializeAdminClient()
Initialize the administrative library. |
protected static void |
initializeUserSpace()
Initialize the user space AFS client (libjafs). |
void |
klog()
Authenticates a user in kas, and binds that authentication to the current process. |
protected int |
klog(String username,
String password,
String cellName,
int id)
Authenticates a user in KAS, and binds that authentication to the current thread or native process. |
void |
login()
Authenticates a user in KAS, and binds that authentication to the current process. |
protected static void |
reclaimAuthMemory()
Reclaims all memory being saved by the authentication portion of the native library. |
protected void |
relog(int id)
Authenticates a user in KAS by a previously acquired PAG ID, and binds that authentication to the current thread or native process. |
protected static void |
shutdown()
Inform the native library that the application is shutting down and will be unloading. |
String |
toString()
Returns the name of this Cell |
void |
unlog()
Manually discards all AFS credentials associated with the bound user. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static int ANYUSER_PAG_ID
protected int tokenHandle
protected int pagID
protected int errno
protected String cellName
protected String username
| Constructor Detail |
protected Token(String username,
String password,
String cellName,
boolean automaticallyLogin)
throws AFSException
Token object instance given
the name of the AFS cell it represents and the username and password
of the user to be Tokend for
administrative access.
username - the name of the user to Token withpassword - the password of that usercellName - the name of the cell to Token into
AFSException - If an error occurs in the native code
public Token(String username,
String password,
String cellName)
throws AFSException
Token object instance given
the name of the AFS cell it represents and the username and password
of the user to be Tokend for
administrative access.
username - the name of the user to Token withpassword - the password of that usercellName - the name of the cell to Token into
AFSException - If an error occurs in the native code| Method Detail |
public String getCellName()
Token was
authenticated against.
Token.
AFSException - If an error occurs in the native codepublic String getUsername()
AFSException - If an error occurs in the native codeprotected int getHandle()
AFSException - If an error occurs in the native code
public void close()
throws AFSException
AFSException - If an error occurs in the native code
public long getExpiration()
throws AFSException
AFSException - If an error occurs in the native code
public void klog()
throws AFSException
AFSException - If an error occurs in the native code
public void login()
throws AFSException
AFSException - If an error occurs in the native code
protected static void initializeUserSpace()
throws AFSException
The user space client must be initialized prior to any user space related methods, including: klog, unlog, relog, and shutdown.
AFSException - If an error occurs in the native codepublic int compareTo(Token token)
public int compareTo(Object obj)
compareTo in interface ComparablecompareTo(Token)public boolean equals(Token token)
Cell objects are equal, based on their
names. Does not test whether the objects are actually the same
representational instance of the AFS cell.
public String toString()
Cell
toString in class ObjectCell
protected static void initializeAdminClient()
throws AFSException
AFSException - If an error occurs in the native code
protected int getToken(String cellName,
String username,
String password)
throws AFSException
cellName - the name of the cell in which to Token this userpassword - the password of the user
AFSException - If an error occurs in the native code
protected void close(int tokenHandle)
throws AFSException
tokenHandle - the token to close
AFSException - If an error occurs in the native code
protected long getExpiration(int tokenHandle)
throws AFSException
tokenHandle - a token handle previously returned by a call
to getToken(java.lang.String, java.lang.String, java.lang.String)
AFSException - If an error occurs in the native codegetToken(java.lang.String, java.lang.String, java.lang.String)
protected int klog(String username,
String password,
String cellName,
int id)
throws AFSException
username - the login to authenticate
(expected as username@cellname)password - the password of the logincellName - the name of the cell to authenticate intoid - the existing pag (or 0)
AFSException - If an error occurs in the native code
protected void relog(int id)
throws AFSException
This method does not require the user's username and password to fully authenticate their request. Rather it utilizes the user's PAG ID to recapture the user's existing credentials.
This method is called by the public klog method, which
internally manages the PAG ID. Additionally, an application needs only
call klog, this reduces the amount of complexity and ensures
that relog is never called before a klog.
AFSException - If an error occurs in the native code
public void unlog()
throws AFSException
AFSException - If an error occurs in the native codeprotected static void shutdown()
The library will make a call informing the file server that it will no longer be available for callbacks.
protected static void reclaimAuthMemory()
|
JAFS API v2 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||