Class GSSException

  • All Implemented Interfaces:
    java.io.Serializable

    public class GSSException
    extends java.lang.Exception
    This exception is thrown whenever a fatal GSS-API error occurs including mechanism specific errors. It contains both the major and minor JGSS status codes. The mechanism implementers are responsible for setting appropriate minor status codes when throwing this exception. Methods are included to retrieve the error string representation for both major and minor codes.
    RFC 2078
    GSS-API major status codes are divided into fatal and informatory status codes. In JGSS, fatal codes are represented using exceptions of this class, and informatory codes are returned through instances of the MesssageProp class used in the GSSContext methods. This class also provides the functionality of gss_display_status.
    See Also:
    MessageProp, GSSContext.unwrap(byte[], int, int, com.sun.gssapi.MessageProp), GSSContext.verifyMIC(byte[], int, int, byte[], int, int, com.sun.gssapi.MessageProp), Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int BAD_BINDINGS
      Channel bindings mismatch error.
      static int BAD_MECH
      Unsupported mechanism requested error.
      static int BAD_MIC
      Token had invalid integrity check error.
      static int BAD_NAME
      Invalid name provided error.
      static int BAD_NAMETYPE
      Name of unsupported type provided error.
      static int BAD_QOP
      Unsupported QOP value error.
      static int BAD_STATUS
      Invalid status code error - this is the default status value.
      static int CONTEXT_EXPIRED
      Specified security context expired error.
      static int CREDENTIALS_EXPIRED
      Expired credentials detected error.
      static int DEFECTIVE_CREDENTIAL
      Defective credential error.
      static int DEFECTIVE_TOKEN
      Defective token error.
      static int DUPLICATE_ELEMENT
      Duplicate credential element requested error.
      static int DUPLICATE_TOKEN
      The token was a duplicate of an earlier token.
      static int FAILURE
      General failure, unspecified at GSS-API level.
      static int GAP_TOKEN
      An expected per-message token was not received.
      static int NAME_NOT_MN
      Name contains multi-mechanism elements error.
      static int NO_CONTEXT
      Invalid security context error.
      static int NO_CRED
      Invalid credentials error.
      static int OLD_TOKEN
      The token's validity period has expired.
      static int UNAUTHORIZED
      Operation unauthorized error.
      static int UNAVAILABLE
      Operation unavailable error.
      static int UNSEQ_TOKEN
      A later token has already been processed.
    • Constructor Summary

      Constructors 
      Constructor Description
      GSSException​(int majorCode)
      Construct a GSSException object with a specified major code.
      GSSException​(int majorCode, int minorCode, java.lang.String minorString)
      Construct a GSSException object with a specified major and minor codes and minor explanation string.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int getMajor()
      Returns the major code representing the error that caused this exception to be thrown.
      java.lang.String getMajorString()
      Returns a string explaining the major code in this exception.
      java.lang.String getMessage()
      Returns string representing both the major and minor status codes.
      int getMinor()
      Returns the mechanism error that caused this exception.
      java.lang.String getMinorString()
      Returns a string explaining the mechanism specific error code.
      void setMinor​(int minorCode, java.lang.String message)
      Used by the exception thrower to set the mechanism error code and its string explanation.
      java.lang.String toString()
      Returns string representing both the major and minor status codes.
      • Methods inherited from class java.lang.Throwable

        addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • BAD_BINDINGS

        public static final int BAD_BINDINGS
        Channel bindings mismatch error.
        See Also:
        Constant Field Values
      • BAD_MECH

        public static final int BAD_MECH
        Unsupported mechanism requested error.
        See Also:
        Constant Field Values
      • BAD_NAME

        public static final int BAD_NAME
        Invalid name provided error.
        See Also:
        Constant Field Values
      • BAD_NAMETYPE

        public static final int BAD_NAMETYPE
        Name of unsupported type provided error.
        See Also:
        Constant Field Values
      • BAD_STATUS

        public static final int BAD_STATUS
        Invalid status code error - this is the default status value.
        See Also:
        Constant Field Values
      • BAD_MIC

        public static final int BAD_MIC
        Token had invalid integrity check error.
        See Also:
        Constant Field Values
      • CONTEXT_EXPIRED

        public static final int CONTEXT_EXPIRED
        Specified security context expired error.
        See Also:
        Constant Field Values
      • CREDENTIALS_EXPIRED

        public static final int CREDENTIALS_EXPIRED
        Expired credentials detected error.
        See Also:
        Constant Field Values
      • DEFECTIVE_CREDENTIAL

        public static final int DEFECTIVE_CREDENTIAL
        Defective credential error.
        See Also:
        Constant Field Values
      • DEFECTIVE_TOKEN

        public static final int DEFECTIVE_TOKEN
        Defective token error.
        See Also:
        Constant Field Values
      • FAILURE

        public static final int FAILURE
        General failure, unspecified at GSS-API level.
        See Also:
        Constant Field Values
      • NO_CONTEXT

        public static final int NO_CONTEXT
        Invalid security context error.
        See Also:
        Constant Field Values
      • UNAUTHORIZED

        public static final int UNAUTHORIZED
        Operation unauthorized error.
        See Also:
        Constant Field Values
      • UNAVAILABLE

        public static final int UNAVAILABLE
        Operation unavailable error.
        See Also:
        Constant Field Values
      • DUPLICATE_ELEMENT

        public static final int DUPLICATE_ELEMENT
        Duplicate credential element requested error.
        See Also:
        Constant Field Values
      • NAME_NOT_MN

        public static final int NAME_NOT_MN
        Name contains multi-mechanism elements error.
        See Also:
        Constant Field Values
      • DUPLICATE_TOKEN

        public static final int DUPLICATE_TOKEN
        The token was a duplicate of an earlier token. This is a fatal error code that may occur during context establishment. It is not used to indicate supplementary status values. The MessageProp object is used for that purpose.
        See Also:
        Constant Field Values
      • OLD_TOKEN

        public static final int OLD_TOKEN
        The token's validity period has expired. This is a fatal error code that may occur during context establishment. It is not used to indicate supplementary status values. The MessageProp object is used for that purpose.
        See Also:
        Constant Field Values
      • UNSEQ_TOKEN

        public static final int UNSEQ_TOKEN
        A later token has already been processed. This is a fatal error code that may occur during context establishment. It is not used to indicate supplementary status values. The MessageProp object is used for that purpose.
        See Also:
        Constant Field Values
      • GAP_TOKEN

        public static final int GAP_TOKEN
        An expected per-message token was not received. This is a fatal error code that may occur during context establishment. It is not used to indicate supplementary status values. The MessageProp object is used for that purpose.
        See Also:
        Constant Field Values
    • Constructor Detail

      • GSSException

        public GSSException​(int majorCode)
        Construct a GSSException object with a specified major code.
        Parameters:
        majorCode - the fatal error code causing this exception. This value should be one of the ones defined in this class. Invalid error codes get mapped to BAD_STATUS value.
      • GSSException

        public GSSException​(int majorCode,
                            int minorCode,
                            java.lang.String minorString)
        Construct a GSSException object with a specified major and minor codes and minor explanation string.
        Parameters:
        majorCode - the fatal error code causing this exception. This value should be one of the ones defined in this class. Invalid error codes get mapped to BAD_STATUS value.
        minorCode - the mechanism specific error code.
        minorString - explanation of the minorCode.
    • Method Detail

      • getMajor

        public int getMajor()
        Returns the major code representing the error that caused this exception to be thrown.
        RFC 2078
        equivalent to major code being returned from function
        Returns:
        int the fatal error code causing this exception
        See Also:
        getMajorString()
      • getMinor

        public int getMinor()
        Returns the mechanism error that caused this exception. The minor code is set by the underlying mechanism. Value of 0 indicates that mechanism error code is not set.
        RFC 2078
        equivalent to minor status codes in GSS-API functions
        Returns:
        int the mechanism error code; 0 indicates that it has not been set.
        See Also:
        setMinor(int, java.lang.String), getMinorString()
      • getMajorString

        public java.lang.String getMajorString()
        Returns a string explaining the major code in this exception.
        RFC 2078
        equivalent to gss_display_status for the major error code.
        Returns:
        String explanation string for the major error code
        See Also:
        getMajor(), toString()
      • getMinorString

        public java.lang.String getMinorString()
        Returns a string explaining the mechanism specific error code. Can be used with the getMajorString call to provide mechanism specific error details. If the minor status code is 0, then no other error details will be available.
        RFC 2078
        equivalent to gss_display_status for the minor code.
        Returns:
        String a textual explanation of mechanism error code
        See Also:
        getMinor(), getMajorString(), toString()
      • setMinor

        public void setMinor​(int minorCode,
                             java.lang.String message)
        Used by the exception thrower to set the mechanism error code and its string explanation. This is used by mechanism providers to indicate error details.
        Parameters:
        minorCode - the mechanism specific error code
        message - textual explanation of the mechanism error code
      • toString

        public java.lang.String toString()
        Returns string representing both the major and minor status codes.
        Overrides:
        toString in class java.lang.Throwable
        Returns:
        a String with the error descriptions
      • getMessage

        public java.lang.String getMessage()
        Returns string representing both the major and minor status codes.
        Overrides:
        getMessage in class java.lang.Throwable
        Returns:
        a String with the error descriptions