Basic authorization algorithm