java.util.Base64 urlEncoder should omit padding

XMLWordPrintable

    • Type: Enhancement
    • Resolution: Fixed
    • Priority: P3
    • 8
    • Affects Version/s: 8
    • Component/s: core-libs
    • b117
    • linux
    • Verified

        A DESCRIPTION OF THE REQUEST :

        java.util.Base64.getUrlEncoder() should not apply padding at the end of encoding.

        Alternatively, padding control should be exposed as an option. There are several variants of base64 encoding where padding should be omitted: http://en.wikipedia.org/wiki/Base64#Variants_summary_table


        JUSTIFICATION :
        This is a fairly common scenario. In base64url encoding padding is usually omitted. It is certainly optional and if present should actually be URL encoded as %3D.

        Thus, the default behavior of Base64.getUrlEncoder should be changed to omit padding.




        CUSTOMER SUBMITTED WORKAROUND :

        One could keep using the various libraries available that support this properly (eg. Guava, Apache Commons, etc), but this defeats the purpose of having this functionality in the JDK.

              Assignee:
              Xueming Shen
              Reporter:
              Ivan Gerasimov
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: