<%@ language = "JavaScript" %>
<% /*
    $Revision$
    $Id$
    File:        cust/aaes/saml/default.asp
    Description: Single Sign On script
    Parameters:
    Context:
    Note:
*/ %>
<%
    Response.Expires=-1;
    Session("customerId") = "AAES";
    ANONYMOUS_Allowed = 1;
%>
<!-- #include file="../../../appl/Shared/common.inc" -->
<!-- #include file="../../../appl/shared/login.inc" -->
<%
    var uname = String(Request.ServerVariables("HTTP_FCLTUSERID"));
    Response.Write("SAML user detected as: " + uname);

    var newUrl = rooturl + "/";
    var sso_qs = String(Request.ServerVariables("QUERY_STRING"));
    if (sso_qs)
        newUrl += "?" + sso_qs;

    if (tryLogin(uname, null))
    {
        //Response.Write("Hoera: je bent user: " + user_key);
        Response.Redirect(newUrl);
    }
    else
    {   // Automatisch naar het inlogscherm
        __DoLog("SAML login not found in Facilitor: " + uname);
        Response.Redirect(newUrl);
    }
%>