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

HomeHomeDNN Open Source...DNN Open Source...Provider and Extension ForumsProvider and Extension ForumsAuthenticationAuthenticationCentral Authentication Service - CASCentral Authentication Service - CAS
Previous
 
Next
New Post
5/24/2007 4:22 PM
 

Mike,

Can you please delete my previous post which I submited by mistake prior to proofing.

http://www.ja-sig.org/products/cas/

I'm new to DNN, but here's what I want to accomplish.

When a user hits the DNN site they are bounced over to authenticate against our single sign on system.  

After they have successfully authenticated, they are directed back to the DNN site with a username (see code below).  We're using CAS for authentication, using the following code; I can authenticate a user getting their username.
What I'd like to do is if the username does not exist in DNN, create it in DNN, if it does, go ahead and "log them in" with the username retrieved from the CAS code.

Again, I'm new to DNN, I was hoping someone has already been down this road and could help me get started.

/** 
* CASP.cs 
* CAS over ASP.NET! 
*  
* Created by John Tantalo, john.tantalo@case.edu 
* Case Western Reserve University 
*  
* Modification History: 
*  
* 12/09/05 jnt5, created class 
* 12/12/05 jnt5, removed cookie check 
*                                stores CASNetworkID in session instead of cache 
*                                clears Page session variable after ticket verification 
* 12/13/05 jnt5, removed Page session variable 
*                                fixed bug which would cause loop due to incorrect service parameter 
* 04/04/06 jnt5, adapted serviceURL code courtesy Ali Cakmak 
* 04/10/06 jnt5, added new comments 
*  
* References: 
*  
* http://wiki.case.edu/Central_Authentication_Service 
* https://clearinghouse.ja-sig.org/wiki/display/CAS/CAS+2.0+Protocol+Specification 
*/ 
 
using System ; 
using System.Web.UI ; 
using System.Net ; 
using System.IO ; 
using System.Web.SessionState; 
 
/** 
* CASP general usage: 
*  
*      private void Page_Load(object sender, System.EventArgs e) 
*      { 
*              String NetworkID = CASP.Authenticate( "https://bb5.fsu.edu/cas/login", "https://bb5.fsu.edu/cas/validate", this ) ; 
*      } 
*/ 
          
public class CASP 
{ 
        /** 
         * Authenticates a user with the given login and validation pages. After authentication 
         * the user's browser is redirected to the original page. 
         */ 
         
        public static String Authenticate( String LoginURL, String ValidateURL, Page Page ) 
        { 
                return Authenticate( LoginURL, ValidateURL, Page, Page.Request.Url.AbsoluteUri.Split('?')[0] ) ; 
        } 
 
        /** 
         * Authenticates a user with the given login and validation pages. After authentication 
         * the user's browser is redirected to the location given as the service URL. 
         */ 
 
        public static String Authenticate( String LoginURL, String ValidateURL, Page Page, String ServiceURL ) 
        { 
                if( Page.Session["CASNetworkID"] != null ) // user already logged in 
                        return Page.Session["CASNetworkID"].ToString() ; 
                else // user hasn't logged in 
                { 
                        if( Page.Request.QueryString["ticket"] != null ) // ticket received 
                        { 
                                try // read ticket and request validation 
                                { 
                                        StreamReader Reader = new StreamReader( new WebClient().OpenRead( ValidateURL + "?ticket=" + Page.Request.QueryString["ticket"] + "&service=" + ServiceURL ) ) ; 
                                 
                                        if( "yes".Equals( Reader.ReadLine() ) ) // ticket validated 
                                        { 
                                                // store network id in sesssion, return value 
 
                                                return (String) ( Page.Session["CASNetworkID"] = Reader.ReadLine() ) ; 
 
                                        } 
                                }  
                                catch( WebException ) {} 
                        }  
         
                        // ticket was invalid, or didn't exist, so request ticket 
                 
                        Page.Response.Redirect( LoginURL + "?service=" + ServiceURL, true ) ; 
                        return null ; 
                 } 
        } 
}
 
New Post
5/24/2007 5:58 PM
 

Unfortunately I don't have delete powers but I'll post a link to this thread instead.

 
New Post
5/30/2007 5:47 PM
 

This is similar to what I am trying to accomplish, so I hope you get a helpful answer.  What I am wanting to do is have the login module check DNN's user database first, and if the user is not in there then I want it to compare to a database we have called eID.  If the user has a valid eID account, then I'd like DNN to sign them in under a generic user account called "Visitor".  I'm very new to DNN, so I don't know if this is simple or not.  I have searched, but I'm having trouble finding a simple solution that fits our scenario.

 
New Post
7/30/2007 3:13 PM
 

I too am interested in CASifying DNN.  I would love to be able to integrate DNN pages and services into our enterprise portal and our educational portal, of which both use CAS for authentication. 

 
New Post
7/30/2007 3:46 PM
 

This would not be that hard to accomplish.

You can create a new page, or even a module that if they are not logged in, AND they do not have a valid ticket bounce them over and then you can do your exact code listed to validate the ticket when they come back.

Then you can simply log them in to a DNN account.  There are a few ways you could do that portion but overall it shouldn't be that hard.

If you want to talk some specifics regarding what you would need to do, shoot me an e-mail.


-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
 
Previous
 
Next
HomeHomeDNN Open Source...DNN Open Source...Provider and Extension ForumsProvider and Extension ForumsAuthenticationAuthenticationCentral Authentication Service - CASCentral Authentication Service - CAS


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