Well, it was super easy to implement! 

I just created a page on my server called zendesk_auth.cfm. Zendesk sends
login requests here and I send back a response after logging the user in, or
if the user is already logged in.  In my code, if a user is not logged in I
redirect to a login page which sends them back to zendesk after
authentication (you have to pass around the timestamp and return_to values
to send back). This is basically the code I used, I didn't include my login
page and login check, but that's pretty simple...

<!---
    zendesk_auth.lf

    Description:
    Called from zendesk when a user attempts to log in at zendesk.
    Check if the user is already logged in here and send that info to
zendesk
    or show the login page (zendesk themed) and let them log in here and
redirect
    to zendesk

     Parameters:
      @param {String} url.return_to  The url to return to
      @param {Number} url.locale_id
      @param {Number} url.timestamp
--->

<cfparam name="url.timestamp"       default="">
<cfparam name="url.return_to"       default="">

<cfset sToken        = application.gs.zendesk_sharedsecret> <!--- you get
this from zendesk --->
<cfset sUrl              = ''>
<cfset sMessage     = ''>
<cfset sDigest          = ''>

<!--- user is logged in send back to zendesk --->
<cfif structKeyExists(client,'isLoggedIn')>
            <!--- create auth string and send back to zen desk --->
        <cfset sMessage = client.name & client.username & sToken &
url.timestamp>
        <cfset sDigest  = hash(sMessage)>

        <!--- and the url --->
        <cfset sUrl = url.return_to & '?name=' &
urlencodedformat(client.name) &
        '&email=' & urlencodedformat(client.username) &
        '&timestamp=' & url.timestamp &
        '&hash=' & sDigest>

        <!--- redirect back to ZenDesk --->
        <cflocation url="#sUrl#">
</cfif>

<!--- not logged in, show login screen --->
<cfinclude template="zendesk_login.lf">


-----Original Message-----
From: Brook Davies [mailto:[email protected]] 
Sent: March-02-12 3:35 PM
To: cf-talk
Subject: Zen Desk Single Sign On


Just about to work on getting the Single Sign on for ZenDesk working this
weekend. Before I start I thought I would check if any one had already done
it and had any code they wanted to share?

 

Brook






~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:350220
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to