'Extract everything needed for federated tokens.
This dictionary is passed to federated token formatters, which unpack
the values and build federated Fernet tokens.'

def _build_federated_info(self, token_data):

    token_data = token_data['token']
    try:
        user = token_data['user']
        federation = user[federation_constants.FEDERATION]
        idp_id = federation['identity_provider']['id']
        protocol_id = federation['protocol']['id']
    except KeyError:
        return
    group_ids = federation.get('groups')
    return {'group_ids': group_ids, 'idp_id': idp_id, 'protocol_id': protocol_id}
