middleware for magento auth