Mercurial > prosody-modules
comparison mod_sasl2/mod_sasl2.lua @ 5650:0eb2d5ea2428
merge
author | Stephen Paul Weber <singpolyma@singpolyma.net> |
---|---|
date | Sat, 06 May 2023 19:40:23 -0500 |
parents | 6526b670e66d |
children | 2597e2113561 |
comparison
equal
deleted
inserted
replaced
5649:2c69577b28c2 | 5650:0eb2d5ea2428 |
---|---|
119 error_text = err_msg; | 119 error_text = err_msg; |
120 }); | 120 }); |
121 end | 121 end |
122 | 122 |
123 module:hook("sasl2/c2s/failure", function (event) | 123 module:hook("sasl2/c2s/failure", function (event) |
124 module:fire_event("authentication-failure", event); | |
124 local session, condition, text = event.session, event.message, event.error_text; | 125 local session, condition, text = event.session, event.message, event.error_text; |
125 local failure = st.stanza("failure", { xmlns = xmlns_sasl2 }) | 126 local failure = st.stanza("failure", { xmlns = xmlns_sasl2 }) |
126 :tag(condition, { xmlns = "urn:ietf:params:xml:ns:xmpp-sasl" }):up(); | 127 :tag(condition, { xmlns = "urn:ietf:params:xml:ns:xmpp-sasl" }):up(); |
127 if text then | 128 if text then |
128 failure:text_tag("text", text); | 129 failure:text_tag("text", text); |
163 event.success:text_tag("authorization-identifier", jid_join(session.username, session.host, session.resource)); | 164 event.success:text_tag("authorization-identifier", jid_join(session.username, session.host, session.resource)); |
164 session.send(event.success); | 165 session.send(event.success); |
165 end, -1000); | 166 end, -1000); |
166 | 167 |
167 module:hook("sasl2/c2s/success", function (event) | 168 module:hook("sasl2/c2s/success", function (event) |
169 module:fire_event("authentication-success", event); | |
168 local session = event.session; | 170 local session = event.session; |
169 local features = st.stanza("stream:features"); | 171 local features = st.stanza("stream:features"); |
170 module:fire_event("stream-features", { origin = session, features = features }); | 172 module:fire_event("stream-features", { origin = session, features = features }); |
171 session.send(features); | 173 session.send(features); |
172 end, -1500); | 174 end, -1500); |
204 return handle_status(session, "failure", "invalid-mechanism"); | 206 return handle_status(session, "failure", "invalid-mechanism"); |
205 end | 207 end |
206 local user_agent = auth:get_child("user-agent"); | 208 local user_agent = auth:get_child("user-agent"); |
207 if user_agent then | 209 if user_agent then |
208 session.client_id = user_agent.attr.id; | 210 session.client_id = user_agent.attr.id; |
211 sasl_handler.user_agent = { | |
212 software = user_agent:get_child_text("software"); | |
213 device = user_agent:get_child_text("device"); | |
214 }; | |
209 end | 215 end |
210 local initial = auth:get_child_text("initial-response"); | 216 local initial = auth:get_child_text("initial-response"); |
211 return process_cdata(session, initial); | 217 return process_cdata(session, initial); |
212 end); | 218 end); |
213 | 219 |