# Sample configurations
Sample configurations
# WebSSO configuration for Drupal
Add the following settings to Apache:
```
ShibRequireSession off
ShibRequestSetting applicationId drupal
AuthType shibboleth
Require shibboleth
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", "/");
}
```
# WebSSO configuration for PHPBB
The following attributes must be added to apache configuration
```
ShibRequestSetting applicationId forum
ShibRequireSession off
AuthType shibboleth
Require shibboleth
ShibRequireSession on
ShibRequestSetting requireSession true
AuthType shibboleth
Require valid-user
SoffidOnLoadScript 'index.php$' .* 20000 /etc/apache2/soffid/forum-front.js
SoffidOnLoadScript '/ucp.php$' .* 20000 /etc/apache2/soffid/forum-ucp.js
SoffidOnLoadScript '/posting.php$' .* 20000 /etc/apache2/soffid/forum-posting.js
SoffidPostData '/ucp.php\?mode=login' system=ldap account=username password=password
```
Now, the following scripts must be added:
**forum-front.js** |
```
// Script to remove user & password from front page
//
debug ("***********************************************************************");
account = secretStore.getAccount("ldap");
debug ("Account = "+account);
debug ("***********************************************************************");
user = document.getElementById("username");
if (user != undefined)
{
fieldset = user.parentNode;
children = fieldset.childNodes;
for (i = 0; i < 6; i++)
{
children.item(i).setAttribute("style", "display:none");
}
if (account != undefined)
{
user.setAttribute("value", account);
user.setAttribute("readonly", true);
user.setAttribute("style", "");
}
fieldset.setAttribute("style", "display:none");
}
// Change login button
anchors = document.getElementsByTagName("a");
for (i = 0 ; i < anchors.length; i++)
{
if (/.*\/ucp.php\?mode=login.*/.test(anchors.item(i).getAttribute("href")))
{
anchors.item(i).setText("Login / Register");
}
}
```
|
**forum-ucp.js** |
```
// Script to perform login / logout actions
//
account = secretStore.getAccount("ldap");
if (request.params["mode"] == "login") {
user = document.getElementById("username");
account = secretStore.getAccount("ldap");
if (user != undefined)
{
user.setAttribute("value", account);
user.setAttribute("readonly", true);
pass = document.getElementById("password");
fieldset = pass.parentNode;
dl = fieldset.parentNode;
dl.setAttribute("style", "display:none");
div = dl.parentNode;
login = div.childNodes.item(4).childNodes.item(2).childNodes.item(2);
login.setAttribute("id", "loginButtonToClick");
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 ....");
script = body.addChild("script");
script.setAttribute("type", "text/javascript");
script.setText("onload_functions.push('document.getElementById(\\'loginButtonToClick\\').click();');");
}
}
if (request.params["mode"] == "logout") {
logout ();
}
if (request.params["mode"] == "reg_details") {
// Remove change details link
fieldsets=document.getElementsByTagName("fieldset");
for (i = 0; i < fieldsets.length; i++)
{
fieldsets.item(i).setAttribute("style", "visible: false;");
fieldsets.item(i).remove();
}
}
```
|
**forum-posting.js** |
```
// Script to perform login on post
//
user = document.getElementById("username");
if (user != undefined)
{
if (secretStore != undefined)
{
account = secretStore.getAccount("soffid.org-ldap");
user.setAttribute("value", account);
}
user.setAttribute("readonly", true);
pass = document.getElementById("password");
fieldset = pass.parentNode;
dl = fieldset.parentNode;
dl.setAttribute("style", "display:none");
div = dl.parentNode;
login = div.childNodes.item(4).childNodes.item(2).childNodes.item(1);
login.setAttribute("id", "loginButtonToClick");
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.forms[1].submit()");
script = body.addChild("script");
script.setAttribute("type", "text/javascript");
script.setText("onload_functions.push('document.getElementById(\\'loginButtonToClick\\').click();');");
}
```
|