Class Gs2Header

  • All Implemented Interfaces:
    StringWritable

    public class Gs2Header
    extends AbstractStringWritable
    GSS Header. Format: gs2-header = gs2-cbind-flag "," [ authzid ] "," gs2-cbind-flag = ("p=" cb-name) / "n" / "y" authzid = "a=" saslname Current implementation does not support channel binding. If p is used as the cbind flag, the cb-name value is not validated.
    See Also:
    [RFC5802] Formal Syntax
    • Constructor Detail

      • Gs2Header

        public Gs2Header​(Gs2CbindFlag cbindFlag,
                         String cbName,
                         String authzid)
                  throws IllegalArgumentException
        Construct and validates a Gs2Header. Only provide the channel binding name if the channel binding flag is set to required.
        Parameters:
        cbindFlag - The channel binding flag
        cbName - The channel-binding name. Should be not null iif channel binding is required
        authzid - The optional SASL authorization identity
        Throws:
        IllegalArgumentException - If the channel binding flag and argument are invalid
      • Gs2Header

        public Gs2Header​(Gs2CbindFlag cbindFlag,
                         String cbName)
                  throws IllegalArgumentException
        Construct and validates a Gs2Header with no authzid. Only provide the channel binding name if the channel binding flag is set to required.
        Parameters:
        cbindFlag - The channel binding flag
        cbName - The channel-binding name. Should be not null iif channel binding is required
        Throws:
        IllegalArgumentException - If the channel binding flag and argument are invalid
      • Gs2Header

        public Gs2Header​(Gs2CbindFlag cbindFlag)
        Construct and validates a Gs2Header with no authzid nor channel binding.
        Parameters:
        cbindFlag - The channel binding flag
        Throws:
        IllegalArgumentException - If the channel binding is supported (no cbname can be provided here)
    • Method Detail

      • getChannelBindingFlag

        public Gs2CbindFlag getChannelBindingFlag()
      • getChannelBindingName

        public String getChannelBindingName()
      • getAuthzid

        public String getAuthzid()
      • writeTo

        public StringBuffer writeTo​(StringBuffer sb)
        Description copied from interface: StringWritable
        Write the class information to the given StringBuffer.
        Parameters:
        sb - Where to write the data.
        Returns:
        The same StringBuffer.
      • parseFrom

        public static Gs2Header parseFrom​(String message)
                                   throws IllegalArgumentException
        Read a Gs2Header from a String. String may contain trailing fields that will be ignored.
        Parameters:
        message - The String containing the Gs2Header
        Returns:
        The parsed Gs2Header object
        Throws:
        IllegalArgumentException - If the format/values of the String do not conform to a Gs2Header