Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsOther Extension...Other Extension...Building a new Authentication SystemBuilding a new Authentication System
Previous
 
Next
New Post
4/12/2010 11:45 AM
 

Hi all,

I am quite new to DNN/.Net development so feel free to correct me as I go along.

I have started building an authentication provider that would use information obtained from the HTTP Header to "automatically" log the user into DNN.  The idea would be to have DNN sitting behind some 3rd party access management tool (i.e. Siteminder).  The user would authenticate into the 3rd party tool which would then redirect them to the DNN home page.  When the user is authenticated with the 3rd party tool, a set of HTTP Headers are created.  One element would be the user id of the person logged in (i.e. SM_USER). 

The DNN Authentication Module would sit on the home page. When the page loads, the authentication provider would read what HTTP Header element to look for, obtain the user id from that element, and log into DNN with no intervention from the user.  If, for some reason, DNN could not authenticate the user id, then the user would be redirected to another address provided in the settings area.

I have started a project on CodePlex but there was a server error of some sort and I will post the code that I have so far when I can.  In the meantime, does anybody have any recommendations as to how to proceed?

The problem that I have right now with the code is obtaining information from the settings section of the module.  Below is the code that I am using.  Any suggestions would be appreciated.

 

LOGIN.ASCX.CS

using

System;

//using System.Collections;

using

System.Collections.Specialized;

using

System.Reflection;

using

System.Web;

using

DotNetNuke.Services.Authentication;

using

DotNetNuke.UI.Utilities;

using

DotNetNuke;

using

DotNetNuke.Entities.Users;

using

DotNetNuke.Security.Membership;

using

DotNetNuke.Common;

using

DotNetNuke.Common.Utilities;

using

DotNetNuke.Entities.Modules;

using

 

DotNetNuke.Services.Exceptions;

namespace

{

 

IAPWS.Modules.HeaderAuthentication// -----------------------------------------------------------------------------

 

// <summary>

 

// The Login AuthenticationLoginBase is used to provide a login for a registered user

 

// portal.

 

// </summary>

 

// <remarks>

 

// </remarks>

 

// <history>

 

// [cnurse] 9/24/2004 Updated to reflect design changes for Help, 508 support

 

// and localisation

 

// [cnurse] 08/07/2007 Ported to new Authentication Framework

 

// </history>

 

// -----------------------------------------------------------------------------

 

public partial class Login : AuthenticationLoginBase

{

 

 

private string _appID;private string _sHeader; // Used to identify what HTTP Header will contain the username of the pre-validated user.

 

private string _sUserName; // Used to store the actual username of the user

 

 

 

 

 

private string _sFailedLoginURL;private string _sLogoutURL;UserInfo objUser;//bool bAmAdmin; // Is this person listed as an administrator?

#region

 

{

 

 

}

 

{

 

 

}

 

{

 

 

}

 

{

 

 

}

 

{

 

 

}

 

{

 

 

}

 

{

 

}

Public Propertiespublic string AppIDget { return _appID; }set { _appID = value; }public string sHeaderget { return _sHeader; }set { _sHeader = value; }public string sUserNameget { return _sUserName; }set { _sUserName = value; }public string sFailedLoginURLget { return _sFailedLoginURL; }set { _sFailedLoginURL = value; }public string sLogoutURLget { return _sLogoutURL; }set { _sLogoutURL = value; }public override bool Enabledget { return AuthenticationConfig.GetConfig(PortalId).Enabled; }public string ReturnURLget { return Null.NullString; }

#endregion

#region

 

{

 

Private Methodsprivate void loginUser(string pUserName)//Try and Log User into DNN

 

 

UserLoginStatus loginStatus = UserLoginStatus.LOGIN_FAILURE;// Alterations to be done..

 

// user object will need to be populated.

 

 

UserInfo objUser = UserController.ValidateUser(PortalId, pUserName, "DNN", "", PortalSettings.PortalName, IPAddress, ref loginStatus);//Raise UserAuthentication Event

 

OnUserAuthenticated(eventArgs);

}

UserAuthenticatedEventArgs eventArgs = new UserAuthenticatedEventArgs(objUser, sUserName, loginStatus, "DNN");

#endregion

#region

 

{

 

}

 

{

 

Protected Methodsprotected override void OnInit(EventArgs e)base.OnInit(e);protected override void OnLoad(EventArgs e)// This is the key area..

 

// 1. Obtain HTTP Header marker to look for.

 

// 2. Using HTTP Header marker, obtain username.

 

// 3. Log user into DNN using username.

 

 

try

{

 

//HttpResponse res = HttpContext.Current.Response;

 

// 1. Establish connection to Header area.

 

//HttpRequest req = HttpContext.Current.Request;

 

// 2. Obtain username header marker (i.e. SM_USER) to look for.

 

//AuthenticationConfig config = AuthenticationConfig.GetConfig(PortalId);

 

//sHeader = config.HeaderVariable;

 

// 3. Using username header marker, obtain username from header.

 

//NameValueCollection colHeaders = req.Headers;

 

//sUserName = colHeaders.GetValues(sHeader);

sHeader =

 

AuthenticationConfig.GetConfig(PortalId).fldHeader;//sFailedLoginURL = colHeaders.GetValues("FailedLoginURL");

 

// 4. Log user into DNN.

loginUser(sUserName);

}

 

{

 

res.Redirect(sFailedLoginURL,

 

}

 

catch (Exception exc)HttpResponse res = HttpContext.Current.Response;true);//base.OnLoad(e);

}

#endregion

}

 

}

 

 
New Post
4/13/2010 11:54 AM
 
