X500Principalpublic class X500Principal extends Object implements Principal, Serializable This class represents an X.500 Principal .
X500Principals have names such as,
"CN=Duke, OU=JavaSoft, O=Sun Microsystems, C=US"
(RFC 1779 style).
Principals such as this X500Principal
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 . |
Fields Summary |
---|
private static final long | serialVersionUID | private static final ResourceBundle | rb | private String | name | private transient X500Name | thisX500Name |
Constructors Summary |
---|
public X500Principal(String name)Create a X500Principal with an X.500 Name,
such as "CN=Duke, OU=JavaSoft, O=Sun Microsystems, C=US"
(RFC 1779 style).
if (name == null)
throw new NullPointerException(rb.getString("provided null name"));
try {
thisX500Name = new X500Name(name);
} catch (Exception e) {
throw new IllegalArgumentException(e.toString());
}
this.name = name;
|
Methods Summary |
---|
public boolean | equals(java.lang.Object o)Compares the specified Object with this X500Principal
for equality.
if (o == null)
return false;
if (this == o)
return true;
if (o instanceof X500Principal) {
X500Principal that = (X500Principal)o;
try {
X500Name thatX500Name = new X500Name(that.getName());
return thisX500Name.equals(thatX500Name);
} catch (Exception e) {
// any parsing exceptions, return false
return false;
}
} else if (o instanceof Principal) {
// this will return 'true' if 'o' is a sun.security.x509.X500Name
// and the X500Names are equal
return o.equals(thisX500Name);
}
return false;
| public java.lang.String | getName()Return the Unix username for this X500Principal .
return thisX500Name.getName();
| public int | hashCode()Return a hash code for this X500Principal .
return thisX500Name.hashCode();
| private void | readObject(java.io.ObjectInputStream s)Reads this object from a stream (i.e., deserializes it)
s.defaultReadObject();
// re-create thisX500Name
thisX500Name = new X500Name(name);
| public java.lang.String | toString()Return a string representation of this X500Principal .
return thisX500Name.toString();
|
|