Update authentication middleware