Mercurial > prosody-modules
comparison mod_auth_ccert/mod_auth_ccert.lua @ 1066:83175a6af8c5
mod_auth_ccert: Add optional method for certificates which contain an email address
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Fri, 14 Jun 2013 20:12:51 +0200 |
| parents | 3d04d9377a67 |
| children | 8649f78b1dde |
comparison
equal
deleted
inserted
replaced
| 1065:3d04d9377a67 | 1066:83175a6af8c5 |
|---|---|
| 26 | 26 |
| 27 for i=1,#xmppAddrs do | 27 for i=1,#xmppAddrs do |
| 28 if authz == "" or jid_compare(authz, xmppAddrs[i]) then | 28 if authz == "" or jid_compare(authz, xmppAddrs[i]) then |
| 29 (session.log or log)("debug", "xmppAddrs[%d] %q matches authz %q", i, xmppAddrs[i], authz) | 29 (session.log or log)("debug", "xmppAddrs[%d] %q matches authz %q", i, xmppAddrs[i], authz) |
| 30 local username, host = jid_split(xmppAddrs[i]); | 30 local username, host = jid_split(xmppAddrs[i]); |
| 31 if host == module.host then | |
| 32 return username, true | |
| 33 end | |
| 34 end | |
| 35 end | |
| 36 end | |
| 37 | |
| 38 function username_extractor.email(cert) | |
| 39 local subject = cert:subject(); | |
| 40 for i=1,#subject do | |
| 41 local ava = subject[i]; | |
| 42 if ava.oid == oid_emailAddress then | |
| 43 local username, host = jid_split(ava.value); | |
| 31 if host == module.host then | 44 if host == module.host then |
| 32 return username, true | 45 return username, true |
| 33 end | 46 end |
| 34 end | 47 end |
| 35 end | 48 end |