What is the error message that you are getting?

-Mitchel Sellers
Microsoft MVP, ASPInsider, DNN MVP
CEO/Director of Development - IowaComputerGurus Inc.
LinkedIn Profile

Visit mitchelsellers.com for my mostly DNN Blog and support forum.

Visit IowaComputerGurus.com for free DNN Modules, DNN Performance Tips, DNN Consulting Quotes, and DNN Technical Support Services
 
New Post
4/20/2010 1:39 PM
 
Thanks for the reply and sorry for the delay in response. Found this problem. I was using the completely wrong methodology for storing the settings to begin with. I'm to the point now of registering the Authentication system in DNN but am getting an "Exception - Illegial characters in path" error. Below is my manifest file. This is being installed on the community edition 5.3.1against a SQL Server Express 2005 DB. Any suggestions would be appreciated.




IAPWS HeaderAuthentication
HeaderAuthentication
A HeaderAuthentication module to read the HTTP Header for a given marker. That marker will be used for the userid to be logged into DNN.



HeaderAuthentication

DesktopModules/AuthenticationServices/HeaderAuthentication/Settings.ascx


DesktopModules/AuthenticationServices/HeaderAuthentication/Login.ascx


DesktopModules/AuthenticationServices/HeaderAuthentication/Logoff.ascx






bin
HeaderAuthentication.dll
00.01.00






DesktopModules/AuthenticationServices/HeaderAuthentication


App_LocalResources
Login.ascx.resx


App_LocalResources
Logoff.ascx.resx


App_LocalResources
Settings.ascx.resx


Login.ascx


Logoff.ascx


Settings.ascx








 
New Post
4/22/2010 2:37 PM
 
Did this methodology work for you? I am trying to accomplish a similar goal (ADFS instead of Siteminder). I keep getting put into an infinite loop. Thanks,, Richard
 
New Post
4/29/2010 12:24 PM
 

I don't know if this would be of any use, but I have just posted a blog about how you don't have to create your own Authentication Provider to implement a 3rd party authentication solution including Siteminder and ADFS. It is here: http://binnington.wordpress.com

Richard

 
Previous
 
Next
HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsOther Extension...Other Extension...Building a new Authentication SystemBuilding a new Authentication System


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

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

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. 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.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out