LDAP 리소스 관리

다음에 대해 LDAP 정책을 사용하는 경우 DN (도메인 이름) 쿼리와 일치하는 경우 정책은 에는 LDAP 제공업체에 대한 연결 세부정보가 포함됩니다. 이 섹션에서는 Cloud Build를 사용하여 API를 통해 LDAP 리소스를 관리할 수 있습니다.

LDAP 리소스 만들기

다음은 LDAP 리소스를 만들기 위한 API입니다.

/v1/organizations/org_name/environments/environment_name/ldapresources

다음은 사용자가 사용하게 될 LDAP 리소스 구성을 설명하는 주석이 달린 XML 페이로드입니다. 전송하여 리소스를 만듭니다.

<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