refactored authorization in generator