Class ScramStringFormatting


  • final class ScramStringFormatting
    extends java.lang.Object
    Class with static methods that provide support for converting to/from salNames.
    See Also:
    [RFC5802] Section 7: Formal Syntax
    • Field Summary

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

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      (package private) static byte @NotNull [] base64Decode​(@NotNull java.lang.String value)  
      (package private) static @NotNull java.lang.String base64Encode​(byte @NotNull [] value)  
      (package private) static @Nullable java.lang.String fromSaslName​(@Nullable java.lang.String value)
      Given a saslName, return a non-escaped String.
      (package private) static @NotNull java.lang.String toSaslName​(@NotNull java.lang.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 Detail

      • SASL_PREP

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

      • ScramStringFormatting

        private ScramStringFormatting()
    • Method Detail

      • toSaslName

        @NotNull
        static @NotNull java.lang.String toSaslName​(@NotNull
                                                    @NotNull java.lang.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 java.lang.String fromSaslName​(@Nullable
                                                       @Nullable java.lang.String value)
        Given a saslName, return a non-escaped String.
        Parameters:
        value - The saslName
        Returns:
        The saslName, unescaped
        Throws:
        java.lang.IllegalArgumentException - If a ',' character is present, or a '=' not followed by either '2C' or '3D'
      • base64Encode

        @NotNull
        static @NotNull java.lang.String base64Encode​(byte @NotNull [] value)
      • base64Decode

        static byte @NotNull [] base64Decode​(@NotNull
                                             @NotNull java.lang.String value)