Private Cloud v4.18.01 版
使用 LDAP 政策進行驗證或 DN 查詢 (http://apigee.com/docs/api-services/content/ldap-policy) 時, 政策會使用 Apigee 端 LDAP 資源,其中包含您的 LDAP 連線詳細資料 。本節說明如何透過 API 建立及管理 LDAP 資源。
建立 LDAP 資源
以下是用來建立 LDAP 資源的 API:
/v1/organizations/{org_name}/environments/{environment}/ldapresources
以下是含有註解的 XML 酬載說明 LDAP 資源設定 您接下來會傳送給我們來建立資源:
<LdapResource name="ldap1"> <Connection> <Hosts> <Host port="636">foo.com</Host> <!-- port is optional: defaults to 389 for ldap:// and 636 for ldaps:// --> </Hosts> <SSLEnabled>false</SSLEnabled> <!-- optional, defaults to false --> <Version>3</Version> <!-- optional, defaults to 3--> <Authentication>simple</Authentication> <!-- optional, only simple supported --> <ConnectionProvider>jndi|unboundid</ConnectionProvider> <!-- required --> <ServerSetType>single|round robin|failover</ServerSetType> <!-- not applicable for jndi --> <LdapConnectorClass>com.custom.ldap.MyProvider</LdapConnectorClass> <!-- If using a custom LDAP provider, the fully qualified class --> </Connection> <ConnectPool enabled="true"> <!-- enabled is optional, defaults to true --> <Timeout>30000</Timeout> <!-- optional, in milliseconds; if not set, no timeout --> <Maxsize>50</Maxsize> <!-- optional; if not set, no max connections --> <Prefsize>30</Prefsize> <!-- optional; if not set, no pref size --> <Initsize></Initsize> <!-- optional; if not set, defaults to 1 --> <Protocol></Protocol> <!-- optional; if not set, defaults to 'ssl plain' --> </ConnectPool> <Admin> <DN>cn=admin,dc=apigee,dc=com</DN> <Password>secret</Password> </Admin> </LdapResource>
範例
以下範例會建立名為 ldap1: 的 LDAP 資源:
curl -X POST -H "Content-Type: application/xml" \ https://api.enterprise.apigee.com/v1/organizations/myorg/environments/test/ldapresources \ -u {apigee_email}:{password} -d \ '<LdapResource name="ldap1"> <Connection> <Hosts> <Host>foo.com</Host> </Hosts> <SSLEnabled>false</SSLEnabled> <Version>3</Version> <Authentication>simple</Authentication> <ConnectionProvider>unboundid</ConnectionProvider> <ServerSetType>round robin</ServerSetType> </Connection> <ConnectPool enabled="true"> <Timeout>30000</Timeout> <Maxsize>50</Maxsize> <Prefsize>30</Prefsize> <Initsize></Initsize> <Protocol></Protocol> </ConnectPool> <Admin> <DN>cn=admin,dc=apigee,dc=com</DN> <Password>secret</Password> </Admin> </LdapResource>'
列出所有 LDAP 資源
curl https://api.enterprise.apigee.com/v1/organizations/myorg/environments/test/ldapresources \ -u {apigee_email}:{password}
取得 LDAP 資源的詳細資料
curl https://api.enterprise.apigee.com/v1/organizations/myorg/environments/test/ldapresources/ldap1 \ -u {apigee_email}:{password}
更新 LDAP 資源
curl -X POST -H "Content-Type: application/xml" \ https://api.enterprise.apigee.com/v1/organizations/myorg/environments/test/ldapresources/ldap1 \ -u {apigee_email}:{password} -d \ '<LdapResource name="ldap1"> <Connection> <Hosts> <Host>foo.com</Host> </Hosts> <SSLEnabled>false</SSLEnabled> <Version>3</Version> <Authentication>simple</Authentication> <ConnectionProvider>unboundid</ConnectionProvider> <ServerSetType>round robin</ServerSetType> </Connection> <ConnectPool enabled="true"> <Timeout>50000</Timeout> <Maxsize>50</Maxsize> <Prefsize>30</Prefsize> <Initsize></Initsize> <Protocol></Protocol> </ConnectPool> <Admin> <DN>cn=admin,dc=apigee,dc=com</DN> <Password>secret</Password> </Admin> </LdapResource>'
刪除 LDAP 資源
curl -X DELETE \ https://api.enterprise.apigee.com/v1/organizations/myorg/environments/test/ldapresources/ldap1 \ -u {apigee_email}:{password}