- self.state["servernonce"] = generate_uuid();
-
- -- retreive credentials
- if self.profile.plain then
- password, state = self.profile.plain(self.state.name, self.realm)
- if state == nil then return "failure", "not-authorized"
- elseif state == false then return "failure", "account-disabled" end
-
- password = saslprep(password);
- if not password then
- log("debug", "Password violates SASLprep.");
- return "failure", "not-authorized", "Invalid password."
- end
- self.state.salt = generate_uuid();
- self.state.iteration_count = default_i;
- self.state.salted_password = Hi(HMAC_f, password, self.state.salt, default_i);
- elseif self.profile["scram_"..hash_name] then
- salted_password, iteration_count, salt, state = self.profile["scram-"..hash_name](self.state.name, self.realm);
- if state == nil then return "failure", "not-authorized"
- elseif state == false then return "failure", "account-disabled" end
-
- self.state.salted_password = salted_password;
- self.state.iteration_count = iteration_count;
- self.state.salt = salt
- end