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

provider.go 3.7 kB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. // Copyright 2023 The casbin Authors. All Rights Reserved.
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. package casdoor
  15. type Provider struct {
  16. Owner string `xorm:"varchar(100) notnull pk" json:"owner"`
  17. Name string `xorm:"varchar(100) notnull pk unique" json:"name"`
  18. CreatedTime string `xorm:"varchar(100)" json:"createdTime"`
  19. DisplayName string `xorm:"varchar(100)" json:"displayName"`
  20. Category string `xorm:"varchar(100)" json:"category"`
  21. Type string `xorm:"varchar(100)" json:"type"`
  22. SubType string `xorm:"varchar(100)" json:"subType"`
  23. Method string `xorm:"varchar(100)" json:"method"`
  24. ClientId string `xorm:"varchar(100)" json:"clientId"`
  25. ClientSecret string `xorm:"varchar(2000)" json:"clientSecret"`
  26. ClientId2 string `xorm:"varchar(100)" json:"clientId2"`
  27. ClientSecret2 string `xorm:"varchar(100)" json:"clientSecret2"`
  28. Cert string `xorm:"varchar(100)" json:"cert"`
  29. CustomAuthUrl string `xorm:"varchar(200)" json:"customAuthUrl"`
  30. CustomTokenUrl string `xorm:"varchar(200)" json:"customTokenUrl"`
  31. CustomUserInfoUrl string `xorm:"varchar(200)" json:"customUserInfoUrl"`
  32. CustomLogo string `xorm:"varchar(200)" json:"customLogo"`
  33. Scopes string `xorm:"varchar(100)" json:"scopes"`
  34. UserMapping map[string]string `xorm:"varchar(500)" json:"userMapping"`
  35. Host string `xorm:"varchar(100)" json:"host"`
  36. Port int `json:"port"`
  37. DisableSsl bool `json:"disableSsl"` // If the provider type is WeChat, DisableSsl means EnableQRCode
  38. Title string `xorm:"varchar(100)" json:"title"`
  39. Content string `xorm:"varchar(1000)" json:"content"` // If provider type is WeChat, Content means QRCode string by Base64 encoding
  40. Receiver string `xorm:"varchar(100)" json:"receiver"`
  41. RegionId string `xorm:"varchar(100)" json:"regionId"`
  42. SignName string `xorm:"varchar(100)" json:"signName"`
  43. TemplateCode string `xorm:"varchar(100)" json:"templateCode"`
  44. AppId string `xorm:"varchar(100)" json:"appId"`
  45. Endpoint string `xorm:"varchar(1000)" json:"endpoint"`
  46. IntranetEndpoint string `xorm:"varchar(100)" json:"intranetEndpoint"`
  47. Domain string `xorm:"varchar(100)" json:"domain"`
  48. Bucket string `xorm:"varchar(100)" json:"bucket"`
  49. PathPrefix string `xorm:"varchar(100)" json:"pathPrefix"`
  50. Metadata string `xorm:"mediumtext" json:"metadata"`
  51. IdP string `xorm:"mediumtext" json:"idP"`
  52. IssuerUrl string `xorm:"varchar(100)" json:"issuerUrl"`
  53. EnableSignAuthnRequest bool `json:"enableSignAuthnRequest"`
  54. ProviderUrl string `xorm:"varchar(200)" json:"providerUrl"`
  55. }
  56. func GetStorageProviders(owner string) ([]*Provider, error) {
  57. providers := []*Provider{}
  58. err := adapter.Engine.Desc("created_time").Find(&providers, &Provider{Owner: owner, Category: "Storage"})
  59. if err != nil {
  60. return providers, err
  61. }
  62. return providers, nil
  63. }