本文介绍了银光应用中的 Pentaho 认证方法.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将 Pentaho 与 Silverlight 平台集成.对于身份验证,有用户控制台的登录页面.我不想用上面的登录页面登录,我想用后面的代码登录.

I want to integrate Pentaho with Silverlight platform.For the Authentication, there is log in page for user console. I do not want use above login page to login, I want to login in code behind.

我尝试过基本身份验证,但在新版本中不起作用.

I tried basic authentication, but in new version it won't work.

 string[] parts = System.Text.RegularExpressions.Regex.Split(ae.Result, "/");
                    String data = "userid=" + App.UserName + "&password=" + App.Password;
                    WebClient webClient = new System.Net.WebClient();
                    Uri uri = new Uri("http://localhost:8080/pentaho/Home?" + data);
                    webClient.Headers["Content-Type"] = "application/x-www-form-urlencoded";
                    webClient.Encoding = Encoding.UTF8;
                    App.WindowManager.ConsoleWrite(uri.ToString());
                    webClient.UploadStringAsync(uri, "POST", "");

但它适用于以前版本的 Pentaho.我知道 Pentaho 中几乎没有其他方法可用.但它应该能够在 Silverlight 应用程序中做到.您知道在 Silverlight 应用程序中执行此操作的任何其他解决方案吗?

But its worked with previous version of Pentaho. I know there are few other methods available in Pentaho. But it should able to do in Silverlight application.do you know any other solution for do it in Silverlight Application ?

在此先非常感谢您!!!

Thanks you very much in advance!!!

推荐答案

Authenticate with query string 方法是不安全的,所以我找到了一个使用 Basic Authentication 方法的解决方案.

Authenticate with query string method is unsecured one, so I found a solution with Basic Authentication method.

WebClient webClient = new System.Net.WebClient();
Uri uri = new Uri("http://serverDomain:8080/pentaho/Home");
//Give user name and password here
var plainTextBytes = System.Text.Encoding.UTF8.GetBytes("username:password");
var encodedString = System.Convert.ToBase64String(plainTextBytes);
webClient.Headers["Authorization"] = "Basic " + encodedString;
webClient.Encoding = Encoding.UTF8;
App.WindowManager.ConsoleWrite(uri.ToString());
webClient.UploadStringAsync(uri, "POST", "");

这篇关于银光应用中的 Pentaho 认证方法.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-31 18:05