0

My goal is to perform Single sign on functionality from my WPF application which has a embedded browser . Single sign on needs to be implemented for this so that the user should not be asked to enter this credentials again to check the reports from the wpf browser. I need to create a local environment for testing this functionality from my side since I am developing for a product i.e a sql report which has forms authentication and logging to the report from my application. I have browsed almost everything on the net regarding this implementation and the sample provided by microsoft for forms authentication is not working. I also find certain condition that the sample will not work in Itanium based processors etc.. and I am working on ssrs 2012. Sign on with capturing the DOM of reporting site and peforming the login wouldn't be a good idea since this is for a product and reporting login will not be same. I am thinking of implementing with Httpwebrequest and Response, but still not clear on implementing. Some one please provide me crisp and working solution for my implementation. Thanks in advance.

Darey
  • 497
  • 4
  • 24

2 Answers2

0

Some one please provide me crisp and working solution for my implementation.

I wouldn't count on that, especially if you're asking for a source code solution.

Single sign-on assumes that you still have an authentication server somewhere, something like Google OAuth. From your question, it isn't quite clear to me if that's what your looking for. If you just need to supply custom credentials to WebBrowser control, that's still possible, but that solution is for WinForms version of WebBrowser control. The WPF version is sealed from customization, so you may have better luck hosting the WinForms WebBrowser in your WPF project, using WindowsFormsHost.

Community
  • 1
  • 1
noseratio
  • 59,932
  • 34
  • 208
  • 486
  • Thanks for your response, I checked on the links you provided, But the method LogonUser which we implement from advapi.dll checks for the windows authentication. I am looking to navigate to a website by passing the user credentials. Thanks. – Darey Sep 16 '13 at 16:59
0

I finally found the way for Implementing single sign on for reporting services. The standard way for implementing single sign on for forms authentication is by using custom security extension sample. The configuration is a bit tricky, But once the configuration is done single sign on needs to be done by getting the auth token by calling Logonuser() methon in reporting service. The below code passes the credentials and returns auth token.

Configuring forms authentication can be found detailed here http://www.codeproject.com/Articles/675943/SSRS-2012-Forms-Authentication

The below code helps me to achieve single sign on.

 [DllImport("wininet.dll", CharSet = CharSet.Auto, SetLastError = true)]
static extern bool InternetSetCookie(string lpszUrlName, string lpszCookieName, string lpszCookieData);
private void GetAuthToken(string username, string password)
{
// Step1: Add reference to report service either by directly referencing the reportinservice.asmx service of by converting wsdl to class file.

 ReportServerProxy2010 rsProxy = new ReportServerProxy2010();
//Step2: Assign the report server service eg:"http://<servername>/ReportServer/ReportService2010.asmx";

              rsProxy.Url = string.Format(ReportServerUrl, ReportServer);
try
              {
                rsProxy.LogonUser(username,password, null);
                Cookie authCookie = rsProxy.AuthCookie;
if (authCookie != null)
                {
//Internet Set Cookie is a com method which sets the obtained auth token to internet explorer

                  InternetSetCookie(Url, null, authCookie.ToString());
                }
              }
catch (Exception ex)
              {
              }
            }
//When navigating now, the auth token is accepted and report manager page is displayed directly without asking for login credentials.
WebBrowserControl.Navigate(new Uri("");}
Darey
  • 497
  • 4
  • 24