Skip to content

Commit e59adbc

Browse files
mrajashreeAlena Prokharchyk
authored and
Alena Prokharchyk
committed
Send translation key as error message
1 parent f0859fc commit e59adbc

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Diff for: pkg/auth/providers/saml/saml_client.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ var root *mux.Router
3333
var appliedVersion string
3434
var initMu sync.Mutex
3535

36+
const UITranslationKeyForErrorMessage = "invalidSamlAttrs"
37+
3638
func InitializeSamlServiceProvider(configToSet *v3.SamlConfig, name string) error {
3739

3840
initMu.Lock()
@@ -276,7 +278,8 @@ func (s *Provider) HandleSamlAssertion(w http.ResponseWriter, r *http.Request, a
276278
userPrincipal, groupPrincipals, err = s.getSamlPrincipals(config, samlData)
277279
if err != nil {
278280
log.Error(err)
279-
http.Redirect(w, r, redirectURL+"errorCode=422&errorMsg=Invalid saml attributes", http.StatusFound)
281+
// UI uses this translation key to get the error message
282+
http.Redirect(w, r, redirectURL+"errorCode=422&errorMsg="+UITranslationKeyForErrorMessage, http.StatusFound)
280283
return
281284
}
282285
allowedPrincipals := config.AllowedPrincipalIDs

0 commit comments

Comments
 (0)