GET /api/auth_source_ldaps
列出所有 LDAP 认证源

GET /api/locations/:location_id/auth_source_ldaps
按位置列出 LDAP 身份验证来源

GET /api/organizations/:organization_id/auth_source_ldaps
按组织列出 LDAP 身份验证来源

示例

GET /api/auth_source_ldaps
200
{
  "total": 1,
  "subtotal": 1,
  "page": 1,
  "per_page": 20,
  "search": null,
  "sort": {
    "by": null,
    "order": null
  },
  "results": [
    {
      "host": "ldap",
      "port": 123,
      "account": null,
      "base_dn": "dn=x,dn=y",
      "ldap_filter": null,
      "attr_login": "uid",
      "attr_firstname": "givenName",
      "attr_lastname": "sn",
      "attr_mail": "mail",
      "attr_photo": null,
      "onthefly_register": true,
      "usergroup_sync": true,
      "tls": true,
      "server_type": "posix",
      "groups_base": null,
      "use_netgroups": false,
      "created_at": "2019-11-07 08:51:03 UTC",
      "updated_at": "2019-11-07 08:51:03 UTC",
      "id": 980190962,
      "type": "AuthSourceLdap",
      "name": "ldap-server",
      "locations": [
        {
          "id": 255093256,
          "name": "Location 1",
          "title": "Location 1",
          "description": null
        }
      ],
      "organizations": [
        {
          "id": 447626438,
          "name": "Organization 1",
          "title": "Organization 1",
          "description": null
        }
      ]
    }
  ]
}

参数

参数名字 描述
location_id
选填

根据位置界定的范围

Validations:

  • Must be a Integer

organization_id
选填

根据机构界定的范围

Validations:

  • Must be a Integer

search
选填

过滤结果

Validations:

  • Must be a String

order
选填

排序项和顺序,例如 ‘id DESC’

Validations:

  • Must be a String

page
选填

页号,从 1 开始

Validations:

  • Must be a number.

per_page
选填

每页中显示的返回结果数

Validations:

  • Must be a number.

搜索字段

字段名 类型 可能的值
location string
location_id integer
name string
organization string
organization_id integer

GET /api/auth_source_ldaps/:id
显示 LDAP 认证源

示例

GET /api/auth_source_ldaps/980190962-ldap-server
200
{
  "host": "ldap",
  "port": 123,
  "account": null,
  "base_dn": "dn=x,dn=y",
  "ldap_filter": null,
  "attr_login": "uid",
  "attr_firstname": "givenName",
  "attr_lastname": "sn",
  "attr_mail": "mail",
  "attr_photo": null,
  "onthefly_register": true,
  "usergroup_sync": true,
  "tls": true,
  "server_type": "posix",
  "groups_base": null,
  "use_netgroups": false,
  "created_at": "2019-11-07 08:51:03 UTC",
  "updated_at": "2019-11-07 08:51:03 UTC",
  "id": 980190962,
  "type": "AuthSourceLdap",
  "name": "ldap-server",
  "external_usergroups": [],
  "locations": [
    {
      "id": 255093256,
      "name": "Location 1",
      "title": "Location 1",
      "description": null
    }
  ],
  "organizations": [
    {
      "id": 447626438,
      "name": "Organization 1",
      "title": "Organization 1",
      "description": null
    }
  ]
}

参数

参数名字 描述
location_id
选填

Set the current location context for the request

Validations:

  • Must be a Integer

organization_id
选填

Set the current organization context for the request

Validations:

  • Must be a Integer

id
必填

Validations:

  • Must be an identifier, string from 1 to 128 characters containing only alphanumeric characters, space, underscore(_), hypen(-) with no leading or trailing space.


POST /api/auth_source_ldaps
创建 LDAP 认证源

示例

POST /api/auth_source_ldaps
{
  "auth_source_ldap": {
    "name": "ldap2",
    "host": "ldap2",
    "server_type": "posix"
  }
}
201
{
  "host": "ldap2",
  "port": 389,
  "account": null,
  "base_dn": null,
  "ldap_filter": null,
  "attr_login": null,
  "attr_firstname": null,
  "attr_lastname": null,
  "attr_mail": null,
  "attr_photo": null,
  "onthefly_register": false,
  "usergroup_sync": true,
  "tls": false,
  "server_type": "posix",
  "groups_base": null,
  "use_netgroups": false,
  "created_at": "2019-11-07 08:51:15 UTC",
  "updated_at": "2019-11-07 08:51:15 UTC",
  "id": 980190964,
  "type": "AuthSourceLdap",
  "name": "ldap2",
  "external_usergroups": [],
  "locations": [],
  "organizations": []
}

