identityprovider.go 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. // Copyright 2019 Yunion
  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 identity
  15. import "yunion.io/x/onecloud/pkg/apis"
  16. type IdentityProviderDetails struct {
  17. apis.EnabledStatusStandaloneResourceDetails
  18. apis.DomainizedResourceInfo
  19. // 认证源账号信息同步周期
  20. SyncIntervalSeconds int `json:"sync_interval_seconds"`
  21. // 认证源的目标域名称
  22. TargetDomain string `json:"target_domain"`
  23. // 该认证源关联的所有域的角色数量
  24. RoleCount int `json:"role_count,allowempty"`
  25. // 该认证源关联的所有域的用户数量
  26. UserCount int `json:"user_count,allowempty"`
  27. // 该认证源关联的所有域的权限策略数量
  28. PolicyCount int `json:"policy_count,allowempty"`
  29. // 该认证源关联的所有域的数量
  30. DomainCount int `json:"domain_count,allowempty"`
  31. // 该认证源关联的所有域的项目数量
  32. ProjectCount int `json:"project_count,allowempty"`
  33. // 该认证源关联的所有域的组数量
  34. GroupCount int `json:"group_count,allowempty"`
  35. // 该认证源的URL, 可以区分ladp是否使用TLS
  36. // example: ldaps://192.168.100.10, ldap://192.168.100.10
  37. URL string `json:"url,allowempty"`
  38. SIdentityProvider
  39. }
  40. type IdpResourceInfo struct {
  41. // 认证源ID
  42. IdpId string `json:"idp_id"`
  43. // 认证源名称
  44. Idp string `json:"idp"`
  45. // 该资源在认证源的原始ID
  46. IdpEntityId string `json:"idp_entity_id"`
  47. // 认证源类型, 例如sql, cas, ldap等
  48. IdpDriver string `json:"idp_driver"`
  49. // 是否是SSO登录方式
  50. IsSso bool `json:"is_sso"`
  51. // 认证源模板
  52. Template string `json:"template"`
  53. }
  54. type IdentityProviderCreateInput struct {
  55. apis.EnabledStatusStandaloneResourceCreateInput
  56. // 后端驱动名称
  57. Driver string `json:"driver" ignore:"true"`
  58. // 模板名称
  59. Template string `json:"template" ignore:"true"`
  60. // 归属域
  61. OwnerDomainId string `json:"owner_domain_id"`
  62. // 默认导入用户和组的域
  63. TargetDomainId string `json:"target_domain_id"`
  64. // swagger:ignore
  65. // Deprecated
  66. TargetDomain string `json:"target_domain" yunion-deprecated-by:"target_domain_id"`
  67. // 新建域的时候是否自动新建第一个项目
  68. AutoCreateProject *bool `json:"auto_create_project"`
  69. // 当用户不存在时,是否自动新建用户
  70. AutoCreateUser *bool `json:"auto_create_user"`
  71. // 自动同步间隔,单位:秒
  72. SyncIntervalSeconds *int `json:"sync_interval_seconds"`
  73. // 配置信息
  74. Config TConfigs `json:"config" ignore:"true"`
  75. // 图标URL
  76. IconUri string `json:"icon_uri"`
  77. }
  78. type GetIdpSamlMetadataInput struct {
  79. // 缩进展示SAML sp metadata
  80. Pretty *bool `json:"pretty"`
  81. // AssertionConsumer callback URL
  82. RedirectUri string `json:"redirect_uri"`
  83. }
  84. type GetIdpSamlMetadataOutput struct {
  85. // SAML 2.0 SP metadata
  86. Metadata string `json:"metadata"`
  87. }
  88. type GetIdpSsoRedirectUriInput struct {
  89. // SSO回调地址
  90. RedirectUri string `json:"redirect_uri"`
  91. // SSO状态信息
  92. State string `json:"state"`
  93. }
  94. type GetIdpSsoRedirectUriOutput struct {
  95. // SSO跳转URI
  96. Uri string `json:"uri"`
  97. // Driver
  98. Driver string `json:"driver"`
  99. }
  100. type PerformDefaultSsoInput struct {
  101. Enable *bool `json:"enable" help:"enable default sso" negative:"disable"`
  102. }
  103. type GetIdpSsoCallbackUriInput struct {
  104. // SSO回调地址
  105. RedirectUri string `json:"redirect_uri"`
  106. }
  107. type GetIdpSsoCallbackUriOutput struct {
  108. // SSO回调地址
  109. RedirectUri string `json:"redirect_uri"`
  110. // Driver
  111. Driver string `json:"driver"`
  112. }