Created
November 24, 2017 14:41
-
-
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
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 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