|
Java AFS API v1.4 | |||||||||
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
AFSException
Token
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
Cell
Token
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
|
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. |
Method Summary | |
void |
close()
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. |
String |
getUsername()
Returns the username of user to whom this token belongs. |
void |
klog()
Authenticates a user in kas, and binds that authentication to the current process. |
void |
login()
Authenticates a user in KAS, and binds that authentication to the current process. |
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 |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static int ANYUSER_PAG_ID
Constructor Detail |
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 codeMethod 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 codepublic void close() throws AFSException
AFSException
- If an error occurs in the native codepublic long getExpiration() throws AFSException
AFSException
- If an error occurs in the native codepublic void klog() throws AFSException
AFSException
- If an error occurs in the native codepublic void login() throws AFSException
AFSException
- If an error occurs in the native codepublic int compareTo(Token token)
public int compareTo(Object obj)
compareTo
in interface Comparable
compareTo(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 Object
Cell
public void unlog() throws AFSException
AFSException
- If an error occurs in the native code
|
Java AFS API (jafs) for OpenAFS | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |