Invoking Sitefinity authentication

Posted by Community Admin on 03-Aug-2018 08:58

Invoking Sitefinity authentication

All Replies

Posted by Community Admin on 15-Apr-2011 00:00

Hello,
I've written my custom role provider, now I need to integrate SF with another website I've... this website has its own membership provider (ASP.NET) and I wish to have a link in my application that performs the SF authentication in a silent way..... consider it a passthrought... how can I achieve this?

Thanks
Paolo

Posted by Community Admin on 18-Apr-2011 00:00

Hi Paolo,

You should have some service that makes a call and authenticate the user.

Regards,
Ivan Dimitrov
the Telerik team


Posted by Community Admin on 18-Apr-2011 00:00

in what sense?
a service in sitefinity?

Posted by Community Admin on 26-Apr-2011 00:00

hello,
can someone help me on this? thanks

Posted by Community Admin on 29-Apr-2011 00:00

Hello Paolo,

You can use /Sitefinity/Services/Security/Users.svc/ and make HttpWebRequest. The method you should pass to the service is called "Authenticate"
I will try to prepare a sample an post in on Monday.

Best wishes,
Ivan Dimitrov
the Telerik team

Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

Posted by Community Admin on 02-May-2011 00:00

Hello Ivan,
I've succeded in authenticating using this :

if (!IsPostBack)
         
             Telerik.Sitefinity.Security.Web.Services.Users userService = new Telerik.Sitefinity.Security.Web.Services.Users();
             Telerik.Sitefinity.Security.Credentials credentials = null;
             string userName = string.Empty;
             string password = string.Empty;
             bool isPersistent = false;
             if (Request.Params["username"] != null)
             
                 userName = Request.Params["username"];
             
             if (Request.Params["password"] != null)
             
                 password = Request.Params["password"];
             
             if (Request.Params["persistent"] != null)
             
                 isPersistent = Convert.ToBoolean(Request.Params["persistent"]);
             
             if (!string.IsNullOrWhiteSpace(userName) && !string.IsNullOrWhiteSpace(password))
             
                 credentials = new Telerik.Sitefinity.Security.Credentials();
                 credentials.UserName = userName;
                 credentials.Password = password;
                 credentials.MembershipProvider = ConfigurationManager.AppSettings["membershipProvider"];
                 credentials.Persistent = isPersistent;
             
             if (credentials == null)
             
                 //redirect to login page
                 RedirectToLoginPage();
             
             try
             
                 UserLoggingReason reason = userService.AuthenticateUser(credentials);
                 if (reason == UserLoggingReason.Success)
                 
                     string destPage = ResolveUrl(landingPage);
                     Response.Redirect(destPage, false);
                 
                 else
                 
                     //redirect to login page
                     RedirectToLoginPage();
                 
             
             catch (Exception ex)
             
                 Response.Write(ex.Message);
             
         

Can this be ok?
Thanks

Posted by Community Admin on 02-May-2011 00:00

Hi Paolo,

I would prefer using a call to the web service directly, but since this works for you it is fine.

All the best,
Ivan Dimitrov
the Telerik team

Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

Posted by Community Admin on 02-May-2011 00:00

Ivan I use this since I redirect the users to a landing page dipending on user's role...
It's easier for me of doing so...
Thanks

This thread is closed