Authentication middleware for xAPI