


Thought this might be helpful for people who wanted to use ColdFusion CFCs to get an 'authToken' from within their application as you would in a production system. The example assumes you know how to interact with CFCs via Flash Remoting (<mx:RemoteObject>).
This additional CFC (AFCSServices.cfc) complements the Coldfusion samples that come with the v0.92 SDK. It acts as a wrapper that allows you to just call the 'connect' function and it returns an authToken that you can use to pass to AdobeHSAuthenticator -
<cfcomponent name="AFCSServices" access="remote">
<cfoutput>
<cffunction name="connect" access="remote" returntype="any">
<cfargument name="accounturl" type="string">
<cfargument name="username" type="string">
<cfargument name="password" type="string">
<cfargument name="room" type="string">
<cfargument name="UserID" type="string">
<cfargument name="UserRole" type="string">
<cfargument name="SharedSecret" type="string">
<cfset accountManager = createObject("component", "AFCSAccountManager").init(accounturl)>
<cfset accountManager.login(#username#, #password#)>
<cfset session = accountManager.getSession("#room#")>
<cfset authToken = accountManager.getAuthenticationToken(#room#, #SharedSecret#, #username#, #UserID#, #UserRole#) >
<cfreturn authToken>
</cffunction>
</cfoutput>
</cfcomponent>
You also need to add a function to the extisting AFCSAccountManager.cfc that comes with the SDK -
<cffunction name="getAuthenticationToken" returntype="any" access="public" output="false" hint="get auth token">
<cfargument name="room" type="string" required="yes"/>
<cfargument name="accountSecret" type="string" required="yes">
<cfargument name="name" type="string" required="yes">
<cfargument name="id" type="string" required="yes">
<cfargument name="role" type="numeric" required="yes">
<cfset var jSess = "">
<cfset var retSession = "">
<cfset var authToken = "">
<cftry>
<cfset jSess = VARIABLES.accountmanager.getSession(room)>
<cfcatch>
<cfreturn "">
</cfcatch>
</cftry>
<cfif isdefined("jSess")>
<cfset retSession = createObject("component", "AFCSSession")>
<cfset retSession.setSession(jSess)>
<cfset authToken = retSession.getAuthenticationToken(accountSecret, name, id, role)>
<cfreturn authToken>
</cfif>
<cfreturn "">
</cffunction>
Views
Replies
Sign in to like this content
Total Likes
This is very cool - thanks for sharing it!
nigel
Views
Replies
Total Likes