MM-24467- Use new ServiceProviderIdentifier in AuthnRequest (#14725)
* add ServiceProviderIdentifier to config * Update config, add unit test * fix unit test, update i18n * add english translation for error Co-authored-by: mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
124014ad9c
Коммит
938176be3e
@@ -2135,6 +2135,7 @@ type SamlSettings struct {
|
||||
IdpUrl *string
|
||||
IdpDescriptorUrl *string
|
||||
IdpMetadataUrl *string
|
||||
ServiceProviderIdentifier *string
|
||||
AssertionConsumerServiceURL *string
|
||||
|
||||
SignatureAlgorithm *string
|
||||
@@ -2212,6 +2213,14 @@ func (s *SamlSettings) SetDefaults() {
|
||||
s.IdpDescriptorUrl = NewString("")
|
||||
}
|
||||
|
||||
if s.ServiceProviderIdentifier == nil {
|
||||
if s.IdpDescriptorUrl != nil {
|
||||
s.ServiceProviderIdentifier = NewString(*s.IdpDescriptorUrl)
|
||||
} else {
|
||||
s.ServiceProviderIdentifier = NewString("")
|
||||
}
|
||||
}
|
||||
|
||||
if s.IdpMetadataUrl == nil {
|
||||
s.IdpMetadataUrl = NewString("")
|
||||
}
|
||||
@@ -3126,6 +3135,10 @@ func (s *SamlSettings) isValid() *AppError {
|
||||
return NewAppError("Config.IsValid", "model.config.is_valid.saml_username_attribute.app_error", nil, "", http.StatusBadRequest)
|
||||
}
|
||||
|
||||
if len(*s.ServiceProviderIdentifier) == 0 {
|
||||
return NewAppError("Config.IsValid", "model.config.is_valid.saml_spidentifier_attribute.app_error", nil, "", http.StatusBadRequest)
|
||||
}
|
||||
|
||||
if *s.Verify {
|
||||
if len(*s.AssertionConsumerServiceURL) == 0 || !IsValidHttpUrl(*s.AssertionConsumerServiceURL) {
|
||||
return NewAppError("Config.IsValid", "model.config.is_valid.saml_assertion_consumer_service_url.app_error", nil, "", http.StatusBadRequest)
|
||||
|
||||
Ссылка в новой задаче
Block a user