Package com.ongres.scram.common
Class Gs2Header
java.lang.Object
com.ongres.scram.common.Gs2Header
GS2 header for SCRAM.
| gs2-cbind-flag | ("p=" cb-name) / "n" / "y" ;; "n" -> client doesn't support channel binding. ;; "y" -> client does support channel binding ;; but thinks the server does not. ;; "p" -> client requires channel binding. ;; The selected channel binding follows "p=". |
| gs2-header | gs2-cbind-flag "," [ authzid ] "," ;; GS2 header for SCRAM ;; (the actual GS2 header includes an optional ;; flag to indicate that the GSS mechanism is not ;; "standard", but since SCRAM is "standard", we ;; don't include that flag). |
| authzid | "a=" saslname |
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionGs2Header(@NotNull Gs2CbindFlag cbindFlag) Construct and validates a Gs2Header with no authzid nor channel binding.Gs2Header(@NotNull Gs2CbindFlag cbindFlag, @Nullable String cbName) Construct and validates a Gs2Header with no authzid.Gs2Header(@NotNull Gs2CbindFlag cbindFlag, @Nullable String cbName, @Nullable String authzid) Construct and validates a Gs2Header. -
Method Summary
Modifier and TypeMethodDescription@Nullable StringReturn the authzid.@NotNull Gs2CbindFlagReturn the channel binding flag.@Nullable StringReturn the channel binding type.static @NotNull Gs2HeaderRead a Gs2Header from a String.
-
Constructor Details
-
Gs2Header
public Gs2Header(@NotNull @NotNull Gs2CbindFlag cbindFlag, @Nullable @Nullable String cbName, @Nullable @Nullable String authzid) 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 if channel binding is requiredauthzid- The optional SASL authorization identity- Throws:
IllegalArgumentException- If the channel binding flag and argument are invalid
-
Gs2Header
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
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 Details
-
getChannelBindingFlag
Return the channel binding flag.- Returns:
- the
gs2-cbind-flag
-
getChannelBindingName
Return the channel binding type.- Returns:
- the
cb-name
-
getAuthzid
Return the authzid.- Returns:
- the
"a=" saslname
-
parseFrom
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
-