simpleSAMLphp autentikacijski plugin za phpBB3 forum

 

Opis

Ovaj plugin omogućava korisnicima phpBB3 foruma Single Sign-On autentikaciju uporabom SAML protokola. Pošto je taj protokol podržan i od strane AAI@EduHr sustava on omogućava korisnicima da se autenticiraju koristeći svoju AAI korisničku oznaku i lozinku.

Verzija

1.0 (zadnja promjena 2009-02-05)

Verzija phpBB3

3.0.4

Primjer u produkciji

http://forum.srce.hr

Kontakt

team@aaiedu.hr, autor: Draženko Celjak

Promjene uključuju

dodavanje i promjena datoteka, konfiguriranje plugina, promjena postavki foruma

Preduvijeti za plugin

  1. Instaliran forum phpBB3
  2. Instaliran i konfiguriran simpleSAMLphp
  3. Postojanje korisnika sa svim administratorskim pravima i AAI korisničkom oznakom (npr. pperic@srce.hr) u forumu. Tog korisnika možete kod instalacije foruma upisati kao administratora ili ga administrator foruma može ručno dodati u admin sučelju.

Plugin (download)

Arhiva: phpbb3-simplesamlphp_v1.zip

Promjene datoteki

  1. raspakirajte arhivu i kopirajte auth_saml.php datoteku u includes/auth/auth_plugin/ direktroij instaliranog foruma.

  2. ažurirajte datoteku /includes/functions.php u direktoriju foruma na način da nakon slijedećeg koda:
    	// Print out error if user tries to authenticate as an administrator without having the privileges...
    	if ($admin && !$auth->acl_get('a_'))
    	{
    		// Not authd
    		// anonymous/inactive users are never able to go to the ACP even if they have the relevant permissions
    		if ($user->data['is_registered'])
    		{
    			add_log('admin', 'LOG_ADMIN_AUTH_FAIL');
    		}
    		trigger_error('NO_AUTH_ADMIN');
    	}
    umetnete:
    	if (isset($config['auth_method']) && $config['auth_method'] == 'saml') 
    	{
    		require_once($phpbb_root_path . 'includes/auth/auth_saml' . '.' . $phpEx);
    		$attribs = get_saml_auth();
    		set_fake_params($attribs);	
    	}
    i nakon ovog reda:
    	'SITE_LOGO_IMG'			=> $user->img('site_logo')
    umetnete red:
    	'SAML_AUTH'		=> ($config['auth_method'] == 'saml') ? true : false,
  3. potrebno je još onemogućiti quick login forme na templateima. Ukoliko koristite prosilver stil ažurirajte datoteku /styles/prosilver/template/index_body.html na način da prije slijedećeg koda:
    		<fieldset class="quick-login">
    			<label for="username">{L_USERNAME}:</label>&nbsp;<input type="text" name="username" id="username" size="10" class="inputbox" title="{L_USERNAME}" />  
    			<label for="password">{L_PASSWORD}:</label>&nbsp;<input type="password" name="password" id="password" size="10" class="inputbox" title="{L_PASSWORD}" />
    			<!-- IF S_AUTOLOGIN_ENABLED -->
    				| <label for="autologin">{L_LOG_ME_IN} <input type="checkbox" name="autologin" id="autologin" /></label>
    			<!-- ENDIF -->
    			<input type="submit" name="login" value="{L_LOGIN}" class="button2" />
    		</fieldset>
    umetnete:
            <!-- IF not SAML_AUTH -->
    i nakon njega:
            <!-- ENDIF -->
  4. ako koristite subsilver2 stil ažurirajte datoteku /styles/subsilver2/template/index_body.html na način da prije slijedećeg koda:
    	<tr>
    		<td class="row1" align="center"><span class="genmed">{L_USERNAME}:</span> <input class="post" type="text" name="username" size="10" />&nbsp; <span class="genmed">{L_PASSWORD}:</span> <input class="post" type="password" name="password" size="10" />&nbsp; <!-- IF S_AUTOLOGIN_ENABLED --> <span class="gensmall">{L_LOG_ME_IN}</span> <input type="checkbox" class="radio" name="autologin" /><!-- ENDIF -->&nbsp; <input type="submit" class="btnmain" name="login" value="{L_LOGIN}" /></td>
    	</tr>
    umetnete:
         <!-- IF not SAML_AUTH -->
    i nakon njega:
        <!-- ENDIF -->
    Ako koristite neki drugi stil (osmi prosilver i subsilver2) na sličan način možete "sakriti" quick login formu kad uključite SAML autentikaciju.

Konfiguriranje plugina

U datoteci /includes/auth/auth_plugin/auth_saml.php potrebno je podesiti:
  • putanju do simpleSAMLphp-a:
    define('simpleSAMLphp_home', '/data/www/simplesamlphp_1_1');

  • URL simpleSAMLphp servisa na Vašem serveru( primjer odgovora takvog servisa):
    define('simpleSAMLphp_base_url_path', 'https://forum.vasa-domena.hr/simplesaml');

Promjena postavki u administratorskom sučelju foruma

  1. Promjena načina autentikacije:
    Administration Control Panel -> General -> Client communication -> Authentication: SAML

  2. Dodavanje vlastitog (custom) polja za ime i prezime (opcionalno):
    Administration Control Panel -> Users and Groups -> Custom profile fields -> Create new field:
    • Field type: Single text field
    • Field identification: name
    • Display profile field: Yes
    • Visibility option: Display in user control panel
    • Field name/title presented to the user: Name

  3. Onemogućivanje registracije:
    Administration Control Panel -> General -> User registration settings -> Account activation: Disable

  4. Onemogućivanje promjene lozinke:
    Administration Control Panel -> System -> Module management -> User Control Panel -> Profile -> Edit account settings: Disable

  5. Čiščenje forumovog internog cachea:
    Administration Control Panel -> General -> Purge the cache: Run now