Software /
code /
prosody
Comparison
core/sessionmanager.lua @ 10642:de90b2f5da8c
sessionmanager: Support passing an auth scope to make_authenticated
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Wed, 05 Feb 2020 17:56:20 +0000 |
parent | 10378:04c4750ff8d2 |
child | 11518:3f1a865e9419 |
comparison
equal
deleted
inserted
replaced
10641:85f1cbfd364a | 10642:de90b2f5da8c |
---|---|
120 end | 120 end |
121 | 121 |
122 retire_session(session); | 122 retire_session(session); |
123 end | 123 end |
124 | 124 |
125 local function make_authenticated(session, username) | 125 local function make_authenticated(session, username, scope) |
126 username = nodeprep(username); | 126 username = nodeprep(username); |
127 if not username or #username == 0 then return nil, "Invalid username"; end | 127 if not username or #username == 0 then return nil, "Invalid username"; end |
128 session.username = username; | 128 session.username = username; |
129 if session.type == "c2s_unauthed" then | 129 if session.type == "c2s_unauthed" then |
130 session.type = "c2s_unbound"; | 130 session.type = "c2s_unbound"; |
131 end | 131 end |
132 session.auth_scope = scope; | |
132 session.log("info", "Authenticated as %s@%s", username, session.host or "(unknown)"); | 133 session.log("info", "Authenticated as %s@%s", username, session.host or "(unknown)"); |
133 return true; | 134 return true; |
134 end | 135 end |
135 | 136 |
136 -- returns true, nil on success | 137 -- returns true, nil on success |