Class Gs2Header
- java.lang.Object
-
- com.impossibl.postgres.protocol.sasl.scram.util.AbstractStringWritable
-
- com.impossibl.postgres.protocol.sasl.scram.gssapi.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 Summary
Constructors Constructor Description Gs2Header(Gs2CbindFlag cbindFlag)
Construct and validates a Gs2Header with no authzid nor channel binding.Gs2Header(Gs2CbindFlag cbindFlag, String cbName)
Construct and validates a Gs2Header with no authzid.Gs2Header(Gs2CbindFlag cbindFlag, String cbName, String authzid)
Construct and validates a Gs2Header.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getAuthzid()
Gs2CbindFlag
getChannelBindingFlag()
String
getChannelBindingName()
static Gs2Header
parseFrom(String message)
Read a Gs2Header from a String.StringBuffer
writeTo(StringBuffer sb)
Write the class information to the given StringBuffer.-
Methods inherited from class com.impossibl.postgres.protocol.sasl.scram.util.AbstractStringWritable
toString
-
-
-
-
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 flagcbName
- The channel-binding name. Should be not null iif channel binding is requiredauthzid
- 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 flagcbName
- 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
-
-