Created
November 24, 2017 14:41
-
-
Save bcswartz/46455767e4aca53f87e664839a4c4b16 to your computer and use it in GitHub Desktop.
First of 2 code blocks describing how to link JASIG CAS authentication with the Mura CMS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfif cgi.script_name EQ "/admin/index.cfm" and cgi.query_string EQ ""> | |
<cfif IsDefined('session.mura') and session.mura.userId EQ ""> | |
<cfif StructKeyExists(session,"NetId")> | |
<!---Look for an admin (type 2) account with the user identifier returned by CAS---> | |
<cfquery name="qry" datasource="{My Mura Datasource}"> | |
select userId | |
from tUsers | |
where username= <cfqueryparam value="#session.NetId#" cfsqltype="cf_sql_varchar" /> | |
and type= <cfqueryparam value="2" cfsqltype="cf_sql_numeric" /> | |
</cfquery> | |
<cfscript> | |
loginData= StructNew(); | |
loginData.userID= qry.userId; | |
loginData.siteId= "default"; | |
loginData.isAdminLogin= true; | |
loginData.returnUrl= "index.cfm?fuseaction=cDashboard.main&siteid=default"; | |
</cfscript> | |
<cfset StructDelete(session,"NetId")> | |
<cfset application.loginManager.loginByUserID(loginData,"")> | |
<cfelse> | |
<cflocation url="/adminCASLogin.cfm" /> | |
</cfif> | |
</cfif> | |
</cfif> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment