Package org.acplt.oncrpc
Class OncRpcClientAuthUnix
java.lang.Object
org.acplt.oncrpc.OncRpcClientAuth
org.acplt.oncrpc.OncRpcClientAuthUnix
The
OncRpcClientAuthUnix
class handles protocol issues of
ONC/RPC AUTH_UNIX
(and thus AUTH_SHORT
)
authentication.- Version:
- $Revision: 1.1.1.1 $ $Date: 2003/08/13 12:03:40 $ $State: Exp $ $Locker: $
- Author:
- Harald Albrecht
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate int
Contains the group ID of caller supplied through credential.private int[]
Contains a set of group IDs the caller belongs to, as supplied through credential.private String
Contains the machine name of caller supplied through credential.static final int[]
Contains an empty array of group IDs.private byte[]
Holds the "shorthand" credentials of typeAUTH_SHORT
optionally returned by an ONC/RPC server to be used on subsequent ONC/RPC calls.private int
Contains timestamp as supplied through credential.private int
Contains the user ID of caller supplied through credential. -
Constructor Summary
ConstructorsConstructorDescriptionOncRpcClientAuthUnix
(String machinename, int uid, int gid) Constructs a newOncRpcClientAuthUnix
authentication protocol handling object capable of handlingAUTH_UNIX
andAUTH_SHORT
.OncRpcClientAuthUnix
(String machinename, int uid, int gid, int[] gids) Constructs a newOncRpcClientAuthUnix
authentication protocol handling object capable of handlingAUTH_UNIX
andAUTH_SHORT
. -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
Indicates whether the ONC/RPC authentication credential can be refreshed.int
getGid()
Returns the group ID from the credential.int[]
getGids()
Returns the group IDs from the credential.Returns the machine name information from the credential.int
getStamp()
Returns the timestamp information from the credential.int
getUid()
Returns the user ID from the credential.void
setGid
(int gid) Sets the group ID in the credential.void
setGids
(int[] gids) Sets the group IDs in the credential.void
setMachinename
(String machinename) Sets the machine name information in the credential.void
setStamp
(int stamp) Sets the timestamp information in the credential.void
setUid
(int uid) Sets the user ID in the credential.protected void
Decodes ONC/RPC authentication information in form of a verifier when receiving an ONC/RPC reply message.protected void
Encodes ONC/RPC authentication information in form of a credential and a verifier when sending an ONC/RPC call message.
-
Field Details
-
stamp
private int stampContains timestamp as supplied through credential. -
machinename
Contains the machine name of caller supplied through credential. -
uid
private int uidContains the user ID of caller supplied through credential. -
gid
private int gidContains the group ID of caller supplied through credential. -
gids
private int[] gidsContains a set of group IDs the caller belongs to, as supplied through credential. -
shorthandCred
private byte[] shorthandCredHolds the "shorthand" credentials of typeAUTH_SHORT
optionally returned by an ONC/RPC server to be used on subsequent ONC/RPC calls. -
NO_GIDS
public static final int[] NO_GIDSContains an empty array of group IDs.
-
-
Constructor Details
-
OncRpcClientAuthUnix
Constructs a newOncRpcClientAuthUnix
authentication protocol handling object capable of handlingAUTH_UNIX
andAUTH_SHORT
.Please note that the credential information is typically only unique within a particular domain of machines, user IDs and group IDs.
- Parameters:
machinename
- Name of the caller's machine (like "ebankruptcy-dot-com", just for instance...).uid
- Caller's effective user ID.gid
- Caller's effective group ID.gids
- Array of group IDs the caller is a member of.
-
OncRpcClientAuthUnix
Constructs a newOncRpcClientAuthUnix
authentication protocol handling object capable of handlingAUTH_UNIX
andAUTH_SHORT
.Please note that the credential information is typically only unique within a particular domain of machines, user IDs and group IDs.
- Parameters:
machinename
- Name of the caller's machine (like "ebankruptcy-dot-com", just for instance...).uid
- Caller's effective user ID.gid
- Caller's effective group ID.
-
-
Method Details
-
xdrEncodeCredVerf
Encodes ONC/RPC authentication information in form of a credential and a verifier when sending an ONC/RPC call message. TheAUTH_UNIX
authentication method only uses the credential but no verifier. If the ONC/RPC server sent aAUTH_SHORT
"shorthand" credential together with the previous reply message, it is used instead of the original credential.- Specified by:
xdrEncodeCredVerf
in classOncRpcClientAuth
- Parameters:
xdr
- XDR stream where to encode the credential and the verifier to.- Throws:
OncRpcException
- if an ONC/RPC error occurs.IOException
- if an I/O error occurs.
-
xdrDecodeVerf
Decodes ONC/RPC authentication information in form of a verifier when receiving an ONC/RPC reply message.- Specified by:
xdrDecodeVerf
in classOncRpcClientAuth
- Parameters:
xdr
- XDR stream from which to receive the verifier sent together with an ONC/RPC reply message.- Throws:
OncRpcAuthenticationException
- if the received verifier is not kosher.OncRpcException
- if an ONC/RPC error occurs.IOException
- if an I/O error occurs.
-
canRefreshCred
protected boolean canRefreshCred()Indicates whether the ONC/RPC authentication credential can be refreshed.- Specified by:
canRefreshCred
in classOncRpcClientAuth
- Returns:
- true, if the credential can be refreshed
-
setStamp
public void setStamp(int stamp) Sets the timestamp information in the credential.- Parameters:
stamp
- New timestamp
-
getStamp
public int getStamp()Returns the timestamp information from the credential.- Returns:
- timestamp from credential.
-
setMachinename
Sets the machine name information in the credential.- Parameters:
machinename
- Machine name.
-
getMachinename
Returns the machine name information from the credential.- Returns:
- machine name.
-
setUid
public void setUid(int uid) Sets the user ID in the credential.- Parameters:
uid
- User ID.
-
getUid
public int getUid()Returns the user ID from the credential.- Returns:
- user ID.
-
setGid
public void setGid(int gid) Sets the group ID in the credential.- Parameters:
gid
- Group ID.
-
getGid
public int getGid()Returns the group ID from the credential.- Returns:
- group ID.
-
setGids
public void setGids(int[] gids) Sets the group IDs in the credential.- Parameters:
gids
- Array of group IDs.
-
getGids
public int[] getGids()Returns the group IDs from the credential.- Returns:
- array of group IDs.
-