Class ScramStringFormatting
- java.lang.Object
-
- com.impossibl.postgres.protocol.sasl.scram.ScramStringFormatting
-
public class ScramStringFormatting extends Object
Class with static methods that provide support for converting to/from salNames.- See Also:
- [RFC5802] Section 7: Formal Syntax
-
-
Constructor Summary
Constructors Constructor Description ScramStringFormatting()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static byte[]
base64Decode(String value)
static String
base64Encode(byte[] value)
static String
base64Encode(String value)
static String
fromSaslName(String value)
Given a saslName, return a non-escaped String.static String
toSaslName(String value)
Given a value-safe-char (normalized UTF-8 String), return one where characters ',' and '=' are represented by '=2C' or '=3D', respectively.
-
-
-
Method Detail
-
toSaslName
public static String toSaslName(String value)
Given a value-safe-char (normalized UTF-8 String), return one where characters ',' and '=' are represented by '=2C' or '=3D', respectively.- Parameters:
value
- The value to convert so saslName- Returns:
- The saslName, with caracter escaped (if any)
-
fromSaslName
public static String fromSaslName(String value) throws IllegalArgumentException
Given a saslName, return a non-escaped String.- Parameters:
value
- The saslName- Returns:
- The saslName, unescaped
- Throws:
IllegalArgumentException
- If a ',' character is present, or a '=' not followed by either '2C' or '3D'
-
base64Encode
public static String base64Encode(byte[] value) throws IllegalArgumentException
- Throws:
IllegalArgumentException
-
base64Encode
public static String base64Encode(String value) throws IllegalArgumentException
- Throws:
IllegalArgumentException
-
base64Decode
public static byte[] base64Decode(String value) throws IllegalArgumentException
- Throws:
IllegalArgumentException
-
-