Class ScramStringFormatting

java.lang.Object
com.ongres.scram.common.ScramStringFormatting

final class ScramStringFormatting extends Object
Class with static methods that provide support for converting to/from salNames.
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    (package private) static final com.ongres.stringprep.Profile
     
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    private
     
  • Method Summary

    Modifier and Type
    Method
    Description
    (package private) static byte @NotNull []
    base64Decode(@NotNull String value)
     
    (package private) static @NotNull String
    base64Encode(byte @NotNull [] value)
     
    (package private) static @Nullable String
    fromSaslName(@Nullable String value)
    Given a saslName, return a non-escaped String.
    (package private) static @NotNull String
    toSaslName(@NotNull String value)
    Given a value-safe-char (normalized UTF-8 String), return one where characters ',' and '=' are represented by '=2C' or '=3D', respectively.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • SASL_PREP

      static final com.ongres.stringprep.Profile SASL_PREP
  • Constructor Details

    • ScramStringFormatting

      private ScramStringFormatting()
  • Method Details

    • toSaslName

      @NotNull static @NotNull String toSaslName(@NotNull @NotNull 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

      @Nullable static @Nullable String fromSaslName(@Nullable @Nullable String value)
      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

      @NotNull static @NotNull String base64Encode(byte @NotNull [] value)
    • base64Decode

      static byte @NotNull [] base64Decode(@NotNull @NotNull String value)