Invoking Sitefinity authentication
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
Hi Paolo,
You should have some service that makes a call and authenticate the user.
Regards,
Ivan Dimitrov
the Telerik team
in what sense?
a service in sitefinity?
hello,
can someone help me on this? thanks
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
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);
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
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