参数

参数名字 描述
location_id
选填

Set the current location context for the request

Validations:

  • Must be a Integer

organization_id
选填

Set the current organization context for the request

Validations:

  • Must be a Integer

auth_source_ldap
必填

Validations:

  • Must be a Hash

auth_source_ldap[name]
必填

Validations:

  • Must be a String

auth_source_ldap[host]
必填

Validations:

  • Must be a String

auth_source_ldap[port]
选填 , 允许空值

默认为 389

Validations:

  • Must be a number.

auth_source_ldap[account]
选填 , 允许空值

Validations:

  • Must be a String

auth_source_ldap[base_dn]
选填 , 允许空值

Validations:

  • Must be a String

auth_source_ldap[account_password]
选填 , 允许空值

如果 onthefly_register 为 true,则需要填写

Validations:

  • Must be a String

auth_source_ldap[attr_login]
选填 , 允许空值

如果 onthefly_register 为 true,则需要填写

Validations:

  • Must be a String

auth_source_ldap[attr_firstname]
选填 , 允许空值

如果 onthefly_register 为 true,则需要填写

Validations:

  • Must be a String

auth_source_ldap[attr_lastname]
选填 , 允许空值

如果 onthefly_register 为 true,则需要填写

Validations:

  • Must be a String

auth_source_ldap[attr_mail]
选填 , 允许空值

如果 onthefly_register 为 true,则需要填写

Validations:

  • Must be a String

auth_source_ldap[attr_photo]
选填 , 允许空值

Validations:

  • Must be a String

auth_source_ldap[onthefly_register]
选填 , 允许空值

Validations:

  • Must be one of: true, false, 1, 0.

auth_source_ldap[usergroup_sync]
选填 , 允许空值

登录时同步外部用户组

Validations:

  • Must be one of: true, false, 1, 0.

auth_source_ldap[tls]
选填 , 允许空值

Validations:

  • Must be one of: true, false, 1, 0.

auth_source_ldap[groups_base]
选填 , 允许空值

组基础 DN

Validations:

  • Must be a String

auth_source_ldap[use_netgroups]
选填 , 允许空值

使用 NIS 网络组代替 posix 组,仅在 server_type 为 posix 或 free_ipa 时适用

Validations:

  • Must be one of: true, false, 1, 0.

auth_source_ldap[server_type]
选填 , 允许空值

LDAP 服务器类型

Validations:

  • Must be one of: free_ipa, active_directory, posix.

auth_source_ldap[ldap_filter]
选填 , 允许空值

LDAP 过滤器

Validations:

  • Must be a String

auth_source_ldap[location_ids]
选填 , 允许空值

使用给定 id 替换位置

Validations:

  • Must be an array of any type

auth_source_ldap[organization_ids]
选填 , 允许空值

使用给定 id 替换机构

Validations:

  • Must be an array of any type


PUT /api/auth_source_ldaps/:id
更新 LDAP 认证源

示例

PUT /api/auth_source_ldaps/980190962-ldap-server
{
  "auth_source_ldap": {
    "name": "ldap2",
    "host": "ldap2",
    "server_type": "posix"
  }
}
200
{
  "host": "ldap2",
  "port": 123,
  "account": null,
  "base_dn": "dn=x,dn=y",
  "ldap_filter": null,
  "attr_login": "uid",
  "attr_firstname": "givenName",
  "attr_lastname": "sn",
  "attr_mail": "mail",
  "attr_photo": null,
  "onthefly_register": true,
  "usergroup_sync": true,
  "tls": true,
  "server_type": "posix",
  "groups_base": null,
  "use_netgroups": false,
  "created_at": "2019-11-07 08:51:03 UTC",
  "updated_at": "2019-11-07 08:51:15 UTC",
  "id": 980190962,
  "type": "AuthSourceLdap",
  "name": "ldap2",
  "external_usergroups": [],
  "locations": [
    {
      "id": 255093256,
      "name": "Location 1",
      "title": "Location 1",
      "description": null
    }
  ],
  "organizations": [
    {
      "id": 447626438,
      "name": "Organization 1",
      "title": "Organization 1",
      "description": null
    }
  ]
}

参数

参数名字 描述
location_id
选填

Set the current location context for the request

Validations:

  • Must be a Integer

