Support authorization in service provider

Hi. Please review and merge if you like and have time.

I appologize for any mistakes.