Identity/OrganizationSecurityIdentity.php
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);
    }
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);
    }
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 ) ; }
Creates a organization security identity from a TokenInterface.

@param TokenInterface                      $token         The token
@param null|OrganizationalContextInterface $context       The organizational context
@param null|RoleHierarchyInterface         $roleHierarchy The role hierarchy

@return SecurityIdentityInterface[]
Creates a organization security identity from a TokenInterface .