开发者

FileNet P8 workplace token issue

I am trying to get user token and build the URL so that user need not login everytime they click the file. below is my code. My question is do I need to pass whole of the token value shown below or?? The token value I am getting is

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

The problem is, once i copy the URL and past it in the browser, it is taking me to the login page. Though I am not getting any开发者_StackOverflow社区 errors, it should take users directly to the imageviewer but instead it takes me to login page, if I login it is opening the file correctly.

What am I doing wrong?

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;


Here is my function, you can see the last couple lines how I unroll the token at the end:

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);
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