Skip to content

Instantly share code, notes, and snippets.

@bcswartz
Created November 24, 2017 14:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bcswartz/1fca607fc199d6d7ece4affe3c028c16 to your computer and use it in GitHub Desktop.
Save bcswartz/1fca607fc199d6d7ece4affe3c028c16 to your computer and use it in GitHub Desktop.
Second of 2 code blocks describing how to link JASIG CAS authentication with the Mura CMS
<cfif StructKeyExists(session,"userId") EQ false>
<cfif StructKeyExists(session,"NetId")>
<!---Look for a user account with the user identifier returned by CAS--->
<cfquery name="qry" datasource="{My Mura Datasource}">
select userId, type
from tUsers
where username= <cfqueryparam value="#session.NetId#" cfsqltype="cf_sql_varchar" />
</cfquery>
<cfif qry.recordcount EQ 1>
<cfset session.userId= session.NetId>
<cfset StructDelete(session,"NetId")>
<!---If they are an admin (type 2), log them in)--->
<cfif qry.type EQ 2>
<cfscript>
loginData= StructNew();
loginData.userID= qry.userId;
loginData.siteId= "internal";
loginData.isAdminLogin= true;
loginData.returnUrl= "/internal/index.cfm";
</cfscript>
<cfset application.loginManager.loginByUserID(loginData,"")>
</cfif>
</cfif>
<cfelse>
<cflocation url="siteCASLogin.cfm" />
</cfif>
</cfif>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment