lib: Add AuthenticationException for exceptions thrown during authentication

Our user backends log exceptions thrown during authentication but they don't throw
a exception to inform the caller that an error occured. The new `AuthenticationException'
class should be thrown in that case.