change session middleware api