code: def before_request():
      
      if not request.path.startswith('/saml') and not request.path.startswith('/auth'):
          # Validate the session has the items we need
          if 'accounts' not in session:
              logger.debug('Missing \'accounts\' from session object, sending user to login page')
              return BaseView.make_unauth_response()
  
          # Require the CSRF token to be present if we are performing a change action (add, delete or modify objects)
          # but exclude the SAML endpoints from the CSRF check
          if request.method in ('POST', 'PUT', 'DELETE',):
              if session['csrf_token'] != request.headers.get('X-Csrf-Token'):
                  logger.info('CSRF Token is missing or incorrect, sending user to login page')
                  abort(403)
docs: Checks to ensure that the session is valid and validates the users CSRF token is present
  
      Returns:
          `None`