MiddleWare for restricting access