Initial version of authorize implementation