organization_id
选填

Set the current organization context for the request

Validations:

  • Must be a Integer

id
必填

Validations:

  • Must be a String

auth_source_ldap
必填

Validations:

  • Must be a Hash

auth_source_ldap[name]
选填

Validations:

  • Must be a String

auth_source_ldap[host]
选填

Validations:

  • Must be a String

auth_source_ldap[port]
选填 , 允许空值

默认为 389

Validations:

  • Must be a number.

auth_source_ldap[account]
选填 , 允许空值

Validations:

  • Must be a String

auth_source_ldap[base_dn]
选填 , 允许空值

Validations:

  • Must be a String

auth_source_ldap[account_password]
选填 , 允许空值

如果 onthefly_register 为 true,则需要填写

Validations:

  • Must be a String

auth_source_ldap[attr_login]
选填 , 允许空值

如果 onthefly_register 为 true,则需要填写

Validations:

  • Must be a String

auth_source_ldap[attr_firstname]
选填 , 允许空值

如果 onthefly_register 为 true,则需要填写

Validations:

  • Must be a String

auth_source_ldap[attr_lastname]
选填 , 允许空值

如果 onthefly_register 为 true,则需要填写

Validations:

  • Must be a String

auth_source_ldap[attr_mail]
选填 , 允许空值

如果 onthefly_register 为 true,则需要填写

Validations:

  • Must be a String

auth_source_ldap[attr_photo]
选填 , 允许空值

Validations:

  • Must be a String

auth_source_ldap[onthefly_register]
选填 , 允许空值

Validations:

  • Must be one of: true, false, 1, 0.

auth_source_ldap[usergroup_sync]
选填 , 允许空值

登录时同步外部用户组

Validations:

  • Must be one of: true, false, 1, 0.

auth_source_ldap[tls]
选填 , 允许空值

Validations:

  • Must be one of: true, false, 1, 0.

auth_source_ldap[groups_base]
选填 , 允许空值

组基础 DN

Validations:

  • Must be a String

auth_source_ldap[use_netgroups]
选填 , 允许空值

使用 NIS 网络组代替 posix 组,仅在 server_type 为 posix 或 free_ipa 时适用

Validations:

  • Must be one of: true, false, 1, 0.

auth_source_ldap[server_type]
选填 , 允许空值

LDAP 服务器类型

Validations:

  • Must be one of: free_ipa, active_directory, posix.

auth_source_ldap[ldap_filter]
选填 , 允许空值

LDAP 过滤器

Validations:

  • Must be a String

auth_source_ldap[location_ids]
选填 , 允许空值

使用给定 id 替换位置

Validations:

  • Must be an array of any type

auth_source_ldap[organization_ids]
选填 , 允许空值

使用给定 id 替换机构

Validations:

  • Must be an array of any type


PUT /api/auth_source_ldaps/:id/test
测试 LDAP 连接

示例

PUT /api/auth_source_ldaps/980190962-ldap-server/test
{
  "auth_source_ldap": {}
}
500
{
  "error": {
    "message": "wrong number of arguments (given 0, expected 1+)"
  }
}

参数

参数名字 描述
location_id
选填

Set the current location context for the request

Validations:

  • Must be a Integer

organization_id
选填

Set the current organization context for the request

Validations:

  • Must be a Integer

id
必填

Validations:

  • Must be a String


DELETE /api/auth_source_ldaps/:id
删除 LDAP 认证源

示例

DELETE /api/auth_source_ldaps/980190962
{
  "auth_source_ldap": {}
}
200
{
  "id": 980190962,
  "name": "ldap-server",
  "host": "ldap",
  "port": 123,
  "account": null,
  "account_password": null,
  "base_dn": "dn=x,dn=y",
  "attr_login": "uid",
  "attr_firstname": "givenName",
  "attr_lastname": "sn",
  "attr_mail": "mail",
  "onthefly_register": true,
  "tls": true,
  "created_at": "2019-11-07T08:51:03.056Z",
  "updated_at": "2019-11-07T08:51:03.056Z",
  "ldap_filter": null,
  "attr_photo": null,
  "server_type": "posix",
  "groups_base": null,
  "usergroup_sync": true,
  "use_netgroups": false
}

参数

参数名字 描述
location_id
选填

Set the current location context for the request

Validations:

  • Must be a Integer

organization_id
选填

Set the current organization context for the request

Validations:

  • Must be a Integer

id
必填

Validations:

  • Must be a String