Connect authentication middleware for connect