'Create new authorizations for all domains of the CSR and return
the challenge details for the choosen challenge type.'

def do_challenges(self):

    data = {}
    for domain in self.domains:
        auth = self._get_domain_auth(domain)
        if (auth is None):
            new_auth = self._new_authz(domain)
            self._add_or_update_auth(new_auth)
            data[domain] = self._get_challenge_data(new_auth)
            self.changed = True
        elif ((auth['status'] == 'pending') or ('status' not in auth)):
            self._validate_challenges(auth)
            data[domain] = self._get_challenge_data(self._get_domain_auth(domain))
    return data
