Subject.doAs() is the correct API that associates a Subject with the current thread of execution in Java authentication and authorization. It executes an action as that Subject. AccessController.checkPermission() checks permissions but doesn't associate subjects with threads. SecurityManager.checkAccess() checks thread access control, not subject association.