private IndexedPermissions loadPermissions() {
        String userId = getCurrentUser();
        if (userId == null || userId.isBlank()) {
            return new IndexedPermissions(Collections.emptySet());
        }
        try {
            return new IndexedPermissions(query.getPermissions(userId));
        } catch (StorageException e) {
            LOGGER.error(Messages.getString("AbstractSecurityContext.ErrorLoadingPermissions") + userId, e); //$NON-NLS-1$
            return new IndexedPermissions(new HashSet<>());
        }
    }
Loads the current user's permissions into a thread local variable.
manager/api/security/src/main/java/io/apiman/manager/api/security/impl/AbstractSecurityContext.java