Backport AuthorizeTest from 2.1

Signed-off-by: crynobone <crynobone@gmail.com>