diff --git a/composer.json b/composer.json
index e8b316894cc11e63da03fcd02ff036d7ff24042d..50f0b8a338f4afae284928d15c6bf920fcae1682 100644
--- a/composer.json
+++ b/composer.json
@@ -82,6 +82,7 @@
         "symfony/dependency-injection": "^3.4 || ^4.0",
         "symfony/yaml": "^3.4 || ^4.0",
         "twig/twig": "~1.0 || ~2.0",
+        "webmozart/assert": "~1.4",
         "whitehat101/apr1-md5": "~1.0"
     },
     "require-dev": {
diff --git a/modules/admin/lib/TestController.php b/modules/admin/lib/TestController.php
index ac4afebcd6374ef5b4cef182b4d868002ebff057..b77da54f8f5bc7fc7ac2676b1300422de20738a2 100644
--- a/modules/admin/lib/TestController.php
+++ b/modules/admin/lib/TestController.php
@@ -14,6 +14,7 @@ use SimpleSAML\Utils;
 use SimpleSAML\XHTML\Template;
 use Symfony\Component\HttpFoundation\Request;
 use Symfony\Component\HttpFoundation\Response;
+use Webmozart\Assert\Assert;
 
 /**
  * Controller class for the admin module.
@@ -71,7 +72,7 @@ class TestController
                 // This is just a simple example of an error
                 /** @var array $state */
                 $state = Auth\State::loadExceptionState();
-                assert(array_key_exists(Auth\State::EXCEPTION_DATA, $state));
+                Assert::keyExists($state, Auth\State::EXCEPTION_DATA);
                 throw $state[Auth\State::EXCEPTION_DATA];
             }
 
diff --git a/modules/core/lib/Controller/LoginController.php b/modules/core/lib/Controller/Login.php
similarity index 94%
rename from modules/core/lib/Controller/LoginController.php
rename to modules/core/lib/Controller/Login.php
index c41d7e0539f01f62ec76db2c47c81f2e5500c07a..8a5859ff577e067289e1e45c8086be074bb09a89 100644
--- a/modules/core/lib/Controller/LoginController.php
+++ b/modules/core/lib/Controller/Login.php
@@ -13,6 +13,7 @@ use SimpleSAML\Utils;
 use SimpleSAML\XHTML\Template;
 use Symfony\Component\HttpFoundation\RedirectResponse;
 use Symfony\Component\HttpFoundation\Request;
+use Webmozart\Assert\Assert;
 
 /**
  * Controller class for the core module.
@@ -21,7 +22,7 @@ use Symfony\Component\HttpFoundation\Request;
  *
  * @package SimpleSAML\Module\core
  */
-class LoginController
+class Login
 {
     /** @var \SimpleSAML\Configuration */
     protected $config;
@@ -64,8 +65,8 @@ class LoginController
      *
      * @param string $as The identifier of the authentication source.
      *
-     * @return \SimpleSAML\XHTML\Template|RedirectResponse An HTML template or a redirection if we are not
-     * authenticated.
+     * @return \SimpleSAML\XHTML\Template|\Symfony\Component\HttpFoundation\RedirectResponse
+     * An HTML template or a redirection if we are not authenticated.
      *
      * @throws \SimpleSAML\Error\Exception An exception in case the auth source specified is invalid.
      */
@@ -112,8 +113,8 @@ class LoginController
      * @param Request $request The request that lead to this login operation.
      * @param string|null $as The name of the authentication source to use, if any. Optional.
      *
-     * @return \SimpleSAML\XHTML\Template|\SimpleSAML\HTTP\RunnableResponse|RedirectResponse An HTML template, a
-     * redirect or a "runnable" response.
+     * @return \SimpleSAML\XHTML\Template|\SimpleSAML\HTTP\RunnableResponse|\Symfony\Component\HttpFoundation\RedirectResponse
+     * An HTML template, a redirect or a "runnable" response.
      *
      * @throws \SimpleSAML\Error\Exception
      */
@@ -150,7 +151,7 @@ class LoginController
             /** @var array $state */
             $state = Auth\State::loadExceptionState();
 
-            assert(array_key_exists(Auth\State::EXCEPTION_DATA, $state));
+            Assert::keyExists($state, Auth\State::EXCEPTION_DATA);
             $e = $state[Auth\State::EXCEPTION_DATA];
 
             throw $e;
@@ -182,7 +183,7 @@ class LoginController
     public function logout($as)
     {
         $auth = new Auth\Simple($as);
-        return new RunnableResponse([$auth, 'logout'], [$this->config->getBasePath() . 'logout.php']);
+        return new RunnableResponse([$auth, 'logout'], [$this->config->getBasePath() . 'core/logout/' . urlencode($as)]);
     }
 
 
diff --git a/modules/core/lib/Controller/RedirectionController.php b/modules/core/lib/Controller/Redirection.php
similarity index 93%
rename from modules/core/lib/Controller/RedirectionController.php
rename to modules/core/lib/Controller/Redirection.php
index efb88d93c23238cc223ae867d0b4e2b642e88ec2..b418a10f0570c1b9332e718db59e2a494db3529f 100644
--- a/modules/core/lib/Controller/RedirectionController.php
+++ b/modules/core/lib/Controller/Redirection.php
@@ -11,6 +11,7 @@ use SimpleSAML\Session;
 use SimpleSAML\Utils;
 use SimpleSAML\XHTML\Template;
 use Symfony\Component\HttpFoundation\Request;
+use Webmozart\Assert\Assert;
 
 /**
  * Controller class for the core module.
@@ -19,7 +20,7 @@ use Symfony\Component\HttpFoundation\Request;
  *
  * @package SimpleSAML\Module\core
  */
-class RedirectionController
+class Redirection
 {
     /** @var \SimpleSAML\Configuration */
     protected $config;
@@ -73,6 +74,7 @@ class RedirectionController
             if (empty($sessionId) || empty($postId)) {
                 throw new Error\BadRequest('Invalid session info data.');
             }
+
         } else {
             throw new Error\BadRequest('Missing redirection info parameter.');
         }
@@ -91,15 +93,15 @@ class RedirectionController
 
         $session->deleteData('core_postdatalink', $postId);
 
-        assert(is_array($postData));
-        assert(array_key_exists('url', $postData));
-        assert(array_key_exists('post', $postData));
+        Assert::isArray($postData);
+        Assert::keyExists($postData, 'url');
+        Assert::keyExists($postData, 'post');
 
         if (!Utils\HTTP::isValidURL($postData['url'])) {
             throw new Error\Exception('Invalid destination URL.');
         }
 
-        $t = new Template($this->config, 'post.php');
+        $t = new Template($this->config, 'post.twig');
         $t->data['destination'] = $postData['url'];
         $t->data['post'] = $postData['post'];
         return $t;