简体   繁体   English

如何使用 .NET Core 3.1 对 Maximo 7.6 进行身份验证?

[英]How to authenticate to Maximo 7.6 with .NET Core 3.1?

I'm not able to authenticate to get LtpaToken2 and JSESSIONID.我无法通过身份验证来获取 LtpaToken2 和 JSESSIONID。 Here is the code:这是代码:

        string url = "http://maximo.local/maximo/"; //http://maximo.local/maximo/j_security_check?j_username=admin&j_password=admin

        string uri = "oslc/login";
        using (HttpClient client = new HttpClient())
        {

            client.BaseAddress = new Uri(url);
            string username = "admin";
            string password = "admin";

            client.DefaultRequestHeaders.Add($"Authorization", $"Basic {Base64Encode($"{username}:{password}")}");
            
            string paramentros = ""; 

            var response = client.PostAsync(uri, new StringContent(paramentros, Encoding.UTF8, "application/json")).Result;
            

            if (response.IsSuccessStatusCode)
            {
                var jsonString = await response.Content.ReadAsStringAsync();
            }

What could be wrong?可能有什么问题?

Does your Maximo store the username and password?您的 Maximo 是否存储用户名和密码?

Native Authentication in Maximo uses a header to log in through the rest api, but it's not as you have it. Maximo 中的本机身份验证使用标头通过其余 api 登录,但这与您所拥有的不同。

So you want to have the header maxauth and then the value is the base64 encoded userid:password.因此,您希望拥有标头 maxauth,然后该值为 base64 编码的 userid:password。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM