Add JWT secret parameter

This commit is contained in:
niten 2024-02-13 15:01:27 -08:00
parent 1d30ae79ec
commit 57b3be2dcb
1 changed files with 10 additions and 35 deletions

View File

@ -83,6 +83,12 @@ in {
type = str; type = str;
description = "OpenID issuer URL."; description = "OpenID issuer URL.";
}; };
jwt-secret = mkOption {
type = nullOr str;
description = "JWT secret, for decoding requests";
default = null;
};
}; };
}; };
@ -120,42 +126,10 @@ in {
signing_key_path = "${cfg.state-directory}/secrets/signing.key"; signing_key_path = "${cfg.state-directory}/secrets/signing.key";
# Only to trigger the inclusion of oidc deps, actual config is elsewhere # Only to trigger the inclusion of oidc deps, actual config is elsewhere
oidc_providers = [ ]; oidc_providers = [ ];
jwt_config = { jwt_config = mkIf (cfg.openid.jwt-secret != null) {
enabled = true; enabled = true;
algorithm = "HS256"; algorithm = "HS256";
secret = '' secret = cfg.openid.jwt-secret;
-----BEGIN CERTIFICATE-----
MIIFUzCCAzugAwIBAgIRAMqfkfHyl07usDfXTfgi/OIwDQYJKoZIhvcNAQELBQAw
HTEbMBkGA1UEAwwSYXV0aGVudGlrIDIwMjMuOC4xMB4XDTIzMDgyOTE3MTU1NloX
DTI0MDgyOTE3MTU1NlowVjEqMCgGA1UEAwwhYXV0aGVudGlrIFNlbGYtc2lnbmVk
IENlcnRpZmljYXRlMRIwEAYDVQQKDAlhdXRoZW50aWsxFDASBgNVBAsMC1NlbGYt
c2lnbmVkMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA8DCiYkHq5RQL
N6i9bLXuschbuPxWZeckJK1cFAmLbrEbOQ/yjURpf0vqdaetvg/S5RsN6I9qS9Yl
h/PmeNZTBN5nsn7GGQZQL4xy0cm2c0Z57AuFkDLgrKiovI5Y4cgIMEfmdqKZ27ey
QqTLDAs6w6m7uNCA0cUwldKyuGR0xMRWShrYM3vurdsosACsWl+bsWZgOASaW2GO
sMPMnTMzATGwy0KLU9ffl3vGSL0FO0zYP4zTXQbi2jsdd4f1pSo1lNWGH1d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em3KLGkdYj0qXc8Dr+WNJ7fvbICKkpTIqLC0Trq4u6X/ZbTL
aCTvpLWOhHms5IvQUkndF1wV3HSM9aJylzPk6zkZRhR7jWtNojLD0Pf6t/H2V0VD
x/n6DjSsmSyVGwo0zeAXhIZl/XzZZpp//Lbn91aMqnVY0zoCjdSEhEpBGx/djdLI
jCunluN2DypxO3PVEWqIUvNhlv0XW9o=
-----END CERTIFICATE-----
'';
}; };
listeners = [{ listeners = [{
port = cfg.port; port = cfg.port;
@ -173,7 +147,8 @@ in {
args.database = "${cfg.state-directory}/database/data.db"; args.database = "${cfg.state-directory}/database/data.db";
}; };
}; };
extras = [ "jwt" "url-preview" ]; extras = [ "url-preview" ]
++ (optional (cfg.openid.jwt-secret != null) "jwt");
extraConfigFiles = [ hostSecrets.matrixOpenIdConfig.target-file ]; extraConfigFiles = [ hostSecrets.matrixOpenIdConfig.target-file ];
configureRedisLocally = true; configureRedisLocally = true;
}; };