'Format federated information into the token reference.
The federated_dict is passed back from the federated token formatters.
The responsibility of this method is to format the information passed
back from the token formatter into the token reference before
constructing the token data from the V3TokenDataHelper.'

def _rebuild_federated_info(self, federated_dict, user_id):

    g_ids = federated_dict['group_ids']
    idp_id = federated_dict['idp_id']
    protocol_id = federated_dict['protocol_id']
    federated_info = {'groups': g_ids, 'identity_provider': {'id': idp_id}, 'protocol': {'id': protocol_id}}
    user_dict = self.identity_api.get_user(user_id)
    user_name = user_dict['name']
    token_dict = {'user': {federation_constants.FEDERATION: federated_info, 'id': user_id, 'name': user_name, 'domain': {'id': CONF.federation.federated_domain_name, 'name': CONF.federation.federated_domain_name}}}
    return token_dict
