APIdia Launch Partner
Top Description Fields Constructors Methods
com.sun.security.auth

public Class UnixNumericGroupPrincipal

extends Object
implements Principal, Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable, java.security.Principal
Imports
java.io.IOException, .InvalidObjectException, .ObjectInputStream, java.security.Principal, java.util.Objects

This class implements the Principal interface and represents a user's Unix group identification number (GID).

Principals such as this UnixNumericGroupPrincipal may be associated with a particular Subject to augment that Subject with an additional identity. Refer to the Subject class for more information on how to achieve this. Authorization decisions can then be based upon the Principals associated with a Subject.

Since
1.4
See Also
java.security.Principal, javax.security.auth.Subject

Field Summary

Modifier and TypeField and Description
private String
private boolean
private static final long

Constructor Summary

AccessConstructor and Description
public
UnixNumericGroupPrincipal(String
the user's group identification number (GID) for this user.
name
,
boolean
true if the specified GID represents the primary group to which this user belongs.
primaryGroup
)

Create a UnixNumericGroupPrincipal using a String representation of the user's group identification number (GID).

public
UnixNumericGroupPrincipal(long
the user's group identification number (GID) for this user represented as a long.
name
,
boolean
true if the specified GID represents the primary group to which this user belongs.
primaryGroup
)

Create a UnixNumericGroupPrincipal using a long representation of the user's group identification number (GID).

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true if the specified Object is equal to this UnixNumericGroupPrincipal.
equals
(Object
Object to be compared for equality with this UnixNumericGroupPrincipal.
o
)

Overrides java.lang.Object.equals.

Implements java.security.Principal.equals.

Compares the specified Object with this UnixNumericGroupPrincipal for equality.

public String

Returns:

the user's group identification number (GID) for this UnixNumericGroupPrincipal
getName
()

Implements java.security.Principal.getName.

Return the user's group identification number (GID) for this UnixNumericGroupPrincipal.

public int

Returns:

a hash code for this UnixNumericGroupPrincipal.
hashCode
()

Overrides java.lang.Object.hashCode.

Implements java.security.Principal.hashCode.

Return a hash code for this UnixNumericGroupPrincipal.

public boolean

Returns:

true if this group identification number (GID) represents the primary group to which this user belongs, or false otherwise.
isPrimaryGroup
()

Return whether this group identification number (GID) represents the primary group to which this user belongs.

public long

Returns:

the user's group identification number (GID) for this UnixNumericGroupPrincipal as a long.
longValue
()

Return the user's group identification number (GID) for this UnixNumericGroupPrincipal as a long.

private void
readObject(ObjectInputStream
the ObjectInputStream from which data is read
stream
)

Restores the state of this object from the stream.

public String

Returns:

a string representation of this UnixNumericGroupPrincipal.
toString
()

Overrides java.lang.Object.toString.

Implements java.security.Principal.toString.

Return a string representation of this UnixNumericGroupPrincipal.

Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

nameback to summary
private String name
primaryGroupback to summary
private boolean primaryGroup
serialVersionUIDback to summary
private static final long serialVersionUID
Annotations
@Serial

Constructor Detail

UnixNumericGroupPrincipalback to summary
public UnixNumericGroupPrincipal(String name, boolean primaryGroup)

Create a UnixNumericGroupPrincipal using a String representation of the user's group identification number (GID).

Parameters
name:String

the user's group identification number (GID) for this user.

primaryGroup:boolean

true if the specified GID represents the primary group to which this user belongs.

Exceptions
NullPointerException:
if the name is null.
UnixNumericGroupPrincipalback to summary
public UnixNumericGroupPrincipal(long name, boolean primaryGroup)

Create a UnixNumericGroupPrincipal using a long representation of the user's group identification number (GID).

Parameters
name:long

the user's group identification number (GID) for this user represented as a long.

primaryGroup:boolean

true if the specified GID represents the primary group to which this user belongs.

Method Detail

equalsback to summary
public boolean equals(Object o)

Overrides java.lang.Object.equals.

Implements java.security.Principal.equals.

Compares the specified Object with this UnixNumericGroupPrincipal for equality. Returns true if the given object is also a UnixNumericGroupPrincipal and the two UnixNumericGroupPrincipals have the same group identification number (GID).

Parameters
o:Object

Object to be compared for equality with this UnixNumericGroupPrincipal.

Returns:boolean

true if the specified Object is equal to this UnixNumericGroupPrincipal.

getNameback to summary
public String getName()

Implements java.security.Principal.getName.

Return the user's group identification number (GID) for this UnixNumericGroupPrincipal.

Returns:String

the user's group identification number (GID) for this UnixNumericGroupPrincipal

hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Implements java.security.Principal.hashCode.

Return a hash code for this UnixNumericGroupPrincipal.

Returns:int

a hash code for this UnixNumericGroupPrincipal.

isPrimaryGroupback to summary
public boolean isPrimaryGroup()

Return whether this group identification number (GID) represents the primary group to which this user belongs.

Returns:boolean

true if this group identification number (GID) represents the primary group to which this user belongs, or false otherwise.

longValueback to summary
public long longValue()

Return the user's group identification number (GID) for this UnixNumericGroupPrincipal as a long.

Returns:long

the user's group identification number (GID) for this UnixNumericGroupPrincipal as a long.

readObjectback to summary
private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException

Restores the state of this object from the stream.

Parameters
stream:ObjectInputStream

the ObjectInputStream from which data is read

Annotations
@Serial
Exceptions
IOException:
if an I/O error occurs
ClassNotFoundException:
if a serialized class cannot be loaded
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Implements java.security.Principal.toString.

Return a string representation of this UnixNumericGroupPrincipal.

Returns:String

a string representation of this UnixNumericGroupPrincipal.