code: public static DuoCookie parseDuoCookie(String str) throws GuacamoleException {
  
          // Attempt to decode data as base64
          String data;
          try {
              data = new String(BaseEncoding.base64().decode(str), "UTF-8");
          }
  
          // Bail if invalid base64 is provided
          catch (IllegalArgumentException e) {
              throw new GuacamoleClientException("Username is not correctly "
                      + "encoded as base64.", e);
          }
  
          // Throw hard errors if standard pieces of Java are missing
          catch (UnsupportedEncodingException e) {
              throw new UnsupportedOperationException("Unexpected lack of "
                      + "UTF-8 support.", e);
          }
  
          // Verify format of provided data
          Matcher matcher = COOKIE_FORMAT.matcher(data);
          if (!matcher.matches())
              throw new GuacamoleClientException("Format of base64-encoded "
                      + "username is invalid.");
  
          // Get username and key (simple strings)
          String username = matcher.group(USERNAME_GROUP);
          String key = matcher.group(INTEGRATION_KEY_GROUP);
  
          // Parse expiration time
          long expires;
          try {
              expires = Long.parseLong(matcher.group(EXPIRATION_TIMESTAMP_GROUP));
          }
  
          // Bail if expiration timestamp is not a valid long
          catch (NumberFormatException e) {
              throw new GuacamoleClientException("Expiration timestamp is "
                      + "not valid.", e);
          }
  
          // Return parsed cookie
          return new DuoCookie(username, key, expires);
  
      }
docs: Parses a base64-encoded Duo cookie, producing a new DuoCookie object
  containing the data therein. If the given string is not a valid Duo
  cookie, an exception is thrown. Note that the cookie may be expired, and
  must be checked for expiration prior to actual use.
  
  @param str
  The base64-encoded Duo cookie to parse.
  
  @return
  A new DuoCookie object containing the same data as the given
  base64-encoded Duo cookie string.
  
  @throws GuacamoleException
  If the given string is not a valid base64-encoded Duo cookie.