Skip to content
Snippets Groups Projects
  1. Jul 02, 2016
    • Jaime Pérez's avatar
      bugfix: Stop SimpleSAML_SessionHandler::newSessionId() from initializing the session. · 4056af12
      Jaime Pérez authored
      Historically, SimpleSAML_SessionHandler::newSessionId() has also created the session, sending the cookies to the browser. This is problematic both because given the name of the method one would not assume such behaviour, and also because even for transient sessions the handler would then try to set cookies. When we are using a transient session, it is likely to be because we cannot set cookies or because there was a temporary error when loading the session. If we try to set the cookies even for transient sessions, we could either get an error because cookies cannot be set, or overwrite the previous session cookies with transient ones, trashing a legitimate session in case a temporary error occurs.
      
      As a side effect, this can also cause behaviours like the one described in issue #413. There's no point in trying to set the cookies when it's not possible, so we shouldn't even try, and save us the errors.
      
      To fix this, we made SimpleSAML_SessionHandler::setCookie() abstract, forcing each extending class to implement it. The former implementation is moved to SimpleSAML_SessionHandlerCookie, and the SimpleSAML_SessionHandlerPHP gets a new method that starts the session, effectively sending the cookie. SimpleSAML_Session would then be responsible to call the setCookie() method of the session handler when creating a regular session, and skip it when creating a transient one. This introduces a bug, since SimpleSAML_Session was trying to set the auth token cookie calling the same setCookie() method in the session handler. We fixed that by using SimpleSAML\Utils\HTTP::setCookie() instead, in 8756835b.
      
      This resolves #413.
      4056af12
    • Jaime Pérez's avatar
      Remove superfluous code. · 5a1edb83
      Jaime Pérez authored
      If we just called isset() on SimpleSAML_Session::$instance, and it returned false as we continued execution, it makes no sense to get the "previous" instance since it will always be null. We can just check that $instance is not null later.
      5a1edb83
    • Jaime Pérez's avatar
    • Jaime Pérez's avatar
      Add an optional parameter to SimpleSAML_Session::useTransientSession(). · 067398e8
      Jaime Pérez authored
      This way we can pass an exception that made us use transient sessions, and get the method to throw that exception after getting the transient session.
      067398e8
    • Jaime Pérez's avatar
      SimpleSAML_Session should set the auth token using the... · 8756835b
      Jaime Pérez authored
      SimpleSAML_Session should set the auth token using the SimpleSAML\Utils\HTTP::setCookie(), instead of the setCookie() method provided by session handlers.
      
      The SimpleSAML_SessionHandler::setCookie() method should be used only to set the session cookie, not random cookies. If we want cookies to have the same parameters as session cookies, we can always get the session parameters calling SimpleSAML_SessionHandler::getSessionParams() and pass them to SimpleSAML\Utils\HTTP::setCookie().
      8756835b
    • Jaime Pérez's avatar
      Make the SimpleSAML\Utils\HTTP::setCookie() method throw the new... · ae8c4195
      Jaime Pérez authored
      Make the SimpleSAML\Utils\HTTP::setCookie() method throw the new SimpleSAML\Error\CannotSetCookie exception.
      ae8c4195
    • Jaime Pérez's avatar
      Typo: s/overriden/overridden/. · a0360b7d
      Jaime Pérez authored
      a0360b7d
    • Jaime Pérez's avatar
    • Jaime Pérez's avatar
      Silence errors when setting a cookie. · 6a6db6d3
      Jaime Pérez authored
      6a6db6d3
    • Jaime Pérez's avatar
      Fix indentation. · 271be82c
      Jaime Pérez authored
      271be82c
  2. Jun 29, 2016
    • Jaime Pérez's avatar
      Add a new hook for exception handling. · 918dcd16
      Jaime Pérez authored
      In line with the previous commit, we now allow hooking in the exception handler, so that a module can implement its own logic to deal with certain exceptions.
      918dcd16
    • Jaime Pérez's avatar
      Stop intercepting exceptions in www/module.php. · 613e2c99
      Jaime Pérez authored
      The module.php file is the way we allow modules to have their own pages. All those are executed and presented to the user via this script. However, if an exception is thrown by a module, that exception will be captured directly by the module.php script. This prevents us from adding more logic to exception handling, adds code duplication, and makes the exception handling non-uniform, since we could end up handling the same exception differently depending on whether it was thrown by a module or by a regular page.
      
      Now we no longer intercept exceptions in module.php, allowing the exception handler to kick in. That way exceptions are always handled uniformly, and we can also implement additional logic that we may want (i.e. adding a hook to the exception handler so that modules could handle exceptions the way they want).
      613e2c99
  3. Jun 27, 2016
  4. Jun 24, 2016
  5. Jun 11, 2016
  6. Jun 10, 2016
  7. Jun 09, 2016
  8. Jun 08, 2016
Loading