All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.citrix.sharefile.api.authentication.SFAuthUtils Maven / Gradle / Ivy

package com.citrix.sharefile.api.authentication;

import com.citrix.sharefile.api.constants.SFKeywords;

import org.apache.http.NameValuePair;

import java.io.UnsupportedEncodingException;
import java.util.List;

public class SFAuthUtils
{
    public static final String buildWebLoginTokenUrl(String controlplane,String subdomain)
    {
        String strDot = controlplane.startsWith(".")?"":".";

        return  "https://"+subdomain+strDot+controlplane+ SFKeywords.SF_OAUTH_TOKEN_PATH;
    }

    public static final String getBodyForWebLogin(List params) throws UnsupportedEncodingException
    {
        StringBuilder result = new StringBuilder();
        boolean first = true;

        for (NameValuePair pair : params)
        {
            if (first)
            {
                first = false;
            }
            else
            {
                result.append("&");
            }

            result.append(pair.getName());
            result.append("=");
            result.append(pair.getValue());
        }

        return result.toString();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy