Common code parts of authorization allocate into functions