code: private String ensurePadding(String base64) {
          int length = base64.length();
          if (length % 4 != 0) {
              StringBuilder sb = new StringBuilder(base64);
              for (int i = 0; i < length % 4; ++i) {
                  sb.append('=');
              }
              base64 = sb.toString();
          }
          return base64;
      }
docs: Sometimes a user agent will send the rememberMe cookie value without padding,
  most likely because {@code =} is a separator in the cookie header.
  <p/>
  Contributed by Luis Arias.  Thanks Luis!
  
  @param base64 the base64 encoded String that may need to be padded
  @return the base64 String padded if necessary.