code changes to implement custom authentication