From 86385381635f0cedbc6c6e9cc5e3220321919586 Mon Sep 17 00:00:00 2001 From: Jason Robinson Date: Tue, 20 May 2025 15:21:13 +0300 Subject: [PATCH 1/8] Add missing `branding` config to docs Mostly copied from the code, with some additions from https://github.com/matrix-org/matrix-authentication-service/pull/2325 --- docs/reference/configuration.md | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/docs/reference/configuration.md b/docs/reference/configuration.md index 2303e889e..692a60052 100644 --- a/docs/reference/configuration.md +++ b/docs/reference/configuration.md @@ -772,6 +772,37 @@ upstream_oauth2: #template: "@{{ user.preferred_username }}" ``` +## `branding` + +Configuration section for tweaking the branding of the service. + +```yaml +branding: + # A human-readable name. Defaults to the server's address. + #service_name: + + # Link to a privacy policy, displayed in the footer of web pages and + # emails. It is also advertised to clients through the `op_policy_uri` + # OIDC provider metadata. + #policy_uri: + + # Link to a terms of service document, displayed in the footer of web + # pages and emails. It is also advertised to clients through the + # `op_tos_uri` OIDC provider metadata. + # + # This also adds a mandatory checkbox during registration. The value of + # this config item will be stored in the `user_terms` table to indicate + # which ToS document the user accepted. Note that currently changing this + # value will not force existing users to re-accept terms. + #tos_uri: + + # Legal imprint, displayed in the footer in the footer of web pages and emails. + #imprint: + + # Logo displayed in some web pages. + #logo_uri: +``` + ## `experimental` Settings that may change or be removed in future versions. From 40f2d17d77a5f32eb262c8c0d47e2b5a1dd7542e Mon Sep 17 00:00:00 2001 From: Jason Robinson Date: Thu, 7 Aug 2025 13:14:41 +0300 Subject: [PATCH 2/8] Include `builtins` to `minijinja` features This allows using `urlencode` and `replace` filters when doing attribute mapping with Jinj2. See https://docs.rs/minijinja/latest/minijinja/filters/fn.replace.html and https://docs.rs/minijinja/latest/minijinja/filters/fn.urlencode.html --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 904dea39a..ab37a4692 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -379,7 +379,7 @@ version = "0.3.17" # Templates [workspace.dependencies.minijinja] version = "2.11.0" -features = ["loader", "json", "speedups", "unstable_machinery"] +features = ["builtins", "loader", "json", "speedups", "unstable_machinery"] # Additional filters for minijinja [workspace.dependencies.minijinja-contrib] From ad8ac86f526cb3a2ebb3c8e9829897be35a3d646 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 12 Aug 2025 13:00:58 +0000 Subject: [PATCH 3/8] Translations updates --- frontend/.storybook/locales.ts | 62 +++++++++++++++++----------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/frontend/.storybook/locales.ts b/frontend/.storybook/locales.ts index 090812bf0..c89c37bd2 100644 --- a/frontend/.storybook/locales.ts +++ b/frontend/.storybook/locales.ts @@ -27,7 +27,7 @@ export type LocalazyMetadata = { }; const localazyMetadata: LocalazyMetadata = { - projectUrl: "https://localazy.com/p/matrix-authentication-service", + projectUrl: "https://localazy.com/p/matrix-authentication-service!v1.0", baseLocale: "en", languages: [ { @@ -172,21 +172,21 @@ const localazyMetadata: LocalazyMetadata = { file: "frontend.json", path: "", cdnFiles: { - "cs": "https://delivery.localazy.com/_a7686032324574572744739e0707/_e0/7c203a8ac8bd48c3c4609a8effcd0fbac430f9b2/cs/frontend.json", - "da": "https://delivery.localazy.com/_a7686032324574572744739e0707/_e0/7c203a8ac8bd48c3c4609a8effcd0fbac430f9b2/da/frontend.json", - "de": "https://delivery.localazy.com/_a7686032324574572744739e0707/_e0/7c203a8ac8bd48c3c4609a8effcd0fbac430f9b2/de/frontend.json", - "en": "https://delivery.localazy.com/_a7686032324574572744739e0707/_e0/7c203a8ac8bd48c3c4609a8effcd0fbac430f9b2/en/frontend.json", - "et": "https://delivery.localazy.com/_a7686032324574572744739e0707/_e0/7c203a8ac8bd48c3c4609a8effcd0fbac430f9b2/et/frontend.json", - "fi": "https://delivery.localazy.com/_a7686032324574572744739e0707/_e0/7c203a8ac8bd48c3c4609a8effcd0fbac430f9b2/fi/frontend.json", - "fr": "https://delivery.localazy.com/_a7686032324574572744739e0707/_e0/7c203a8ac8bd48c3c4609a8effcd0fbac430f9b2/fr/frontend.json", - "hu": "https://delivery.localazy.com/_a7686032324574572744739e0707/_e0/7c203a8ac8bd48c3c4609a8effcd0fbac430f9b2/hu/frontend.json", - "nb_NO": "https://delivery.localazy.com/_a7686032324574572744739e0707/_e0/7c203a8ac8bd48c3c4609a8effcd0fbac430f9b2/nb-NO/frontend.json", - "nl": "https://delivery.localazy.com/_a7686032324574572744739e0707/_e0/7c203a8ac8bd48c3c4609a8effcd0fbac430f9b2/nl/frontend.json", - "pt": "https://delivery.localazy.com/_a7686032324574572744739e0707/_e0/7c203a8ac8bd48c3c4609a8effcd0fbac430f9b2/pt/frontend.json", - "ru": "https://delivery.localazy.com/_a7686032324574572744739e0707/_e0/7c203a8ac8bd48c3c4609a8effcd0fbac430f9b2/ru/frontend.json", - "sv": "https://delivery.localazy.com/_a7686032324574572744739e0707/_e0/7c203a8ac8bd48c3c4609a8effcd0fbac430f9b2/sv/frontend.json", - "uk": "https://delivery.localazy.com/_a7686032324574572744739e0707/_e0/7c203a8ac8bd48c3c4609a8effcd0fbac430f9b2/uk/frontend.json", - "zh#Hans": "https://delivery.localazy.com/_a7686032324574572744739e0707/_e0/7c203a8ac8bd48c3c4609a8effcd0fbac430f9b2/zh-Hans/frontend.json" + "cs": "https://delivery.localazy.com/_a6852319594175263500b59d766a/_e0/7c203a8ac8bd48c3c4609a8effcd0fbac430f9b2/cs/frontend.json", + "da": "https://delivery.localazy.com/_a6852319594175263500b59d766a/_e0/7c203a8ac8bd48c3c4609a8effcd0fbac430f9b2/da/frontend.json", + "de": "https://delivery.localazy.com/_a6852319594175263500b59d766a/_e0/7c203a8ac8bd48c3c4609a8effcd0fbac430f9b2/de/frontend.json", + "en": "https://delivery.localazy.com/_a6852319594175263500b59d766a/_e0/7c203a8ac8bd48c3c4609a8effcd0fbac430f9b2/en/frontend.json", + "et": "https://delivery.localazy.com/_a6852319594175263500b59d766a/_e0/7c203a8ac8bd48c3c4609a8effcd0fbac430f9b2/et/frontend.json", + "fi": "https://delivery.localazy.com/_a6852319594175263500b59d766a/_e0/7c203a8ac8bd48c3c4609a8effcd0fbac430f9b2/fi/frontend.json", + "fr": "https://delivery.localazy.com/_a6852319594175263500b59d766a/_e0/7c203a8ac8bd48c3c4609a8effcd0fbac430f9b2/fr/frontend.json", + "hu": "https://delivery.localazy.com/_a6852319594175263500b59d766a/_e0/7c203a8ac8bd48c3c4609a8effcd0fbac430f9b2/hu/frontend.json", + "nb_NO": "https://delivery.localazy.com/_a6852319594175263500b59d766a/_e0/7c203a8ac8bd48c3c4609a8effcd0fbac430f9b2/nb-NO/frontend.json", + "nl": "https://delivery.localazy.com/_a6852319594175263500b59d766a/_e0/7c203a8ac8bd48c3c4609a8effcd0fbac430f9b2/nl/frontend.json", + "pt": "https://delivery.localazy.com/_a6852319594175263500b59d766a/_e0/7c203a8ac8bd48c3c4609a8effcd0fbac430f9b2/pt/frontend.json", + "ru": "https://delivery.localazy.com/_a6852319594175263500b59d766a/_e0/7c203a8ac8bd48c3c4609a8effcd0fbac430f9b2/ru/frontend.json", + "sv": "https://delivery.localazy.com/_a6852319594175263500b59d766a/_e0/7c203a8ac8bd48c3c4609a8effcd0fbac430f9b2/sv/frontend.json", + "uk": "https://delivery.localazy.com/_a6852319594175263500b59d766a/_e0/7c203a8ac8bd48c3c4609a8effcd0fbac430f9b2/uk/frontend.json", + "zh#Hans": "https://delivery.localazy.com/_a6852319594175263500b59d766a/_e0/7c203a8ac8bd48c3c4609a8effcd0fbac430f9b2/zh-Hans/frontend.json" } }, { @@ -194,21 +194,21 @@ const localazyMetadata: LocalazyMetadata = { file: "file.json", path: "", cdnFiles: { - "cs": "https://delivery.localazy.com/_a7686032324574572744739e0707/_e0/5b69b0350dccfd47c245a5d41c1b9fdf6912cc6e/cs/file.json", - "da": "https://delivery.localazy.com/_a7686032324574572744739e0707/_e0/5b69b0350dccfd47c245a5d41c1b9fdf6912cc6e/da/file.json", - "de": "https://delivery.localazy.com/_a7686032324574572744739e0707/_e0/5b69b0350dccfd47c245a5d41c1b9fdf6912cc6e/de/file.json", - "en": "https://delivery.localazy.com/_a7686032324574572744739e0707/_e0/5b69b0350dccfd47c245a5d41c1b9fdf6912cc6e/en/file.json", - "et": "https://delivery.localazy.com/_a7686032324574572744739e0707/_e0/5b69b0350dccfd47c245a5d41c1b9fdf6912cc6e/et/file.json", - "fi": "https://delivery.localazy.com/_a7686032324574572744739e0707/_e0/5b69b0350dccfd47c245a5d41c1b9fdf6912cc6e/fi/file.json", - "fr": "https://delivery.localazy.com/_a7686032324574572744739e0707/_e0/5b69b0350dccfd47c245a5d41c1b9fdf6912cc6e/fr/file.json", - "hu": "https://delivery.localazy.com/_a7686032324574572744739e0707/_e0/5b69b0350dccfd47c245a5d41c1b9fdf6912cc6e/hu/file.json", - "nb_NO": "https://delivery.localazy.com/_a7686032324574572744739e0707/_e0/5b69b0350dccfd47c245a5d41c1b9fdf6912cc6e/nb-NO/file.json", - "nl": "https://delivery.localazy.com/_a7686032324574572744739e0707/_e0/5b69b0350dccfd47c245a5d41c1b9fdf6912cc6e/nl/file.json", - "pt": "https://delivery.localazy.com/_a7686032324574572744739e0707/_e0/5b69b0350dccfd47c245a5d41c1b9fdf6912cc6e/pt/file.json", - "ru": "https://delivery.localazy.com/_a7686032324574572744739e0707/_e0/5b69b0350dccfd47c245a5d41c1b9fdf6912cc6e/ru/file.json", - "sv": "https://delivery.localazy.com/_a7686032324574572744739e0707/_e0/5b69b0350dccfd47c245a5d41c1b9fdf6912cc6e/sv/file.json", - "uk": "https://delivery.localazy.com/_a7686032324574572744739e0707/_e0/5b69b0350dccfd47c245a5d41c1b9fdf6912cc6e/uk/file.json", - "zh#Hans": "https://delivery.localazy.com/_a7686032324574572744739e0707/_e0/5b69b0350dccfd47c245a5d41c1b9fdf6912cc6e/zh-Hans/file.json" + "cs": "https://delivery.localazy.com/_a6852319594175263500b59d766a/_e0/5b69b0350dccfd47c245a5d41c1b9fdf6912cc6e/cs/file.json", + "da": "https://delivery.localazy.com/_a6852319594175263500b59d766a/_e0/5b69b0350dccfd47c245a5d41c1b9fdf6912cc6e/da/file.json", + "de": "https://delivery.localazy.com/_a6852319594175263500b59d766a/_e0/5b69b0350dccfd47c245a5d41c1b9fdf6912cc6e/de/file.json", + "en": "https://delivery.localazy.com/_a6852319594175263500b59d766a/_e0/5b69b0350dccfd47c245a5d41c1b9fdf6912cc6e/en/file.json", + "et": "https://delivery.localazy.com/_a6852319594175263500b59d766a/_e0/5b69b0350dccfd47c245a5d41c1b9fdf6912cc6e/et/file.json", + "fi": "https://delivery.localazy.com/_a6852319594175263500b59d766a/_e0/5b69b0350dccfd47c245a5d41c1b9fdf6912cc6e/fi/file.json", + "fr": "https://delivery.localazy.com/_a6852319594175263500b59d766a/_e0/5b69b0350dccfd47c245a5d41c1b9fdf6912cc6e/fr/file.json", + "hu": "https://delivery.localazy.com/_a6852319594175263500b59d766a/_e0/5b69b0350dccfd47c245a5d41c1b9fdf6912cc6e/hu/file.json", + "nb_NO": "https://delivery.localazy.com/_a6852319594175263500b59d766a/_e0/5b69b0350dccfd47c245a5d41c1b9fdf6912cc6e/nb-NO/file.json", + "nl": "https://delivery.localazy.com/_a6852319594175263500b59d766a/_e0/5b69b0350dccfd47c245a5d41c1b9fdf6912cc6e/nl/file.json", + "pt": "https://delivery.localazy.com/_a6852319594175263500b59d766a/_e0/5b69b0350dccfd47c245a5d41c1b9fdf6912cc6e/pt/file.json", + "ru": "https://delivery.localazy.com/_a6852319594175263500b59d766a/_e0/5b69b0350dccfd47c245a5d41c1b9fdf6912cc6e/ru/file.json", + "sv": "https://delivery.localazy.com/_a6852319594175263500b59d766a/_e0/5b69b0350dccfd47c245a5d41c1b9fdf6912cc6e/sv/file.json", + "uk": "https://delivery.localazy.com/_a6852319594175263500b59d766a/_e0/5b69b0350dccfd47c245a5d41c1b9fdf6912cc6e/uk/file.json", + "zh#Hans": "https://delivery.localazy.com/_a6852319594175263500b59d766a/_e0/5b69b0350dccfd47c245a5d41c1b9fdf6912cc6e/zh-Hans/file.json" } } ] From 5878c994c2df9614b7ec9633a069a065e61d5904 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 12 Aug 2025 13:16:21 +0000 Subject: [PATCH 4/8] 1.0.0 --- Cargo.lock | 56 +++++++++++++++++++++++++------------------------- Cargo.toml | 60 +++++++++++++++++++++++++++--------------------------- 2 files changed, 58 insertions(+), 58 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7355fd7a1..fa159c704 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3116,7 +3116,7 @@ dependencies = [ [[package]] name = "mas-axum-utils" -version = "1.0.0-rc.0" +version = "1.0.0" dependencies = [ "anyhow", "axum", @@ -3150,7 +3150,7 @@ dependencies = [ [[package]] name = "mas-cli" -version = "1.0.0-rc.0" +version = "1.0.0" dependencies = [ "anyhow", "axum", @@ -3224,7 +3224,7 @@ dependencies = [ [[package]] name = "mas-config" -version = "1.0.0-rc.0" +version = "1.0.0" dependencies = [ "anyhow", "camino", @@ -3256,7 +3256,7 @@ dependencies = [ [[package]] name = "mas-context" -version = "1.0.0-rc.0" +version = "1.0.0" dependencies = [ "console", "opentelemetry", @@ -3272,7 +3272,7 @@ dependencies = [ [[package]] name = "mas-data-model" -version = "1.0.0-rc.0" +version = "1.0.0" dependencies = [ "base64ct", "chrono", @@ -3293,7 +3293,7 @@ dependencies = [ [[package]] name = "mas-email" -version = "1.0.0-rc.0" +version = "1.0.0" dependencies = [ "async-trait", "lettre", @@ -3304,7 +3304,7 @@ dependencies = [ [[package]] name = "mas-handlers" -version = "1.0.0-rc.0" +version = "1.0.0" dependencies = [ "aide", "anyhow", @@ -3384,7 +3384,7 @@ dependencies = [ [[package]] name = "mas-http" -version = "1.0.0-rc.0" +version = "1.0.0" dependencies = [ "futures-util", "headers", @@ -3405,7 +3405,7 @@ dependencies = [ [[package]] name = "mas-i18n" -version = "1.0.0-rc.0" +version = "1.0.0" dependencies = [ "camino", "icu_calendar", @@ -3427,7 +3427,7 @@ dependencies = [ [[package]] name = "mas-i18n-scan" -version = "1.0.0-rc.0" +version = "1.0.0" dependencies = [ "camino", "clap", @@ -3441,7 +3441,7 @@ dependencies = [ [[package]] name = "mas-iana" -version = "1.0.0-rc.0" +version = "1.0.0" dependencies = [ "schemars 0.8.22", "serde", @@ -3449,7 +3449,7 @@ dependencies = [ [[package]] name = "mas-iana-codegen" -version = "1.0.0-rc.0" +version = "1.0.0" dependencies = [ "anyhow", "async-trait", @@ -3465,7 +3465,7 @@ dependencies = [ [[package]] name = "mas-jose" -version = "1.0.0-rc.0" +version = "1.0.0" dependencies = [ "base64ct", "chrono", @@ -3495,7 +3495,7 @@ dependencies = [ [[package]] name = "mas-keystore" -version = "1.0.0-rc.0" +version = "1.0.0" dependencies = [ "aead", "base64ct", @@ -3523,7 +3523,7 @@ dependencies = [ [[package]] name = "mas-listener" -version = "1.0.0-rc.0" +version = "1.0.0" dependencies = [ "anyhow", "bytes", @@ -3548,7 +3548,7 @@ dependencies = [ [[package]] name = "mas-matrix" -version = "1.0.0-rc.0" +version = "1.0.0" dependencies = [ "anyhow", "async-trait", @@ -3558,7 +3558,7 @@ dependencies = [ [[package]] name = "mas-matrix-synapse" -version = "1.0.0-rc.0" +version = "1.0.0" dependencies = [ "anyhow", "async-trait", @@ -3575,7 +3575,7 @@ dependencies = [ [[package]] name = "mas-oidc-client" -version = "1.0.0-rc.0" +version = "1.0.0" dependencies = [ "assert_matches", "async-trait", @@ -3611,7 +3611,7 @@ dependencies = [ [[package]] name = "mas-policy" -version = "1.0.0-rc.0" +version = "1.0.0" dependencies = [ "anyhow", "arc-swap", @@ -3628,7 +3628,7 @@ dependencies = [ [[package]] name = "mas-router" -version = "1.0.0-rc.0" +version = "1.0.0" dependencies = [ "axum", "serde", @@ -3639,7 +3639,7 @@ dependencies = [ [[package]] name = "mas-spa" -version = "1.0.0-rc.0" +version = "1.0.0" dependencies = [ "camino", "serde", @@ -3648,7 +3648,7 @@ dependencies = [ [[package]] name = "mas-storage" -version = "1.0.0-rc.0" +version = "1.0.0" dependencies = [ "async-trait", "chrono", @@ -3670,7 +3670,7 @@ dependencies = [ [[package]] name = "mas-storage-pg" -version = "1.0.0-rc.0" +version = "1.0.0" dependencies = [ "async-trait", "chrono", @@ -3697,7 +3697,7 @@ dependencies = [ [[package]] name = "mas-tasks" -version = "1.0.0-rc.0" +version = "1.0.0" dependencies = [ "anyhow", "async-trait", @@ -3729,7 +3729,7 @@ dependencies = [ [[package]] name = "mas-templates" -version = "1.0.0-rc.0" +version = "1.0.0" dependencies = [ "anyhow", "arc-swap", @@ -3759,7 +3759,7 @@ dependencies = [ [[package]] name = "mas-tower" -version = "1.0.0-rc.0" +version = "1.0.0" dependencies = [ "http", "opentelemetry", @@ -4029,7 +4029,7 @@ dependencies = [ [[package]] name = "oauth2-types" -version = "1.0.0-rc.0" +version = "1.0.0" dependencies = [ "assert_matches", "base64ct", @@ -6165,7 +6165,7 @@ dependencies = [ [[package]] name = "syn2mas" -version = "1.0.0-rc.0" +version = "1.0.0" dependencies = [ "anyhow", "arc-swap", diff --git a/Cargo.toml b/Cargo.toml index 904dea39a..62af1756a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,7 +9,7 @@ members = ["crates/*"] resolver = "2" # Updated in the CI with a `sed` command -package.version = "1.0.0-rc.0" +package.version = "1.0.0" package.license = "AGPL-3.0-only OR LicenseRef-Element-Commercial" package.authors = ["Element Backend Team"] package.edition = "2024" @@ -34,35 +34,35 @@ broken_intra_doc_links = "deny" [workspace.dependencies] # Workspace crates -mas-axum-utils = { path = "./crates/axum-utils/", version = "=1.0.0-rc.0" } -mas-cli = { path = "./crates/cli/", version = "=1.0.0-rc.0" } -mas-config = { path = "./crates/config/", version = "=1.0.0-rc.0" } -mas-context = { path = "./crates/context/", version = "=1.0.0-rc.0" } -mas-data-model = { path = "./crates/data-model/", version = "=1.0.0-rc.0" } -mas-email = { path = "./crates/email/", version = "=1.0.0-rc.0" } -mas-graphql = { path = "./crates/graphql/", version = "=1.0.0-rc.0" } -mas-handlers = { path = "./crates/handlers/", version = "=1.0.0-rc.0" } -mas-http = { path = "./crates/http/", version = "=1.0.0-rc.0" } -mas-i18n = { path = "./crates/i18n/", version = "=1.0.0-rc.0" } -mas-i18n-scan = { path = "./crates/i18n-scan/", version = "=1.0.0-rc.0" } -mas-iana = { path = "./crates/iana/", version = "=1.0.0-rc.0" } -mas-iana-codegen = { path = "./crates/iana-codegen/", version = "=1.0.0-rc.0" } -mas-jose = { path = "./crates/jose/", version = "=1.0.0-rc.0" } -mas-keystore = { path = "./crates/keystore/", version = "=1.0.0-rc.0" } -mas-listener = { path = "./crates/listener/", version = "=1.0.0-rc.0" } -mas-matrix = { path = "./crates/matrix/", version = "=1.0.0-rc.0" } -mas-matrix-synapse = { path = "./crates/matrix-synapse/", version = "=1.0.0-rc.0" } -mas-oidc-client = { path = "./crates/oidc-client/", version = "=1.0.0-rc.0" } -mas-policy = { path = "./crates/policy/", version = "=1.0.0-rc.0" } -mas-router = { path = "./crates/router/", version = "=1.0.0-rc.0" } -mas-spa = { path = "./crates/spa/", version = "=1.0.0-rc.0" } -mas-storage = { path = "./crates/storage/", version = "=1.0.0-rc.0" } -mas-storage-pg = { path = "./crates/storage-pg/", version = "=1.0.0-rc.0" } -mas-tasks = { path = "./crates/tasks/", version = "=1.0.0-rc.0" } -mas-templates = { path = "./crates/templates/", version = "=1.0.0-rc.0" } -mas-tower = { path = "./crates/tower/", version = "=1.0.0-rc.0" } -oauth2-types = { path = "./crates/oauth2-types/", version = "=1.0.0-rc.0" } -syn2mas = { path = "./crates/syn2mas", version = "=1.0.0-rc.0" } +mas-axum-utils = { path = "./crates/axum-utils/", version = "=1.0.0" } +mas-cli = { path = "./crates/cli/", version = "=1.0.0" } +mas-config = { path = "./crates/config/", version = "=1.0.0" } +mas-context = { path = "./crates/context/", version = "=1.0.0" } +mas-data-model = { path = "./crates/data-model/", version = "=1.0.0" } +mas-email = { path = "./crates/email/", version = "=1.0.0" } +mas-graphql = { path = "./crates/graphql/", version = "=1.0.0" } +mas-handlers = { path = "./crates/handlers/", version = "=1.0.0" } +mas-http = { path = "./crates/http/", version = "=1.0.0" } +mas-i18n = { path = "./crates/i18n/", version = "=1.0.0" } +mas-i18n-scan = { path = "./crates/i18n-scan/", version = "=1.0.0" } +mas-iana = { path = "./crates/iana/", version = "=1.0.0" } +mas-iana-codegen = { path = "./crates/iana-codegen/", version = "=1.0.0" } +mas-jose = { path = "./crates/jose/", version = "=1.0.0" } +mas-keystore = { path = "./crates/keystore/", version = "=1.0.0" } +mas-listener = { path = "./crates/listener/", version = "=1.0.0" } +mas-matrix = { path = "./crates/matrix/", version = "=1.0.0" } +mas-matrix-synapse = { path = "./crates/matrix-synapse/", version = "=1.0.0" } +mas-oidc-client = { path = "./crates/oidc-client/", version = "=1.0.0" } +mas-policy = { path = "./crates/policy/", version = "=1.0.0" } +mas-router = { path = "./crates/router/", version = "=1.0.0" } +mas-spa = { path = "./crates/spa/", version = "=1.0.0" } +mas-storage = { path = "./crates/storage/", version = "=1.0.0" } +mas-storage-pg = { path = "./crates/storage-pg/", version = "=1.0.0" } +mas-tasks = { path = "./crates/tasks/", version = "=1.0.0" } +mas-templates = { path = "./crates/templates/", version = "=1.0.0" } +mas-tower = { path = "./crates/tower/", version = "=1.0.0" } +oauth2-types = { path = "./crates/oauth2-types/", version = "=1.0.0" } +syn2mas = { path = "./crates/syn2mas", version = "=1.0.0" } # OpenAPI schema generation and validation [workspace.dependencies.aide] From 199926b1b781cf9d7be01cc97db61d62d654570f Mon Sep 17 00:00:00 2001 From: Quentin Gliech Date: Tue, 12 Aug 2025 16:58:00 +0200 Subject: [PATCH 5/8] Include simple script to generate an access token --- docs/SUMMARY.md | 1 + docs/topics/access-token.md | 31 ++++++++++ misc/device-code-grant.sh | 110 ++++++++++++++++++++++++++++++++++++ 3 files changed, 142 insertions(+) create mode 100644 docs/topics/access-token.md create mode 100755 misc/device-code-grant.sh diff --git a/docs/SUMMARY.md b/docs/SUMMARY.md index 1857fa42b..211047872 100644 --- a/docs/SUMMARY.md +++ b/docs/SUMMARY.md @@ -21,6 +21,7 @@ - [Policy engine](./topics/policy.md) - [Authorization and sessions](./topics/authorization.md) - [Use the Admin API](./topics/admin-api.md) +- [Get an access token](./topics/access-token.md) # Reference diff --git a/docs/topics/access-token.md b/docs/topics/access-token.md new file mode 100644 index 000000000..d6ae65235 --- /dev/null +++ b/docs/topics/access-token.md @@ -0,0 +1,31 @@ +# Get an access token + +The [Matrix Authentication Service repository contains a simple shell script](https://github.com/element-hq/matrix-authentication-service/blob/main/misc/device-code-grant.sh) to get interatively get an access token with arbitrary scopes. +It requires `sh`, `jq` and `curl` to be installed. +This can be run from anywhere, not necessarily from the host where MAS is running. + +```sh +sh ./misc/device-code-grant.sh [synapse-url] ... +``` + +This will prompt you to open a URL in your browser, finish the authentication flow, and print the access token. + +This can be used to get access to the MAS admin API: + +```sh +sh ./misc/device-code-grant.sh https://synapse.example.com/ urn:mas:admin +``` + +Or to the Synapse admin API: + +```sh +sh ./misc/device-code-grant.sh https://synapse.example.com/ urn:matrix:org.matrix.msc2967.client:api:* urn:synapse:admin:* +``` + +Or even both at the same time: + +```sh +sh ./misc/device-code-grant.sh https://synapse.example.com/ urn:matrix:org.matrix.msc2967.client:api:* urn:mas:admin urn:synapse:admin:* +``` + +Note that the token will be valid for a short time (5 minutes by default) and needs to be revoked manually from the MAS user interface. diff --git a/misc/device-code-grant.sh b/misc/device-code-grant.sh new file mode 100755 index 000000000..c77101cb5 --- /dev/null +++ b/misc/device-code-grant.sh @@ -0,0 +1,110 @@ +#!/bin/sh + +set -eu + +usage() { + echo "$0 [synapse-url] ..." >&2 + exit 1 +} + +req() { + METHOD="$1" + shift + URL="$1" + shift + printf "> %4s %s\n" "$METHOD" "$URL" >&2 + curl -sL --fail-with-body -o- -H 'Accept: application/json' -X "$METHOD" "$@" "$URL" +} + +if [ "$#" -eq "0" ]; then + usage +fi + +CS_API="${1%/}" +shift + +if [ -z "$*" ]; then + SCOPE="urn:matrix:org.matrix.msc2967.client:api:*" +else + SCOPE="$*" +fi + + +echo "Discovering the homeserver endpoints" +METADATA="$(req GET "${CS_API}/_matrix/client/unstable/org.matrix.msc2965/auth_metadata")" +DEVICE_AUTHORIZATION_ENDPOINT="$(echo "$METADATA" | jq -r '.device_authorization_endpoint')" +TOKEN_ENDPOINT="$(echo "$METADATA" | jq -r '.token_endpoint')" +REGISTRATION_ENDPOINT="$(echo "$METADATA" | jq -r '.registration_endpoint')" + +echo "Registering the client" +# Note that the client_uri is only used as an identifier, MAS will not try to contact this URI +RESP="$( + req POST "${REGISTRATION_ENDPOINT}" \ + -H 'Content-Type: application/json' \ + -d @- </dev/null; then + echo "$DEVICE_GRANT" | jq -r ".verification_uri_complete" | qrencode -t ANSI256UTF8 + echo +fi + +echo "Alternatively, go to $(echo "$DEVICE_GRANT" | jq -r ".verification_uri") and enter the code $(echo "$DEVICE_GRANT" | jq -r ".user_code")" +echo +echo ----------------------- +echo + +DEVICE_CODE="$(echo "$DEVICE_GRANT" | jq -r ".device_code")" +INTERVAL="$(echo "$DEVICE_GRANT" | jq -r ".interval")" + +while true; do + DEVICE_RESP="$( + req POST "${TOKEN_ENDPOINT}" \ + --data-urlencode "grant_type=urn:ietf:params:oauth:grant-type:device_code" \ + --data-urlencode "device_code=${DEVICE_CODE}" \ + --data-urlencode "client_id=${CLIENT_ID}" || true + )" + if [ "$(echo "$DEVICE_RESP" | jq -r ".error")" = "authorization_pending" ]; then + echo "Waiting for authorization" + sleep "${INTERVAL}" + else + break + fi +done + +echo "$DEVICE_RESP" | jq . + +exit 0 From 3058a35ad575f3a1ffee18bc459b62464e94011f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 13 Aug 2025 12:36:10 +0000 Subject: [PATCH 6/8] build(deps): bump slab from 0.4.10 to 0.4.11 in the cargo group Bumps the cargo group with 1 update: [slab](https://github.com/tokio-rs/slab). Updates `slab` from 0.4.10 to 0.4.11 - [Release notes](https://github.com/tokio-rs/slab/releases) - [Changelog](https://github.com/tokio-rs/slab/blob/master/CHANGELOG.md) - [Commits](https://github.com/tokio-rs/slab/compare/v0.4.10...v0.4.11) --- updated-dependencies: - dependency-name: slab dependency-version: 0.4.11 dependency-type: indirect dependency-group: cargo ... Signed-off-by: dependabot[bot] --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index fa159c704..240df0c1e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5816,9 +5816,9 @@ checksum = "56199f7ddabf13fe5074ce809e7d3f42b42ae711800501b5b16ea82ad029c39d" [[package]] name = "slab" -version = "0.4.10" +version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04dc19736151f35336d325007ac991178d504a119863a2fcb3758cdb5e52c50d" +checksum = "7a2ae44ef20feb57a68b23d846850f861394c2e02dc425a50098ae8c90267589" [[package]] name = "smallvec" From 20dbf6ff598cb2c1fa081bf4c114ead9bf1eff41 Mon Sep 17 00:00:00 2001 From: Quentin Gliech Date: Thu, 14 Aug 2025 09:48:06 +0200 Subject: [PATCH 7/8] Enable the `urlencode` feature of minijinja --- Cargo.lock | 1 + Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index 7355fd7a1..8baf2d336 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3840,6 +3840,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4e60ac08614cc09062820e51d5d94c2fce16b94ea4e5003bb81b99a95f84e876" dependencies = [ "memo-map", + "percent-encoding", "self_cell", "serde", "serde_json", diff --git a/Cargo.toml b/Cargo.toml index ab37a4692..28040ac0e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -379,7 +379,7 @@ version = "0.3.17" # Templates [workspace.dependencies.minijinja] version = "2.11.0" -features = ["builtins", "loader", "json", "speedups", "unstable_machinery"] +features = ["urlencode", "loader", "json", "speedups", "unstable_machinery"] # Additional filters for minijinja [workspace.dependencies.minijinja-contrib] From ab968bdba86bffd6ff237a3dbb5081ade9911579 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 15 Aug 2025 13:19:00 +0000 Subject: [PATCH 8/8] build(deps): bump sea-query from 0.32.6 to 0.32.7 in the sea-query group Bumps the sea-query group with 1 update: [sea-query](https://github.com/SeaQL/sea-query). Updates `sea-query` from 0.32.6 to 0.32.7 - [Release notes](https://github.com/SeaQL/sea-query/releases) - [Changelog](https://github.com/SeaQL/sea-query/blob/master/CHANGELOG.md) - [Commits](https://github.com/SeaQL/sea-query/compare/0.32.6...0.32.7) --- updated-dependencies: - dependency-name: sea-query dependency-version: 0.32.7 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: sea-query ... Signed-off-by: dependabot[bot] --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5d5ea66bb..02ac48900 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5400,9 +5400,9 @@ dependencies = [ [[package]] name = "sea-query" -version = "0.32.6" +version = "0.32.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64c91783d1514b99754fc6a4079081dcc2c587dadbff65c48c7f62297443536a" +checksum = "8a5d1c518eaf5eda38e5773f902b26ab6d5e9e9e2bb2349ca6c64cf96f80448c" dependencies = [ "chrono", "inherent", diff --git a/Cargo.toml b/Cargo.toml index 7b6aa9bbb..cf7db8b93 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -557,7 +557,7 @@ features = ["std"] # Query builder [workspace.dependencies.sea-query] -version = "0.32.6" +version = "0.32.7" features = ["derive", "attr", "with-uuid", "with-chrono", "postgres-array"] # Query builder