You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1234567891011121314151617181920212223242526272829
  1. // Copyright 2023 The Gitea Authors. All rights reserved.
  2. // SPDX-License-Identifier: MIT
  3. package saml
  4. import (
  5. "context"
  6. "sync"
  7. "code.gitea.io/gitea/models/auth"
  8. "code.gitea.io/gitea/modules/log"
  9. )
  10. var samlRWMutex = sync.RWMutex{}
  11. func Init(ctx context.Context) error {
  12. loginSources, _ := auth.GetActiveAuthProviderSources(ctx, auth.SAML)
  13. for _, source := range loginSources {
  14. samlSource, ok := source.Cfg.(*Source)
  15. if !ok {
  16. continue
  17. }
  18. err := samlSource.RegisterSource()
  19. if err != nil {
  20. log.Error("Unable to register source: %s due to Error: %v.", source.Name, err)
  21. }
  22. }
  23. return nil
  24. }