io.getlime.security.powerauth.http.PowerAuthRequestCanonizationUtils Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of powerauth-java-http Show documentation
Show all versions of powerauth-java-http Show documentation
PowerAuth 2.0 utility module for HTTP support
/*
* Copyright 2016 Lime - HighTech Solutions s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.getlime.security.powerauth.http;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.net.URLEncoder;
import java.util.*;
public class PowerAuthRequestCanonizationUtils {
/**
* Utility variable, used for the purpose of GET query attribute sorting (query attribute key).
*/
private static final String KEY = "key";
/**
* Utility variable, used for the purpose of GET query attribute sorting (query attribute value).
*/
private static final String VAL = "val";
/**
* Take the GET request query string (for example, "param1=key1¶m2=key2") and convert it to the
* canonized form by sorting the key value pairs primarily by keys and by values in case the keys are
* equal.
*
* @param queryString The original get query string, obtained for example by 'request.getQueryString();'.
* @return Canonized query string.
* @throws UnsupportedEncodingException In case UTF-8 is not supported.
*/
public static String canonizeGetParameters(String queryString) {
try {
if (queryString == null) {
return "";
}
List
© 2015 - 2025 Weber Informatics LLC | Privacy Policy