FileNet P8 工作场所令牌问题

发布于 2024-09-03 11:04:45 字数 1527 浏览 4 评论 0原文

我正在尝试获取用户令牌并构建 URL,以便用户每次单击文件时都不需要登录。下面是我的代码。 我的问题是我是否需要传递下面显示的整个令牌值? 我得到的令牌值是

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

问题是,一旦我复制 URL 并将其粘贴到浏览器中,它就会将我带到登录页面。虽然我没有收到任何错误,但它应该将用户直接带到图像查看器,但它会带我进入登录页面,如果我登录,它会正确打开文件。

我做错了什么?

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;

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 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;

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

朮生 2024-09-10 11:04:45

这是我的函数,您可以看到最后几行我如何在最后展开令牌:

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

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);
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文