com.ibm.as400.security.auth

Class ProfileHandleCredential

  • All Implemented Interfaces:
    AS400SwappableCredential, java.io.Serializable


    public final class ProfileHandleCredential
    extends AS400Credential
    Represents an IBM i system profile handle.

    This credential does not support all possible behavior for IBM i system profile handles. It is provided to fill a secondary role in support of other credentials when running on the local IBM i system. A profile handle credential provides the ability to store the current thread identity and restore that identity after performing a swap based on another credential (i.e. ProfileTokenCredential).

    See Also:
    AS400Credential, ProfileTokenCredential, Serialized Form
    • Field Detail

      • HANDLE_LENGTH

        public static final int HANDLE_LENGTH
        Indicates the length of a profile handle (in bytes)
        See Also:
        Constant Field Values
    • Constructor Detail

      • ProfileHandleCredential

        public ProfileHandleCredential()
        Constructs a ProfileHandleCredential object.
    • Method Detail

      • equals

        public boolean equals(java.lang.Object o)
        Compares the specified Object with the credential for equality.
        Overrides:
        equals in class java.lang.Object
        Parameters:
        o - Object to be compared for equality.
        Returns:
        true if equal; otherwise false.
      • getHandle

        public byte[] getHandle()
        Returns the actual bytes for the handle as it exists on the IBM i system.
        Returns:
        The handle bytes; null if not set.
      • hashCode

        public int hashCode()
        Returns a hash code for this credential.
        Overrides:
        hashCode in class java.lang.Object
        Returns:
        a hash code for this credential.
      • setHandle

        public void setHandle()
                       throws java.beans.PropertyVetoException,
                              AS400SecurityException
        Sets the handle based on the current thread identity.

        The system property must be set prior to invoking this method.

        If successful, this method results in a new profile handle being created on the IBM i system.

        This property cannot be changed once a request initiates a connection for the object to the IBM i system.

        Throws:
        AS400SecurityException - If an IBM i system security or authentication error occurs.
        java.beans.PropertyVetoException - If the change is vetoed.
        ExtendedIllegalStateException - If the token cannot be initialized due to the current state.
      • setHandle

        public void setHandle(byte[] bytes)
                       throws java.beans.PropertyVetoException
        Sets the actual bytes for the handle as it exists on the IBM i system.

        This method allows a credential to be constructed based on an existing handle (i.e. previously created using the QSYGETPH system API).

        This property cannot be changed once a request initiates a connection for the object to the IBM i system.

        Parameters:
        bytes - The handle bytes.
        Throws:
        java.beans.PropertyVetoException - If the change is vetoed.
        ExtendedIllegalArgumentException - If the provided value exceeds the maximum allowed length.
        ExtendedIllegalStateException - If the property cannot be changed due to the current state.