def check_security!
      if controller
        if cookies[:browser_id] != self.browser_id
          invalidate!
          Authie.config.events.dispatch(:browser_id_mismatch_error, self)
          raise BrowserMismatch, "Browser ID mismatch"
        end

        unless self.active?
          invalidate!
          Authie.config.events.dispatch(:invalid_session_error, self)
          raise InactiveSession, "Session is no longer active"
        end

        if self.expired?
          invalidate!
          Authie.config.events.dispatch(:expired_session_error, self)
          raise ExpiredSession, "Persistent session has expired"
        end

        if self.inactive?
          invalidate!
          Authie.config.events.dispatch(:inactive_session_error, self)
          raise InactiveSession, "Non-persistent session has expired"
        end

        if self.host && self.host != controller.request.host
          invalidate!
          Authie.config.events.dispatch(:host_mismatch_error, self)
          raise HostMismatch, "Session was created on #{self.host} but accessed using #{controller.request.host}"
        end
      end
    end
def check_security!
      if controller
        if cookies[:browser_id] != self.browser_id
          invalidate!
          Authie.config.events.dispatch(:browser_id_mismatch_error, self)
          raise BrowserMismatch, "Browser ID mismatch"
        end

        unless self.active?
          invalidate!
          Authie.config.events.dispatch(:invalid_session_error, self)
          raise InactiveSession, "Session is no longer active"
        end

        if self.expired?
          invalidate!
          Authie.config.events.dispatch(:expired_session_error, self)
          raise ExpiredSession, "Persistent session has expired"
        end

        if self.inactive?
          invalidate!
          Authie.config.events.dispatch(:inactive_session_error, self)
          raise InactiveSession, "Non-persistent session has expired"
        end

        if self.host && self.host != controller.request.host
          invalidate!
          Authie.config.events.dispatch(:host_mismatch_error, self)
          raise HostMismatch, "Session was created on #{self.host} but accessed using #{controller.request.host}"
        end
      end
    end
Check the security of the session to ensure it can be used.