Implement authentication for REST endpoints.