mas: remove enabled field from msc3861 config + remove some incorrect comments

This commit is contained in:
Roman Isaev 2025-01-10 02:12:30 +00:00
parent 4cde3bafb1
commit 5ea033d1e4
No known key found for this signature in database
GPG key ID: 7BE2B6A6C89AEC7F
2 changed files with 4 additions and 10 deletions

View file

@ -285,13 +285,11 @@ media_api:
# Configuration for enabling experimental MSCs on this homeserver. # Configuration for enabling experimental MSCs on this homeserver.
mscs: mscs:
mscs: mscs:
# - msc3861 # (Next-gen auth, see https://github.com/matrix-org/matrix-doc/pull/3861. MUST always go first in the list) # - msc3861 # (Next-gen auth, see https://github.com/matrix-org/matrix-doc/pull/3861)
# - msc2836 # (Threading, see https://github.com/matrix-org/matrix-doc/pull/2836) # - msc2836 # (Threading, see https://github.com/matrix-org/matrix-doc/pull/2836)
# This block has no effect if the feature is not activated in the list above # This block has no effect if the feature is not activated in the list above
# msc3861: # msc3861:
# enabled: true
# # OIDC issuer advertised by the service. # # OIDC issuer advertised by the service.
# # See https://element-hq.github.io/matrix-authentication-service/reference/configuration.html#http # # See https://element-hq.github.io/matrix-authentication-service/reference/configuration.html#http
# issuer: "https://mas.example.com/" # issuer: "https://mas.example.com/"

View file

@ -6,7 +6,7 @@ type MSCs struct {
Matrix *Global `yaml:"-"` Matrix *Global `yaml:"-"`
// The MSCs to enable. Supported MSCs include: // The MSCs to enable. Supported MSCs include:
// 'msc3861': Delegate auth to an OIDC provider. This line MUST always go first if the msc is used https://github.com/matrix-org/matrix-spec-proposals/pull/3861 // 'msc3861': Delegate auth to an OIDC provider - https://github.com/matrix-org/matrix-spec-proposals/pull/3861
// 'msc2444': Peeking over federation - https://github.com/matrix-org/matrix-doc/pull/2444 // 'msc2444': Peeking over federation - https://github.com/matrix-org/matrix-doc/pull/2444
// 'msc2753': Peeking via /sync - https://github.com/matrix-org/matrix-doc/pull/2753 // 'msc2753': Peeking via /sync - https://github.com/matrix-org/matrix-doc/pull/2753
// 'msc2836': Threading - https://github.com/matrix-org/matrix-doc/pull/2836 // 'msc2836': Threading - https://github.com/matrix-org/matrix-doc/pull/2836
@ -40,17 +40,16 @@ func (c *MSCs) Verify(configErrs *ConfigErrors) {
if c.Matrix.DatabaseOptions.ConnectionString == "" { if c.Matrix.DatabaseOptions.ConnectionString == "" {
checkNotEmpty(configErrs, "mscs.database.connection_string", string(c.Database.ConnectionString)) checkNotEmpty(configErrs, "mscs.database.connection_string", string(c.Database.ConnectionString))
} }
if m := c.MSC3861; m != nil { if m := c.MSC3861; m != nil && c.MSC3861Enabled() {
m.Verify(configErrs) m.Verify(configErrs)
} }
} }
func (c *MSCs) MSC3861Enabled() bool { func (c *MSCs) MSC3861Enabled() bool {
return slices.Contains(c.MSCs, "msc3861") && c.MSC3861 != nil && c.MSC3861.Enabled return slices.Contains(c.MSCs, "msc3861") && c.MSC3861 != nil
} }
type MSC3861 struct { type MSC3861 struct {
Enabled bool `yaml:"enabled"`
Issuer string `yaml:"issuer"` Issuer string `yaml:"issuer"`
ClientID string `yaml:"client_id"` ClientID string `yaml:"client_id"`
ClientSecret string `yaml:"client_secret"` ClientSecret string `yaml:"client_secret"`
@ -59,9 +58,6 @@ type MSC3861 struct {
} }
func (m *MSC3861) Verify(configErrs *ConfigErrors) { func (m *MSC3861) Verify(configErrs *ConfigErrors) {
if !m.Enabled {
return
}
checkNotEmpty(configErrs, "mscs.msc3861.issuer", string(m.Issuer)) checkNotEmpty(configErrs, "mscs.msc3861.issuer", string(m.Issuer))
checkNotEmpty(configErrs, "mscs.msc3861.client_id", string(m.ClientID)) checkNotEmpty(configErrs, "mscs.msc3861.client_id", string(m.ClientID))
checkNotEmpty(configErrs, "mscs.msc3861.client_secret", string(m.ClientSecret)) checkNotEmpty(configErrs, "mscs.msc3861.client_secret", string(m.ClientSecret))