I'd be more defensive about nulls here, i.e. if getContext() or getAuthentication() returns null then the method should return null rather than throw NullPointerException