Domanda

Sto cercando di ottenere token dell'utente e costruire l'URL in modo che necessità utente non effettua il login ogni volta che fanno clic sul file. qui di seguito è il mio codice. La mia domanda è ho bisogno di passare tutto il valore simbolico mostrato di seguito o ?? Il valore del token che sto ottenendo è

symmetric:algorithm:QUVT:keyid:NTZkYTNkNmI=:data:7P9aJHzkfGTOlwtotuWGaMqfU9COECscA9yxMdK64ZLa298A3tsGlHKHDFp0cH+gn/SiMrwKfbWNZybPXaltgo5e4H4Ak8KUiCRKWfS68qhmjfw69qPv9ib96vL3TzNORYFpp/hrwvp8aX4CQIZlBA==

Il problema è che, una volta che copiare l'URL e passato nel browser, che mi sta prendendo per la pagina di login. Anche se io non sto ottenendo eventuali errori, si dovrebbe prendere gli utenti direttamente al ImageViewer ma invece mi porta alla pagina di login, se faccio il login si apre correttamente il file.

Che cosa sto facendo di sbagliato?

string text = "";
            string userName = "userName";
            string pwd = "*****";
            fileNetID = "{5FCE7E04-3D74-4A93-AA53-26C12A2FD4FC}";
            Uri uri = null;
            string workplaceURL = "http://filenet:9081/WorkPlaceXT";
            uri = new Uri(workplaceURL + "/setCredentials?op=getUserToken&userId=" + this.encodeLabel(userName) + "&password=" + this.encodeLabel(pwd) + "&verify=true");
            System.Net.WebRequest webRequest = System.Net.WebRequest.Create(uri);
            System.Net.WebResponse webResponse = webRequest.GetResponse();
            StreamReader streamReader = new StreamReader(webResponse.GetResponseStream());
            String token = streamReader.ReadToEnd();
            string contentURL = string.Empty;
            contentURL = workplaceURL + "/getContent?objectType=document&impersonate=true&objectStoreName=OBJECTSTORE&id=" + HttpUtility.UrlEncode(fileNetID);
            contentURL += "&ut=" + HttpUtility.UrlEncode(encodeLabel(token));
            return contentURL;

Nessuna soluzione corretta

Altri suggerimenti

Questa è la mia funzione, è possibile vedere le ultime righe di coppia come mi srotolo il token alla fine:

public static string getCEUserToken(string baseURL, string uid, string pwd)
{
    string UserToken = "";
    System.Net.WebRequest request = System.Net.WebRequest.Create(baseURL +      "/setCredentials?op=getUserToken&userId=" + uid + "&password=" + pwd +
    "&verify=true");
    request.Method = "POST";
    System.Net.WebResponse response = request.GetResponse();
    Stream stream = response.GetResponseStream();
    byte[] token = new byte[response.ContentLength];
    stream.Read(token, 0, (int)response.ContentLength);
    response.Close();

    foreach (byte chr in token)
        UserToken += System.Convert.ToChar(chr);

    return System.Web.HttpUtility.UrlEncode(UserToken);
}
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top