Package com.ongres.scram.common.gssapi
Class Gs2Header
- java.lang.Object
-
- com.ongres.scram.common.util.AbstractStringWritable
-
- com.ongres.scram.common.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
-
-
Field Summary
Fields Modifier and Type Field Description private Gs2AttributeValue
authzid
private Gs2AttributeValue
cbind
-
Constructor Summary
Constructors Constructor Description Gs2Header(Gs2CbindFlag cbindFlag)
Construct and validates a Gs2Header with no authzid nor channel binding.Gs2Header(Gs2CbindFlag cbindFlag, java.lang.String cbName)
Construct and validates a Gs2Header with no authzid.Gs2Header(Gs2CbindFlag cbindFlag, java.lang.String cbName, java.lang.String authzid)
Construct and validates a Gs2Header.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getAuthzid()
Gs2CbindFlag
getChannelBindingFlag()
java.lang.String
getChannelBindingName()
static Gs2Header
parseFrom(java.lang.String message)
Read a Gs2Header from a String.java.lang.StringBuffer
writeTo(java.lang.StringBuffer sb)
Write the class information to the given StringBuffer.-
Methods inherited from class com.ongres.scram.common.util.AbstractStringWritable
toString
-
-
-
-
Field Detail
-
cbind
private final Gs2AttributeValue cbind
-
authzid
private final Gs2AttributeValue authzid
-
-
Constructor Detail
-
Gs2Header
public Gs2Header(Gs2CbindFlag cbindFlag, java.lang.String cbName, java.lang.String authzid) throws java.lang.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:
java.lang.IllegalArgumentException
- If the channel binding flag and argument are invalid
-
Gs2Header
public Gs2Header(Gs2CbindFlag cbindFlag, java.lang.String cbName) throws java.lang.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:
java.lang.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:
java.lang.IllegalArgumentException
- If the channel binding is supported (no cbname can be provided here)
-
-
Method Detail
-
getChannelBindingFlag
public Gs2CbindFlag getChannelBindingFlag()
-
getChannelBindingName
public java.lang.String getChannelBindingName()
-
getAuthzid
public java.lang.String getAuthzid()
-
writeTo
public java.lang.StringBuffer writeTo(java.lang.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(java.lang.String message) throws java.lang.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:
java.lang.IllegalArgumentException
- If the format/values of the String do not conform to a Gs2Header
-
-