Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.novell.java.security
Class Identity

    java.lang.Object
      |
      +--com.novell.java.security.Identity

public abstract class Identity
extends java.lang.Object
implements Principal, java.io.Serializable

Represents identities, which are real-world objects. Identities can be people, companies, or organizations whose identities can be authenticated using their public keys. Identities may also be more abstract (or concrete) constructs, such as daemon threads or smart cards.

Identity objects have an immutable name and a public key. If an Identity is specified to have a particular scope, then the name and public key of the Identity are unique within that scope.

An Identity also has a set of certificates to certify its own public key. The Principal names specified in these certificates need not be the same, only the key must be unique.

An Identity can be subclassed to include postal and e-mail addresses, telephone numbers, images of faces and logos, and so on.

See Also:
  `IdentityScope`, `Principal`

Constructor Summary
`Identity(java.lang.String name)` Constructs an identity with the passed-in name but no scope.
`Identity(java.lang.String name, IdentityScope scope)` Constructs an identity with the passed-in name and scope.

Method Summary
`void` | `addCertificate(com.novell.java.security.cert.Certificate certificate)` Adds a certificate for this identity.
`boolean` | `equals(java.lang.Object identity)` Compares two Objects for equality.
`com.novell.java.security.cert.Certificate[]` | `getCertificates()` Returns a copy of all the certificates for this identity.
`java.lang.String` | `getInfo()` Returns the general information string previously specified (set) for this identity.
`java.lang.String` | `getName()` Returns the name of this identity as a String.
`PublicKey` | `getPublicKey()` Returns the public key for this identity.
`IdentityScope` | `getScope()` Returns the scope of this identity as an IdentityScope object.
`int` | `hashCode()` Returns a hash code value for this object (identity).
`void` | `removeCertificate(com.novell.java.security.cert.Certificate certificate)` Removes a certificate from this identity.
`void` | `setInfo(java.lang.String info)` Specifies a general information string for this identity.
`void` | `setPublicKey(PublicKey key)` Sets the public key for this identity.
`java.lang.String` | `toString()` Generates a short string representation of the object (identity) containing its name and scope (if any).
`java.lang.String` | `toString(boolean detailed)` Generates a short string representation of the object (identity) containing optionally more details than provided by the toString() method without any arguments.

Methods inherited from class java.lang.Object
`getClass, notify, notifyAll, wait, wait, wait`

Constructor Detail

### Identity

    public Identity(java.lang.String name,
                    IdentityScope scope)
             throws KeyManagementException

  Constructs an identity with the passed-in name and scope.
  Parameters:
    `name` - The name of the identity.
    `scope` - The scope of the identity.
  Throws:
    KeyManagementException - Thrown if there is already an identity with the same name in the scope.

### Identity

    public Identity(java.lang.String name)

  Constructs an identity with the passed-in name but no scope.
  Parameters:
    `name` - The name of the identity.

Method Detail

### getName

    public final java.lang.String getName()

  Returns the name of this identity as a String.
  Specified by:
    getName in interface Principal
  Returns:
    The name of this identity.

### getScope

    public final IdentityScope getScope()

  Returns the scope of this identity as an IdentityScope object.
  Returns:
    The scope of this identity.

### getPublicKey

    public PublicKey getPublicKey()

  Returns the public key for this identity.
  Returns:
    The public key for this identity.

### setPublicKey

    public void setPublicKey(PublicKey key)
                      throws KeyManagementException

  Sets the public key for this identity. The old key and all of this identity's certificates are removed by this operation.
  Parameters:
    `key` - The public key for this identity.
  Throws:
    KeyManagementException - Thrown if another identity in the identity's scope has the same public key, or if another exception occurs.

### setInfo

    public void setInfo(java.lang.String info)

  Specifies a general information string for this identity.
  Parameters:
    `info` - The information string to set.
  See Also:
    `getInfo()`

### getInfo

    public java.lang.String getInfo()

  Returns the general information string previously specified (set) for this identity.
  Returns:
    The general information about this identity.
  See Also:
    `setInfo(java.lang.String)`

### addCertificate

    public void addCertificate(com.novell.java.security.cert.Certificate certificate)
                        throws KeyManagementException

  Adds a certificate for this identity. If the identity has a public key, the public key in the certificate must be the same, and if the identity does not have a public key, the identity's public key is set to the one specified in the certificate.
  Parameters:
    `certificate` - The certificate to be added.
  Throws:
    KeyManagementException - Thrown if the certificate is not valid, or if the public key in the certificate being added conflicts with this identity's public key, or if another exception occurs.
  Since:
    JDK1.2

### removeCertificate

    public void removeCertificate(com.novell.java.security.cert.Certificate certificate)
                           throws KeyManagementException

  Removes a certificate from this identity.
  Parameters:
    `certificate` - The certificate to be removed.
  Throws:
    KeyManagementException - Thrown if the certificate is missing, or if another exception occurs.
  Since:
    JDK1.2

### getCertificates

    public com.novell.java.security.cert.Certificate[] getCertificates()

  Returns a copy of all the certificates for this identity.
  Returns:
    An array containing a copy of all the certificates for this identity.
  Since:
    JDK1.2

### equals

    public final boolean equals(java.lang.Object identity)

  Compares two Objects for equality. The equals method compares this identity object value with the value of the reference object specified in the Object parameter.

  The equals() method first tests to see if the entities actually refer to the same object, in which case it returns TRUE. Next, it checks to see if the entities have the same name and the same scope. If they do, the method returns TRUE. Otherwise, it calls the identityEquals method. Identity subclasses should override the identityEquals() method.

  Specified by:
    equals in interface Principal
  Parameters:
    `identity` - The object with which to test for equality.
  Returns:
    A boolean set to TRUE if and only if the argument is not NULL and contains the same value as this object, otherwise set to FALSE.
  Overrides:
    equals in class java.lang.Object
  See Also:
    `#identityEquals`

### toString

    public java.lang.String toString()

  Generates a short string representation of the object (identity) containing its name and scope (if any). The returned string, which textually represents the object, should be a concise but informative representation that is easy to read.
  Specified by:
    toString in interface Principal
  Returns:
    A String containing information about this object (identity), such as its name and the name of its scope (if any).
  Overrides:
    toString in class java.lang.Object

### toString

    public java.lang.String toString(boolean detailed)

  Generates a short string representation of the object (identity) containing optionally more details than provided by the toString() method without any arguments. If the detailed parameter is set to TRUE this method returns more information than that provided by the toString() method without any arguments.
  Parameters:
    `detailed` - A boolean indicating whether or not to provide the optional detailed information.
  Returns:
    The optional detailed information about this identity.
  See Also:
    `toString()`

### hashCode

    public int hashCode()

  Returns a hash code value for this object (identity). Whenever the hashCode() method is invoked on the same object more than once during an execution of a Java application, the hashCode() method must consistently return the same integer. This integer need not remain consistent from one execution of an application to another execution of the same application. If two objects are equal according to the equals() method, then calling the hashCode() method on each of the two objects must produce the same integer result.
  Specified by:
    hashCode in interface Principal
  Returns:
    A hash code value for this object (identity).
  Overrides:
    hashCode in class java.lang.Object

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD