diff --git a/modules/core/lib/Controller.php b/modules/core/lib/Controller.php
index 5cd712cb375b0fb102f23adba24d23ee7b573edd..252d9647e4c8f8beb6fc96130c8287ddfdf25db0 100644
--- a/modules/core/lib/Controller.php
+++ b/modules/core/lib/Controller.php
@@ -44,6 +44,44 @@ class Controller
     }
 
 
+    /**
+     * Show account information for a given authentication source.
+     *
+     * @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.
+     *
+     * @throws \SimpleSAML\Error\Exception An exception in case the auth source specified is invalid.
+     */
+    public function account($as)
+    {
+        if (!array_key_exists($as, $this->sources)) {
+            throw new Exception('Invalid authentication source');
+        }
+
+        $auth = new \SimpleSAML\Auth\Simple($as);
+        if (!$auth->isAuthenticated()) {
+            // not authenticated, start auth with specified source
+            return new RedirectResponse(\SimpleSAML\Module::getModuleURL('core/login/'.urlencode($as)));
+        }
+
+        $attributes = $auth->getAttributes();
+
+        $t = new \SimpleSAML\XHTML\Template($this->config, 'auth_status.php', 'attributes');
+        $t->data['header'] = '{status:header_saml20_sp}';
+        $t->data['attributes'] = $attributes;
+        $t->data['nameid'] = !is_null($auth->getAuthData('saml:sp:NameID'))
+            ? $auth->getAuthData('saml:sp:NameID')
+            : false;
+        $t->data['logouturl'] = \SimpleSAML\Module::getModuleURL('core/logout/'.urlencode($as));
+        $t->data['remaining'] = $this->session->getAuthData($as, 'Expire') - time();
+        $t->setStatusCode(200);
+
+        return $t;
+    }
+
+
     /**
      * Perform a login operation.
      *
@@ -85,10 +123,6 @@ class Controller
         $auth = new \SimpleSAML\Auth\Simple($as);
         $as = urlencode($as);
 
-        if ($request->get('logout', false) !== false) {
-            $auth->logout($this->config->getBasePath().'logout.php');
-        }
-
         if ($request->get(\SimpleSAML\Auth\State::EXCEPTION_PARAM, false) !== false) {
             // This is just a simple example of an error
 
@@ -114,39 +148,15 @@ class Controller
 
 
     /**
-     * Show account information for a given authentication source.
+     * Log the user out of a given authentication source.
      *
-     * @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.
+     * @param string $as The name of the auth source.
      *
-     * @throws \SimpleSAML\Error\Exception An exception in case the auth source specified is invalid.
+     * @throws \SimpleSAML\Error\CriticalConfigurationError
      */
-    public function account($as)
+    public function logout($as)
     {
-        if (!array_key_exists($as, $this->sources)) {
-            throw new Exception('Invalid authentication source');
-        }
-
-        $auth = new \SimpleSAML\Auth\Simple($as);
-        if (!$auth->isAuthenticated()) {
-            // not authenticated, start auth with specified source
-            return new RedirectResponse(\SimpleSAML\Module::getModuleURL('core/login/'.urlencode($as)));
-        }
-
-        $attributes = $auth->getAttributes();
-
-        $t = new \SimpleSAML\XHTML\Template($this->config, 'auth_status.php', 'attributes');
-        $t->data['header'] = '{status:header_saml20_sp}';
-        $t->data['attributes'] = $attributes;
-        $t->data['nameid'] = !is_null($auth->getAuthData('saml:sp:NameID'))
-            ? $auth->getAuthData('saml:sp:NameID')
-            : false;
-        $t->data['logouturl'] = \SimpleSAML\Module::getModuleURL('core/logout/'.urlencode($as));
-        $t->data['remaining'] = $this->session->getAuthData($as, 'Expire') - time();
-        $t->setStatusCode(200);
-
-        return $t;
+        $as = new \SimpleSAML\Auth\Simple($as);
+        $as->logout($this->config->getBasePath().'logout.php');
     }
 }
diff --git a/modules/core/routes.yaml b/modules/core/routes.yaml
index 95da497c434ddb389f7d4fbbf0329b3386bf1b04..80916d2ab51c7a39b650b5c841983f0ba4a629f2 100644
--- a/modules/core/routes.yaml
+++ b/modules/core/routes.yaml
@@ -4,4 +4,6 @@ core-login:
 core-account:
     path:       /account/{as}
     defaults:   { _controller: 'SimpleSAML\Module\core\Controller::account' }
-
+core-logout:
+    path:       /logout/{as}
+    defaults:   { _controller: 'SimpleSAML\Module\core\Controller::logout' }