DNN Forums

Ask questions about your website to get help learning DNN and help resolve issues.

ReturnURL on a custom authentication provider

 1 Replies
 2 Subscribed to this topic
 26 Subscribed to this forum
Sort:
Author
Messages
Growing Member
Posts: 54
Growing Member

I have a custom authentication provider that is working well but it doesn't support ReturnURL seems.

The Login class inherits from AuthenticationLoginBase and it has a piece of code like this:

                           UserLoginStatus loginStatus = validStatus == UserValidStatus.VALID ? UserLoginStatus.LOGIN_SUCCESS : UserLoginStatus.LOGIN_FAILURE;
                           if (loginStatus == UserLoginStatus.LOGIN_SUCCESS)
                           {
                               SetLoginDate(username);

                               // Raise UserAuthenticated Event
                               var eventArgs = new UserAuthenticatedEventArgs(userInfo, userInfo.Email, loginStatus, config.DNNAuthName)
                               {
                                   Authenticated = true,
                                   Message = "User authorized",
                                   RememberMe = false
                               };
                               OnUserAuthenticated(eventArgs);
                               if (Request.Params["RelayState"] != null)
                               {
                                   string redirectUrl = HttpUtility.UrlDecode(Request.Params["RelayState"]);
                                   Response.Redirect(redirectUrl);
                               }

Notice how it calls OnUserAuthenticated(...). The problem is that after this call it never comes back, so all code that goes after this line is not executed.

And so the RelayState parameter that contains the url the user should be redirected to is never done.

 

Is there a way to force DNN to know that it has to return to a specific url after the login is completed? if so how?

Vicenç Masanas
Disgrafic ITec SL Banyoles - Spain
Senior Member
Posts: 1607
Senior Member
MVP
MVP
You're an MVP!
New Poster
New Poster
Congrats on posting!

Normally that event is called last.  Maybe you can create an alternative method async to run the same logic in your provider? 

These Forums are for the discussion of the open source CMS DNN platform and ecosystem.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. If you have (suspected) security issues, please DO NOT post them in the forums but instead follow the official DNN security policy
  2. No Advertising. This includes the promotion of commercial and non-commercial products or services which are not directly related to DNN.
  3. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  4. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  5. No Flaming or Trolling.
  6. No Profanity, Racism, or Prejudice.
  7. Site Moderators have the final word on approving / removing a thread or post or comment.
  8. English language posting only, please.

Would you like to help us?

Awesome! Simply post in the forums using the link below and we'll get you started.

Get Involved