85 lines
3.3 KiB
Plaintext
85 lines
3.3 KiB
Plaintext
<%@ language = "JavaScript" %>
|
|
<% /*
|
|
$Revision$
|
|
$Id$
|
|
|
|
File: aut/saml/default.asp
|
|
Description: Single Sign On script
|
|
Parameters:
|
|
Context:
|
|
Note: In c:\opt\shibboleth-sp\etc\shibboleth\shibboleth2.xml staat
|
|
<RequestMapper type="Native">
|
|
<RequestMap applicationId="default">
|
|
<Host name="xxxx.facilitor.nl">
|
|
<Path name="trunk/appl/aut/saml" authType="shibboleth" requireSession="true"/>
|
|
</Host>
|
|
</RequestMap>
|
|
</RequestMapper>
|
|
ofwel trunk/appl/saml heeft een 'requireSession' en Shibboleth
|
|
grijpt automatisch in als je een bestand (deze default.asp) in
|
|
deze folder oproept. Je wordt geauthenticeerd tegen je identity
|
|
provider (via wat redirects) en komt uiteindelijk terug in dit
|
|
bestand met allerlei server variabelen gezet
|
|
|
|
*/ %>
|
|
<%
|
|
ANONYMOUS_Allowed = 1;
|
|
LOGIN_try = 1; // we zitten al in een login-try dus geen os_logon meer of zo
|
|
%>
|
|
<!-- #include file="../../../appl/Shared/common.inc" -->
|
|
<!-- #include file="../login.inc" -->
|
|
<!-- #include file="../../../appl/api2/api2.inc" -->
|
|
<!-- #include file="../../../appl/api2/model_aut_idp.inc" -->
|
|
<%
|
|
if (Request.ServerVariables("HTTP_SHIBIDENTITYPROVIDER").Count == 0)
|
|
shared.internal_error("Shibboleth not installed?");
|
|
|
|
// Als je dit punt bereikt ben je al geauthenticeerd door SAML
|
|
var issuer = String(Request.ServerVariables("HTTP_SHIBIDENTITYPROVIDER"));
|
|
__Log("Detected SAML identity provider (entityId): " + issuer);
|
|
var idp_data_arr = new model_aut_idp({ internal: true }).REST_GET({ filter: { type: 5 /* SAML */, issuer: issuer }, include: [ "idpmappings" ]});
|
|
if (!idp_data_arr.length)
|
|
shared.internal_error("Unknown SAML issuer {0}".format(issuer));
|
|
var idp_data = idp_data_arr[0];
|
|
if (idp_data.loglevel > 0)
|
|
__Logging = idp_data.loglevel;
|
|
|
|
var svars = ["<pre>"]; // Voor logging
|
|
|
|
var wasCodePage = Session.Codepage;
|
|
Session.Codepage = 65001; // Van Shibboleth krijgen we UTF-8 namen
|
|
|
|
var claim = {}; // We bouwen een claim op uit alle servervariabelen die met HTTP_ beginnen
|
|
|
|
var ignoreHTTP = "HTTP_COOKIE,HTTP_REFERER".split(","); // Ik wil ze vooral niet in de logfile krijgen
|
|
|
|
for (i=1; i <= Request.ServerVariables.Count; i++)
|
|
{
|
|
var name = Request.ServerVariables.key(i);
|
|
if (name.match(/^HTTP_/) && !inArray(name, ignoreHTTP))
|
|
{
|
|
claim[name] = String(Request.ServerVariables(i));
|
|
svars.push(Request.ServerVariables.key(i) + ": " + Request.ServerVariables(i));
|
|
}
|
|
}
|
|
Session.Codepage = wasCodePage; // Geen risico lopen
|
|
|
|
svars.push("</pre>");
|
|
__SafeLog(svars.join("\n"));
|
|
|
|
process_claim(claim, idp_data);
|
|
|
|
if (user_key > 0)
|
|
{
|
|
var return_to = getQParam("return_to", "/") || "/";
|
|
Response.Redirect(rooturl + return_to);
|
|
}
|
|
else
|
|
{ // Automatisch naar het inlogscherm
|
|
Response.Redirect(rooturl + "/?sso=0");
|
|
}
|
|
|
|
|
|
Response.End;
|
|
%>
|