modified authorize method and tests