| 204 | |
| 205 | |
| 206 | === Enable Shibboleth on apache virtual hosts === |
| 207 | |
| 208 | Edit wordpress virtual host as follows: |
| 209 | |
| 210 | config file: {{{ /etc/apache2/sites-enabled/wp-le-ssl.conf }}} |
| 211 | |
| 212 | |
| 213 | {{{ |
| 214 | <IfModule mod_ssl.c> |
| 215 | <VirtualHost *:443> |
| 216 | |
| 217 | ServerName wp.Your-Domain |
| 218 | ServerAdmin you@yourwebsite.com |
| 219 | DocumentRoot /var/www/html #Location of Wordpress installation |
| 220 | |
| 221 | ErrorLog ${APACHE_LOG_DIR}/wp-error.log |
| 222 | CustomLog ${APACHE_LOG_DIR}/wp-access.log combined |
| 223 | |
| 224 | #SSL Certificates issued by letsencrypt |
| 225 | SSLCertificateFile /etc/letsencrypt/live/wp.Your-Domain/fullchain.pem |
| 226 | SSLCertificateKeyFile /etc/letsencrypt/live/wp.Your-Domain/privkey.pem |
| 227 | Include /etc/letsencrypt/options-ssl-apache.conf |
| 228 | |
| 229 | <Location /> |
| 230 | AuthType Shibboleth |
| 231 | ShibRequestSetting requireSession false #Wordpress shibboleth plugin needs requireSession to be false |
| 232 | Require shibboleth |
| 233 | </Location> |
| 234 | |
| 235 | </VirtualHost> |
| 236 | </IfModule> |
| 237 | |
| 238 | }}} |
| 239 | |
| 240 | Edit Moodle virtual host as follows: |
| 241 | |
| 242 | config file: {{{ /etc/apache2/sites-enabled/mdl-le-ssl.conf }}} |
| 243 | |
| 244 | |
| 245 | {{{ |
| 246 | <IfModule mod_ssl.c> |
| 247 | <VirtualHost *:443> |
| 248 | |
| 249 | ServerName mdl.Your-Domain |
| 250 | ServerAdmin you@yourwebsite.com |
| 251 | DocumentRoot /var/www/mdl #Location of Moodle installation |
| 252 | |
| 253 | ErrorLog ${APACHE_LOG_DIR}/mdl-error.log |
| 254 | CustomLog ${APACHE_LOG_DIR}/mdl-access.log combined |
| 255 | |
| 256 | #SSL Certificates issued by letsencrypt |
| 257 | SSLCertificateFile /etc/letsencrypt/live/mdl.Your-Domain/fullchain.pem |
| 258 | SSLCertificateKeyFile /etc/letsencrypt/live/mdl.Your-Domain/privkey.pem |
| 259 | Include /etc/letsencrypt/options-ssl-apache.conf |
| 260 | |
| 261 | <Location /> |
| 262 | ShibRequestSetting applicationId mdl #Defining shibboleth application override |
| 263 | </Location> |
| 264 | |
| 265 | |
| 266 | <Directory /var/www/mdl/auth/shibboleth/index.php> #Double Check Moodle installation path |
| 267 | AuthType shibboleth |
| 268 | ShibRequestSetting applicationId mdl |
| 269 | ShibRequireSession On |
| 270 | require valid-user |
| 271 | </Directory> |
| 272 | |
| 273 | </VirtualHost> |
| 274 | </IfModule> |
| 275 | }}} |
| 284 | |
| 285 | == Register both services with LIAF == |
| 286 | |
| 287 | We have now set up shibboleth SP for two different entities. They have to be registered with LIAF before using the Federation discovery Service to point different IDP's. |
| 288 | |
| 289 | Download the metadata from both applications by going to the following URL's. |
| 290 | |
| 291 | * {{{ https://wp.YOUR-DOMAIN/Shibboleth.sso/Metadata }}} |
| 292 | * {{{ https://mdl.YOUR-DOMAIN/Shibboleth.sso/Metadata }}} |
| 293 | |
| 294 | Now register them with LIAF separately. |
| 295 | |
| 296 | == Enabling Wordpress plugin == |
| 297 | |
| 298 | Install and activate the shibboleth plugin by Michael !McNeill, mitcho (Michael 芳貴 Erlewine), Will Norris {{{ https://wordpress.org/plugins/shibboleth/ }}} |
| 299 | |
| 300 | Then go to '''Settings''' -> '''Shibboleth''' |
| 301 | |
| 302 | |
| 303 | On General Tab: |
| 304 | |
| 305 | Login URL: {{{ https://wp.YOUR-DOMAIN/Shibboleth.sso/Login }}} |
| 306 | |
| 307 | Logout URL: {{{ https://wp.YOUR-DOMAIN/Shibboleth.sso/Logout }}} |
| 308 | |
| 309 | Attribute Access: Environment Variables |
| 310 | |
| 311 | |
| 312 | On User Tab: |
| 313 | |
| 314 | Tick Automatically Create Accounts. |
| 315 | Check the attribute map as well. If you ticked any attribute Manage tick, user will not be able to change the values once they logged in. |
| 316 | |
| 317 | |
| 318 | On Authorization Tab: |
| 319 | |
| 320 | Select Subscriber as the Default Role. |
| 321 | |
| 322 | |
| 323 | On Logging Tab: |
| 324 | |
| 325 | Enable all Logging. |
| 326 | |
| 327 | |
| 328 | |
| 329 | Click Save. |
| 330 | |
| 331 | |
| 332 | == Enabling Moodle Plugin == |
| 333 | |
| 334 | As Moodle admin, go to the '''Site administration''' >>> '''Plugins''' >>> '''Authentication''' and click on the '''Shibboleth''' enable '''eye'''. Next go to its settings. |
| 335 | |
| 336 | |
| 337 | Fill in the fields of the form. |
| 338 | |
| 339 | The fields 'Username', 'First name', 'Surname', etc. should contain the name of the environment variables of the Shibboleth attributes that you want to map onto the corresponding Moodle variable. Especially the 'Username' field is of great importance because this attribute is used for the Moodle authentication of Shibboleth users. |
| 340 | |
| 341 | Username: eppn |
| 342 | |
| 343 | Moodle WAYF service: No |
| 344 | |
| 345 | Shibboleth Service Provider logout handler URL: /Shibboleth.sso/Logout |
| 346 | |
| 347 | Data mapping (First name): givenName |
| 348 | |
| 349 | Data mapping (Surname): surname |
| 350 | |
| 351 | Data mapping (Email address): mail |
| 352 | |
| 353 | Update local (Email address): On Creation |
| 354 | |
| 355 | Lock value (Email address): Locked |
| 356 | |
| 357 | |
| 358 | Click Save. |
| 359 | |
| 360 | |
| 361 | Now using a private browser, try to log in to both systems using your IDP test user. |