Skip to main content

WebSSO configuration for PHPBB

The following attributes must be added to apache configuration

<Location />
        ShibRequestSetting applicationId forum
        ShibRequireSession off
        AuthType shibboleth
        Require shibboleth
</Location>
<Location /ucp.php>
        ShibRequireSession on
        ShibRequestSetting requireSession true
        AuthType shibboleth
        Require valid-user
</Location>
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();');");
   }