Added an authentication check in EnforceUserTypeMiddleware.