diff --git a/config-templates/ldap.php b/config-templates/ldap.php
new file mode 100644
index 0000000000000000000000000000000000000000..81bb93f8b824c968bbb6d230eacab355a3bab74f
--- /dev/null
+++ b/config-templates/ldap.php
@@ -0,0 +1,23 @@
+<?php
+/* 
+ * Configuration for the LDAP authentication module.
+ * 
+ * $Id: $
+ */
+
+$config = array (
+
+	/**
+	 * LDAP configuration. This is only relevant if you use the LDAP authentication plugin.
+	 *
+	 * The attributes parameter is a list of attributes that should be retrieved.
+	 * If the attributes parameter is set to null, all attributes will be retrieved.
+	 */
+	'auth.ldap.dnpattern'  => 'uid=%username%,dc=feide,dc=no,ou=feide,dc=uninett,dc=no',
+	'auth.ldap.hostname'   => 'ldap.uninett.no',
+	'auth.ldap.attributes' => null,
+	'auth.ldap.enable_tls' => false,
+	
+);
+
+?>
diff --git a/lib/SimpleSAML/Configuration.php b/lib/SimpleSAML/Configuration.php
index a05325549d8dc368f0f878187d989db139f61d9b..42ce14a71f33561df01e4e265fb91b20a3c70a11 100644
--- a/lib/SimpleSAML/Configuration.php
+++ b/lib/SimpleSAML/Configuration.php
@@ -12,11 +12,13 @@ class SimpleSAML_Configuration {
 	private static $instance = array();
 
 	private $configpath = null;	
+	private $configfilename = null; 
 	private $configuration = null;
 
 	// private constructor restricts instantiaton to getInstance()
-	private function __construct($configpath) {
+	private function __construct($configpath, $configfilename = 'config.php') {
 		$this->configpath = $configpath;
+		$this->configfilename = $configfilename;
 	}
 	
 	public static function getInstance($instancename = 'simplesaml') {
@@ -25,15 +27,15 @@ class SimpleSAML_Configuration {
 		return self::$instance[$instancename];
 	}
 	
-	public static function init($path, $instancename = 'simplesaml') {
-		self::$instance[$instancename] = new SimpleSAML_Configuration($path);
+	public static function init($path, $instancename = 'simplesaml', $configfilename = 'config.php') {
+		self::$instance[$instancename] = new SimpleSAML_Configuration($path, $configfilename);
 	}
 
 	private function loadConfig() {
-		if (!file_exists($this->configpath . '/config.php')) {
+		if (!file_exists($this->configpath . '/' . $this->configfilename)) {
 			echo 'You have not yet created a configuration file. [ <a href="http://rnd.feide.no/content/installing-simplesamlphp#id405868">simpleSAMLphp installation manual</a> ]';
 		}
-		require_once($this->configpath . '/config.php');
+		require_once($this->configpath . '/' . $this->configfilename);
 		$this->configuration = $config;
 	}
 
diff --git a/www/auth/login-cas-ldap.php b/www/auth/login-cas-ldap.php
index 8f18ee6e624e6f1e50762efab3c554c3f4a11ef8..62a76a23db6dcbe8b4cb9f1f47c8a121dd3b2155 100755
--- a/www/auth/login-cas-ldap.php
+++ b/www/auth/login-cas-ldap.php
@@ -48,12 +48,6 @@ if (!array_key_exists('RelayState', $_REQUEST)) {
 
 
 
-
-
-
-
-
-
 function casValidate($cas) {
 
 	$service = SimpleSAML_Utilities::selfURL();
diff --git a/www/auth/login.php b/www/auth/login.php
index e40347b45770bd64958080501ac7085aa07f2f48..ccfeba53a6961faf00d8a7b5273025a77e711e9d 100644
--- a/www/auth/login.php
+++ b/www/auth/login.php
@@ -17,6 +17,11 @@ $session = SimpleSAML_Session::getInstance(true);
 SimpleSAML_Logger::info('AUTH  - ldap: Accessing auth endpoint login');
 
 
+SimpleSAML_Configuration::init($configdir, 'ldapconfig', 'ldap.php');
+$ldapconfig = SimpleSAML_Configuration::getInstance('ldapconfig');
+
+
+
 $error = null;
 $attributes = array();
 $username = null;
@@ -61,17 +66,17 @@ if (isset($_POST['username'])) {
 		/*
 		 * Connecting to LDAP.
 		 */
-		$ldap = new SimpleSAML_Auth_LDAP($config->getValue('auth.ldap.hostname',
-                                         $config->getValue('auth.ldap.enable_tls')));
+		$ldap = new SimpleSAML_Auth_LDAP($ldapconfig->getValue('auth.ldap.hostname'),
+                                         $ldapconfig->getValue('auth.ldap.enable_tls'));
 	
 		/* Insert the LDAP username into the pattern configured in the
 		 * 'auth.ldap.dnpattern' option.
 		 */
 		$dn = str_replace('%username%', $ldapusername,
-						  $config->getValue('auth.ldap.dnpattern'));
+						  $ldapconfig->getValue('auth.ldap.dnpattern'));
 	
 		/* Connect to the LDAP server. */
-		#$ds = ldap_connect($config->getValue('auth.ldap.hostname'));
+		#$ds = ldap_connect($ldapconfig->getValue('auth.ldap.hostname'));
 		
 		
 		/*
@@ -85,7 +90,7 @@ if (isset($_POST['username'])) {
 		/*
 		 * Retrieve attributes from LDAP
 		 */
-		$attributes = $ldap->getAttributes($dn, $config->getValue('auth.ldap.attributes', null));
+		$attributes = $ldap->getAttributes($dn, $ldapconfig->getValue('auth.ldap.attributes', null));
 
 		SimpleSAML_Logger::info('AUTH - ldap: '. $ldapusername . ' successfully authenticated');
 		
diff --git a/www/saml2/sp/AssertionConsumerService.php b/www/saml2/sp/AssertionConsumerService.php
index e4786e58af072cc43785b00ac0938f9c005fbe90..91081ca63673107c5354bc00ebbe56a9ac3d7d6a 100644
--- a/www/saml2/sp/AssertionConsumerService.php
+++ b/www/saml2/sp/AssertionConsumerService.php
@@ -2,7 +2,6 @@
 
 require_once('../../_include.php');
 
-
 require_once((isset($SIMPLESAML_INCPREFIX)?$SIMPLESAML_INCPREFIX:'') . 'SimpleSAML/Configuration.php');
 require_once((isset($SIMPLESAML_INCPREFIX)?$SIMPLESAML_INCPREFIX:'') . 'SimpleSAML/Utilities.php');
 require_once((isset($SIMPLESAML_INCPREFIX)?$SIMPLESAML_INCPREFIX:'') . 'SimpleSAML/Session.php');
@@ -16,7 +15,7 @@ require_once((isset($SIMPLESAML_INCPREFIX)?$SIMPLESAML_INCPREFIX:'') . 'SimpleSA
  * This SAML 2.0 endpoint is the endpoint at the SAML 2.0 SP that takes an Authentication Response
  * as HTTP-POST in, and parses and processes it before it redirects the use to the RelayState.
  *
- * @author Andreas Åkre Solberg, UNINETT AS. <andreas.solberg@uninett.no>
+ * @author Andreas Aakre Solberg, UNINETT AS. <andreas.solberg@uninett.no>
  * @package simpleSAMLphp
  * @version $Id$
  * @abstract