moved the authentication function

Signed-off-by: Alexander Skjolden <alex@plastboks.net>