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.

source.go 1.0KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. // Copyright 2021 The Gitea Authors. All rights reserved.
  2. // Use of this source code is governed by a MIT-style
  3. // license that can be found in the LICENSE file.
  4. package sspi
  5. import (
  6. "code.gitea.io/gitea/models/auth"
  7. "code.gitea.io/gitea/modules/json"
  8. )
  9. // _________ ___________________.___
  10. // / _____// _____/\______ \ |
  11. // \_____ \ \_____ \ | ___/ |
  12. // / \/ \ | | | |
  13. // /_______ /_______ / |____| |___|
  14. // \/ \/
  15. // Source holds configuration for SSPI single sign-on.
  16. type Source struct {
  17. AutoCreateUsers bool
  18. AutoActivateUsers bool
  19. StripDomainNames bool
  20. SeparatorReplacement string
  21. DefaultLanguage string
  22. }
  23. // FromDB fills up an SSPIConfig from serialized format.
  24. func (cfg *Source) FromDB(bs []byte) error {
  25. return json.UnmarshalHandleDoubleEncode(bs, &cfg)
  26. }
  27. // ToDB exports an SSPIConfig to a serialized format.
  28. func (cfg *Source) ToDB() ([]byte, error) {
  29. return json.Marshal(cfg)
  30. }
  31. func init() {
  32. auth.RegisterTypeConfig(auth.SSPI, &Source{})
  33. }