Move all API authentication code to APIGuard

Open Douwe Maan requested to merge dm-api-authentication into master