public static function fromToken(
        TokenInterface $token,
        OrganizationalContextInterface $context = null,
        RoleHierarchyInterface $roleHierarchy = null
    ) {
        $user = $token->getUser();

        if (!$user instanceof UserInterface) {
            return [];
        }

        return null !== $context
            ? static::getSecurityIdentityForCurrentOrganization($context, $roleHierarchy)
            : static::getSecurityIdentityForAllOrganizations($user, $roleHierarchy);
    }