WebSSO configuration for Drupal
Add the following settings to Apache:
<Location />
ShibRequireSession off
ShibRequestSetting applicationId drupal
AuthType shibboleth
Require shibboleth
</Location>
SoffidOnLoadScript .* .* 60000 /etc/apache2/soffid/drupal-login.js
SoffidPostData /?q=user system=ldap account=name password=pass
Finally, next is the login scriptÂ
debug ("***********************************************************************");
debug ("****************** LOGIN ON DRUPAL *************************");
debug ("***********************************************************************");
debug (document.url);
user = document.getElementById("edit-name");
pass = document.getElementById("edit-pass");
debug ("***********************************************************************");
if (user != undefined && pass != undefined)
{
account = secretStore.getAccount("ldap");
found = false; // Any error message found
if (account != undefined)
{
user.setAttribute("value", account);
} else {
user.setAttribute("value", "AUTO-LOGIN");
found = true;
}
user.setAttribute("readonly", true);
pass.parentNode.setAttribute("style", "display:none");
errors = document.getElementsByTagName("div");
for (i = 0 ; ! found && i < errors.length; i++)
{
if (errors.item(i).getAttribute("class") == "messages error")
found = true;
}
if (! found)
{
body=document.getElementsByTagName("body").item(0);
div = body.addChild("div");
div.setAttribute("style", "width: 90%; height: 90%; position: absolute; top: 5%; left: 5%; z-index: +10; background-color: #7F9FC2; color: white; opacity: 0.9; display: table-cell; text-align: center; vertical-align: middle; line-height: 90px; font-size: 250%; ");
div2 = div.addChild("div");
div2.setAttribute("style", "width: 100%; height: 40%;");
div.addChild("span").setText ("Logging in. Please wait ....");
body.setAttribute("onLoad", "document.getElementById('edit-submit').click();");
}
document.getElementById("edit-submit").setAttribute("style", "display:none");
}
// Change login / logout button
anchors = document.getElementsByTagName("a");
for (i = 0 ; i < anchors.length; i++)
{
if (anchors.item(i).getAttribute("href") == "/?q=user/logout")
anchors.item(i).setAttribute("href", "/Shibboleth.sso/Logout?return=http://www.soffid.org/");
if (anchors.item(i).getAttribute("href") == "http://drupal.soffid.org/user")
{
anchors.item(i).setAttribute("href", "/Shibboleth.sso/LocalLogout?return=http://www.soffid.org/Shibboleth.sso/Login%3ftarget=http://www.soffid.org/%3fq=user");
anchors.item(i).setText("Login / Register");
}
// Remove link to change user attributes
if (anchors.item(i).getAttribute("href") == "/?q=user/59/edit")
anchors.item(i).setAttribute("href", "/");
}