Small width layout Medium width layout Maximum width layout Small text Medium text Large text
     Search
Downloads Downloads Directory Directory Forums Forums Forge Forge Blogs Blogs        Marketplace Marketplace Careers Program Careers
Community › Forums Register  |  

Affordable ASP.NET Hosting Service
  Need Help?  
Professional technical support for DotNetNuke is available from DotNetNuke Corporation.
 


  Ads  
Engage Software - Training Partner for DotNetNuke
 


  Sponsors  

Meet Our Sponsors

Merak Mail Server
WebSecureStores -- ASP.NET & DotNetNuke Hosting Solutions
FCKeditor Project
Salaro -- Skins and more
OnyakTech
The best choice for your web site host, email hosting, and domain registration.
 


DotNetNuke Forums
 
  Forum  General DotNetN...  Extend It! ( Pr...  Automatic Signin to DNN
Previous Previous
 
Next Next
New Post 9/17/2006 10:04 AM
User is offline Monty Alger
8 posts
10th Ranked


Automatic Signin to DNN 

Hi, I am running DNN 4.3.5 and am looking to implement an automatic SignIn utility.  Currently we use Netegrity Single Sign On with a policy server on our intranet.  I have a protected page "index.aspx" which redirets to the policy server if that page is not authenticated.   When it redirects back to the page the username, user infromation is contained with the header and can be extracted.

I would like to take this redirected user information and create a module which will insert the user name , email etc into the DNN user database and authenticate that user.   If the user is already existing just log in the user automatically through this redirect.

Does someone have a way that I can do this with something that might have been created already.  I have read the .pdf file describing users / roles etc and suspect it can be donel.

Any help would be greatly appreciated.

Thanks.

 
New Post 9/24/2006 4:57 AM
User is offline Monty Alger
8 posts
10th Ranked


Re: Automatic Signin to DNN 

I came up with a way to do this.  If interested let me know. 

I took a few items from the login moduels and created this class with a couple subs.  I put a couple lines in the top of default.aspx to detect for username in the query string and if it is found then call class below.  Security isnt an issue because I get the login data back from siteminder which runs on our intranet and does external user login.  What I did below is not clean, just enough to get it going and prove how it could be done.

Namespace montyalger.autologin

Public Class AutoLoginBase

Inherits DotNetNuke.Entities.Modules.PortalModuleBase

Sub AutoLogin(ByVal _portalID As Long, ByVal _username As String, ByVal _password As String, ByVal _IPAddress As String)

Dim loginStatus As UserLoginStatus

Dim objUser As UserInfo = UserController.ValidateUser(_portalID, _username, _password, "", PortalSettings.PortalName, _IPAddress, loginStatus)

UserController.UserLogin(_portalID, objUser, PortalSettings.PortalName, _IPAddress, True) 'UserAuthorized(objUser, False)

End Sub

Sub AutoUserTest(ByVal _portalid As Long, ByVal _username As String, ByVal _password As String, ByVal _lastname As String, ByVal _firstname As String)

' Add New User to Portal User Database

Dim objSecurity As New PortalSecurity

Dim objModules As New ModuleController

Dim objUserInfo As UserInfo

Dim _test As Boolean

objUserInfo = UserController.GetUserByName(_portalid, _username, False)

 

If Not objUserInfo Is Nothing Then 'And UserControl.UserName <> _UserName Then

_test = False

Else

_test = True

Dim userCreateStatus As UserCreateStatus = userCreateStatus.AddUser

Dim AffiliateId As Integer = Null.NullInteger

Dim objNewUser As New UserInfo

objNewUser.PortalID = _portalid

objNewUser.Profile.FirstName = _firstname 'UserControl.FirstName

objNewUser.Profile.LastName = _lastname 'UserControl.LastName

objNewUser.FirstName = _firstname

objNewUser.LastName = _lastname

objNewUser.DisplayName = _firstname & " " & _lastname

objNewUser.Username = _username 'UserControl.UserName

objNewUser.Email = objNewUser.DisplayName & "@xxx.com" '+"monty.alger@ge.com" 'UserControl.Email

objNewUser.Membership.Password = _password 'UserControl.Password

objNewUser.Membership.Approved = True 'Convert.ToBoolean(IIf(PortalSettings.UserRegistration <> PortalRegistrationType.PublicRegistration, False, True))

objNewUser.AffiliateID = AffiliateId

userCreateStatus = UserController.CreateUser(objNewUser)

If userCreateStatus = userCreateStatus.Success Then

If Not Null.IsNull(AffiliateId) Then

''Dim objAffiliates As New Services.Vendors.AffiliateController

''objAffiliates.UpdateAffiliateStats(AffiliateId, 0, 1)

End If

'store preferredlocale in cookie

DotNetNuke.Services.Localization.Localization.SetLanguage(objNewUser.Profile.PreferredLocale)

End If

End If

'AutoUserTest = _test

End Sub

 

 

Sub DoAutoLogin(ByVal _username As String, ByVal _password As String, ByVal _lastname As String, ByVal _firstname As String, ByVal _email As String)

Dim _pw As String

Dim _IPaddress As String = "193.168.1.100"

AutoUserTest(Me.PortalId, _username, _password, _lastname, _firstname)

_pw = _password

Call AutoLogin(Me.PortalId, _username, _pw, _IPaddress)

End Sub

End Class

End Namespace

 
New Post 9/26/2006 1:50 AM
User is offline Laurence Neville
305 posts
8th Ranked




Re: Automatic Signin to DNN 
Monty66b - does your solution absolutely require Netegrity? I need to implement an automatic sign-on to DNN from a classic ASP site, but we don't have any kind of "SiteMinder" solution.
 
New Post 9/28/2006 6:17 AM
User is offline Jonathan Johnson
64 posts
10th Ranked




Re: Automatic Signin to DNN 

Monty66b -- Hi. Thanks for sharing this. Do you have any other details? Did you use this code to create a Module?

In my senario, as part of our service each portal user will get a USB device that when connected to a PC (running a small "tray" app) will auto-open a URL and add the device's unique serial # to the URL. Example: https://mysite.com/default.aspx?SER=123456.  I would like to look up the serial # in a table (linked to UserID) and auto-login the user. If the serial # does not exist then redirect to the Registration page...

Any additional help/advice would be appreciated!!

Thanks.

 
New Post 10/8/2006 7:47 AM
User is offline Monty Alger
8 posts
10th Ranked


Re: Automatic Signin to DNN 

You dont need siteminder to make this work.  I added the following couple lines to the top of the default.aspx page right at the top of the code for InitializePage.  If you pass a set of parameters in the query string they can be extracted. Below is the test script I added to extract data.  Couple comments.  When I use siteminder it comes back from a server with user information in the http header.  The password validation has already been done externally.  Below I "derive" a password from the user name.  For my purposes on an intranet site this is ok as I am not protecting really sensitive information, more just trying to get people to the right place.  

It would be good to fix up the password lookup below.  Also, it iwould be nice if an official mechanism were implemented to enable this.  Hope this helps. 

'Insert to detect siteminder login..................

Dim _username As String

_username = Request.QueryString("username")

If _username <> "" Then

Dim _lastname As String, _firstname As String, _email As String, _password As String

_lastname = Request.QueryString("lastname")

_firstname = Request.QueryString("firstname")

_email = Request.QueryString("email")

_username = Request.QueryString("username")

_password = _username & "abc11"

Dim xx As New montyalger.autologin.AutoLoginBase

xx.DoAutoLogin(_username, _password, _lastname, _firstname, _email)

xx = Nothing

Response.Redirect("/dnn/default.aspx")

End If

'End of insert to detect siteminder

 
Previous Previous
 
Next Next
  Forum  General DotNetN...  Extend It! ( Pr...  Automatic Signin to DNN
 


Forum Policy

These Discussion Forums are dedicated to the discussion of the DotNetNuke Web Application Framework.

For the benefit of the community and to protect the integrity of the project, 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 DotNetNuke.
2. Discussion or promotion of DotNetNuke product releases under a different brand name are strictly prohibited.
3. No Flaming or Trolling.
4. No Profanity, Racism, or Prejudice.
5. Site Moderators have the final word on approving/removing a thread or post or comment.
6. English language posting only, please.

 


DotNetNuke Training by Engage Software
Specializing in customized training, architecture and module solutions for large scale implementations lead by DNN Core Team Member Christopher Hammond.
engagesoftware.com
Smart-Thinker
DNN Modules for Social Networks for as low as $69 for 6 modules! We also maintain the DotNetNuke Directory - http://DNNDir.com
www.smart-thinker.com
DNN Photo Gallery
Complete Photo Gallery Management!
www.dnnPhotoGallery.com

DotNetNuke Corporation   Terms Of Use  Privacy Statement
DotNetNuke®, DNN®, and the DotNetNuke logo are trademarks of DotNetNuke Corporation
Hosted by MaximumASP