Software /
code /
prosody-modules
Annotate
mod_motd_sequential/mod_motd_sequential.lua @ 5705:527c747711f3
mod_http_oauth2: Limit revocation to clients own tokens in strict mode
RFC 7009 section 2.1 states:
> The authorization server first validates the client credentials (in
> case of a confidential client) and then verifies whether the token was
> issued to the client making the revocation request. If this
> validation fails, the request is refused and the client is informed of
> the error by the authorization server as described below.
The first part was already covered (in strict mode). This adds the later
part using the hash of client_id recorded in 0860497152af
It still seems weird to me that revoking a leaked token should not be
allowed whoever might have discovered it, as that seems the responsible
thing to do.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sun, 29 Oct 2023 11:30:49 +0100 |
parent | 3401:8412592f3011 |
rev | line source |
---|---|
234
abcb59ab355c
Add new motd_sequential module. This module lets you define numbered messages shown to each user in order, but only once per user, and persistent across server restarts. Useful for notifying users of added features and changes in an
Jeff Mitchell <jeffrey.mitchell@gmail.com>
parents:
diff
changeset
|
1 -- Prosody IM |
abcb59ab355c
Add new motd_sequential module. This module lets you define numbered messages shown to each user in order, but only once per user, and persistent across server restarts. Useful for notifying users of added features and changes in an
Jeff Mitchell <jeffrey.mitchell@gmail.com>
parents:
diff
changeset
|
2 -- Copyright (C) 2008-2010 Matthew Wild |
abcb59ab355c
Add new motd_sequential module. This module lets you define numbered messages shown to each user in order, but only once per user, and persistent across server restarts. Useful for notifying users of added features and changes in an
Jeff Mitchell <jeffrey.mitchell@gmail.com>
parents:
diff
changeset
|
3 -- Copyright (C) 2008-2010 Waqas Hussain |
abcb59ab355c
Add new motd_sequential module. This module lets you define numbered messages shown to each user in order, but only once per user, and persistent across server restarts. Useful for notifying users of added features and changes in an
Jeff Mitchell <jeffrey.mitchell@gmail.com>
parents:
diff
changeset
|
4 -- Copyright (C) 2010 Jeff Mitchell |
1343
7dbde05b48a9
all the things: Remove trailing whitespace
Florian Zeitz <florob@babelmonkeys.de>
parents:
234
diff
changeset
|
5 -- |
234
abcb59ab355c
Add new motd_sequential module. This module lets you define numbered messages shown to each user in order, but only once per user, and persistent across server restarts. Useful for notifying users of added features and changes in an
Jeff Mitchell <jeffrey.mitchell@gmail.com>
parents:
diff
changeset
|
6 -- This project is MIT/X11 licensed. Please see the |
abcb59ab355c
Add new motd_sequential module. This module lets you define numbered messages shown to each user in order, but only once per user, and persistent across server restarts. Useful for notifying users of added features and changes in an
Jeff Mitchell <jeffrey.mitchell@gmail.com>
parents:
diff
changeset
|
7 -- COPYING file in the source package for more information. |
abcb59ab355c
Add new motd_sequential module. This module lets you define numbered messages shown to each user in order, but only once per user, and persistent across server restarts. Useful for notifying users of added features and changes in an
Jeff Mitchell <jeffrey.mitchell@gmail.com>
parents:
diff
changeset
|
8 -- |
abcb59ab355c
Add new motd_sequential module. This module lets you define numbered messages shown to each user in order, but only once per user, and persistent across server restarts. Useful for notifying users of added features and changes in an
Jeff Mitchell <jeffrey.mitchell@gmail.com>
parents:
diff
changeset
|
9 |
3400
272908ea99c9
mod_motd_sequential: Fix for deprecation of global routing functions (fixes #1258)
Kim Alvefur <zash@zash.se>
parents:
2887
diff
changeset
|
10 local core_route_stanza = prosody.core_route_stanza; |
234
abcb59ab355c
Add new motd_sequential module. This module lets you define numbered messages shown to each user in order, but only once per user, and persistent across server restarts. Useful for notifying users of added features and changes in an
Jeff Mitchell <jeffrey.mitchell@gmail.com>
parents:
diff
changeset
|
11 local host = module:get_host(); |
abcb59ab355c
Add new motd_sequential module. This module lets you define numbered messages shown to each user in order, but only once per user, and persistent across server restarts. Useful for notifying users of added features and changes in an
Jeff Mitchell <jeffrey.mitchell@gmail.com>
parents:
diff
changeset
|
12 local motd_jid = module:get_option("motd_jid") or host; |
abcb59ab355c
Add new motd_sequential module. This module lets you define numbered messages shown to each user in order, but only once per user, and persistent across server restarts. Useful for notifying users of added features and changes in an
Jeff Mitchell <jeffrey.mitchell@gmail.com>
parents:
diff
changeset
|
13 local datamanager = require "util.datamanager"; |
abcb59ab355c
Add new motd_sequential module. This module lets you define numbered messages shown to each user in order, but only once per user, and persistent across server restarts. Useful for notifying users of added features and changes in an
Jeff Mitchell <jeffrey.mitchell@gmail.com>
parents:
diff
changeset
|
14 local ipairs = ipairs; |
abcb59ab355c
Add new motd_sequential module. This module lets you define numbered messages shown to each user in order, but only once per user, and persistent across server restarts. Useful for notifying users of added features and changes in an
Jeff Mitchell <jeffrey.mitchell@gmail.com>
parents:
diff
changeset
|
15 local motd_sequential_messages = module:get_option("motd_sequential_messages") or {}; |
abcb59ab355c
Add new motd_sequential module. This module lets you define numbered messages shown to each user in order, but only once per user, and persistent across server restarts. Useful for notifying users of added features and changes in an
Jeff Mitchell <jeffrey.mitchell@gmail.com>
parents:
diff
changeset
|
16 local motd_messagesets = {}; |
abcb59ab355c
Add new motd_sequential module. This module lets you define numbered messages shown to each user in order, but only once per user, and persistent across server restarts. Useful for notifying users of added features and changes in an
Jeff Mitchell <jeffrey.mitchell@gmail.com>
parents:
diff
changeset
|
17 local max = 1; |
abcb59ab355c
Add new motd_sequential module. This module lets you define numbered messages shown to each user in order, but only once per user, and persistent across server restarts. Useful for notifying users of added features and changes in an
Jeff Mitchell <jeffrey.mitchell@gmail.com>
parents:
diff
changeset
|
18 for i, message in ipairs(motd_sequential_messages) do |
abcb59ab355c
Add new motd_sequential module. This module lets you define numbered messages shown to each user in order, but only once per user, and persistent across server restarts. Useful for notifying users of added features and changes in an
Jeff Mitchell <jeffrey.mitchell@gmail.com>
parents:
diff
changeset
|
19 motd_messagesets[i] = message; |
abcb59ab355c
Add new motd_sequential module. This module lets you define numbered messages shown to each user in order, but only once per user, and persistent across server restarts. Useful for notifying users of added features and changes in an
Jeff Mitchell <jeffrey.mitchell@gmail.com>
parents:
diff
changeset
|
20 max = i; |
abcb59ab355c
Add new motd_sequential module. This module lets you define numbered messages shown to each user in order, but only once per user, and persistent across server restarts. Useful for notifying users of added features and changes in an
Jeff Mitchell <jeffrey.mitchell@gmail.com>
parents:
diff
changeset
|
21 end |
abcb59ab355c
Add new motd_sequential module. This module lets you define numbered messages shown to each user in order, but only once per user, and persistent across server restarts. Useful for notifying users of added features and changes in an
Jeff Mitchell <jeffrey.mitchell@gmail.com>
parents:
diff
changeset
|
22 |
abcb59ab355c
Add new motd_sequential module. This module lets you define numbered messages shown to each user in order, but only once per user, and persistent across server restarts. Useful for notifying users of added features and changes in an
Jeff Mitchell <jeffrey.mitchell@gmail.com>
parents:
diff
changeset
|
23 local st = require "util.stanza"; |
abcb59ab355c
Add new motd_sequential module. This module lets you define numbered messages shown to each user in order, but only once per user, and persistent across server restarts. Useful for notifying users of added features and changes in an
Jeff Mitchell <jeffrey.mitchell@gmail.com>
parents:
diff
changeset
|
24 |
abcb59ab355c
Add new motd_sequential module. This module lets you define numbered messages shown to each user in order, but only once per user, and persistent across server restarts. Useful for notifying users of added features and changes in an
Jeff Mitchell <jeffrey.mitchell@gmail.com>
parents:
diff
changeset
|
25 module:hook("resource-bind", |
abcb59ab355c
Add new motd_sequential module. This module lets you define numbered messages shown to each user in order, but only once per user, and persistent across server restarts. Useful for notifying users of added features and changes in an
Jeff Mitchell <jeffrey.mitchell@gmail.com>
parents:
diff
changeset
|
26 function (event) |
abcb59ab355c
Add new motd_sequential module. This module lets you define numbered messages shown to each user in order, but only once per user, and persistent across server restarts. Useful for notifying users of added features and changes in an
Jeff Mitchell <jeffrey.mitchell@gmail.com>
parents:
diff
changeset
|
27 local session = event.session; |
abcb59ab355c
Add new motd_sequential module. This module lets you define numbered messages shown to each user in order, but only once per user, and persistent across server restarts. Useful for notifying users of added features and changes in an
Jeff Mitchell <jeffrey.mitchell@gmail.com>
parents:
diff
changeset
|
28 local alreadyseen_list = datamanager.load(session.username, session.host, "motd_sequential_seen") or { max = 0 }; |
abcb59ab355c
Add new motd_sequential module. This module lets you define numbered messages shown to each user in order, but only once per user, and persistent across server restarts. Useful for notifying users of added features and changes in an
Jeff Mitchell <jeffrey.mitchell@gmail.com>
parents:
diff
changeset
|
29 local alreadyseen = alreadyseen_list["max"] + 1; |
3401
8412592f3011
mod_motd_sequential: Fix typo (fixes unintentional global access)
Kim Alvefur <zash@zash.se>
parents:
3400
diff
changeset
|
30 local motd_stanza; |
234
abcb59ab355c
Add new motd_sequential module. This module lets you define numbered messages shown to each user in order, but only once per user, and persistent across server restarts. Useful for notifying users of added features and changes in an
Jeff Mitchell <jeffrey.mitchell@gmail.com>
parents:
diff
changeset
|
31 for i = alreadyseen, max do |
abcb59ab355c
Add new motd_sequential module. This module lets you define numbered messages shown to each user in order, but only once per user, and persistent across server restarts. Useful for notifying users of added features and changes in an
Jeff Mitchell <jeffrey.mitchell@gmail.com>
parents:
diff
changeset
|
32 motd_stanza = |
2887
65082d91950e
Many modules: Simplify st.message(…):tag("body"):text(…):up() into st.message(…, …)
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
1343
diff
changeset
|
33 st.message({ to = session.username..'@'..session.host, from = motd_jid }, |
65082d91950e
Many modules: Simplify st.message(…):tag("body"):text(…):up() into st.message(…, …)
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
1343
diff
changeset
|
34 motd_messagesets[i]); |
234
abcb59ab355c
Add new motd_sequential module. This module lets you define numbered messages shown to each user in order, but only once per user, and persistent across server restarts. Useful for notifying users of added features and changes in an
Jeff Mitchell <jeffrey.mitchell@gmail.com>
parents:
diff
changeset
|
35 core_route_stanza(hosts[host], motd_stanza); |
abcb59ab355c
Add new motd_sequential module. This module lets you define numbered messages shown to each user in order, but only once per user, and persistent across server restarts. Useful for notifying users of added features and changes in an
Jeff Mitchell <jeffrey.mitchell@gmail.com>
parents:
diff
changeset
|
36 module:log("debug", "MOTD send to user %s@%s", session.username, session.host); |
abcb59ab355c
Add new motd_sequential module. This module lets you define numbered messages shown to each user in order, but only once per user, and persistent across server restarts. Useful for notifying users of added features and changes in an
Jeff Mitchell <jeffrey.mitchell@gmail.com>
parents:
diff
changeset
|
37 end |
abcb59ab355c
Add new motd_sequential module. This module lets you define numbered messages shown to each user in order, but only once per user, and persistent across server restarts. Useful for notifying users of added features and changes in an
Jeff Mitchell <jeffrey.mitchell@gmail.com>
parents:
diff
changeset
|
38 alreadyseen_list["max"] = max; |
abcb59ab355c
Add new motd_sequential module. This module lets you define numbered messages shown to each user in order, but only once per user, and persistent across server restarts. Useful for notifying users of added features and changes in an
Jeff Mitchell <jeffrey.mitchell@gmail.com>
parents:
diff
changeset
|
39 datamanager.store(session.username, session.host, "motd_sequential_seen", alreadyseen_list); |
abcb59ab355c
Add new motd_sequential module. This module lets you define numbered messages shown to each user in order, but only once per user, and persistent across server restarts. Useful for notifying users of added features and changes in an
Jeff Mitchell <jeffrey.mitchell@gmail.com>
parents:
diff
changeset
|
40 end); |