code: static String toRedirectionUrl(SAMLObject msg,
                                     String endpointUrl,
                                     String messageParamName,
                                     Credential signingCredential,
                                     String signatureAlgorithm,
                                     @Nullable String relayState) {
          requireNonNull(msg, "msg");
          requireNonNull(endpointUrl, "endpointUrl");
          requireNonNull(messageParamName, "messageParamName");
          requireNonNull(signingCredential, "signingCredential");
          requireNonNull(signatureAlgorithm, "signatureAlgorithm");
  
          final QueryStringEncoder encoder = new QueryStringEncoder("");
          encoder.addParam(messageParamName, toDeflatedBase64(msg));
  
          if (relayState != null) {
              // RelayState data MAY be included with a SAML protocol message transmitted with this binding.
              // The value MUST NOT exceed 80 bytes in length and SHOULD be integrity protected by the entity
              // creating the message independent of any other protections that may or may not exist
              // during message transmission.
              if (relayState.length() > 80) {
                  throw new IllegalArgumentException("too long relayState string: " + relayState.length());
              }
              encoder.addParam(RELAY_STATE, relayState);
          }
  
          encoder.addParam(SIGNATURE_ALGORITHM, signatureAlgorithm);
  
          // Use URL-encoded query string as input.
          final String input = encoder.toString().substring(1);
          final String output = generateSignature(signingCredential, signatureAlgorithm, input);
          encoder.addParam(SIGNATURE, output);
  
          return endpointUrl + encoder;
      }
docs: Returns a redirected URL which includes a deflated base64 string that is converted from the specified
  {@link SAMLObject}. The URL must contain a signature of the generated query string.