You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ambari.apache.org by "Robert Levas (JIRA)" <ji...@apache.org> on 2017/11/27 18:51:00 UTC

[jira] [Updated] (AMBARI-22481) Make Ambari LDAP configuration API consistent with existing API

     [ https://issues.apache.org/jira/browse/AMBARI-22481?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Robert Levas updated AMBARI-22481:
----------------------------------
    Description: 
Make Ambari configuration API consistent with existing API. 

The current API entry point (as of AMBARI-21307) to set and test the LDAP configuration is {{/api/v1/ldapconfigs}}. This should be more inline with the existing entry point for Ambari server related data...  {{/api/v1/services/AMBARI/components/AMBARI_SERVER}}.  

The new API entry point for Ambari server related configuration data should be {{/api/v1/services/AMBARI/components/AMBARI_SERVER/configurations}}.  For the LDAP-specific configuration, the configuration category is *_"ldap-configuration"_*.  

See AMBARI-22418 for examples on setting and getting this configuration.

For testing the configuration, the following directives should be used:

* {{op=test-connection}}
* {{op=test-attributes}}
* {{op=detect-attributes}}

For example:
*Test the connection for a new set of configuration data*
{noformat:title=URL}
POST /api/v1/services/AMBARI/components/AMBARI_SERVER/configurations?op=test-connection
{noformat}
{code:title=Payload}
{
  "Configuration": {    
    "category" : "ldap-configuration",
    "properties": {
        "ambari.ldap.connectivity.server.host": "ldap.forumsys.com",
        "ambari.ldap.connectivity.server.port": "389",
        "ambari.ldap.connectivity.anonymous_bind": "true",
        "ambari.ldap.attributes.user.search_base": "dc=example,dc=com",
        "ambari.ldap.attributes.user.object_class": "person",
        "ambari.ldap.attributes.user.name_attr": "uid",
        "ambari.ldap.attributes.group.object_class": "groupOfUniqueNames",
        "ambari.ldap.attributes.group.name_attr": "cn",
        "ambari.ldap.attributes.group.member_attr": "uniqueMember",
        "ambari.ldap.attributes.group.search_base": "dc=example,dc=com"
      }
  }
}
{code}
{code:title=Success Response}
Status 201: Created
{
  "operationResults" : {
    "test-connection" : {
      "status" : "success"
    }
  }
}
{code}
{code:title=Error Response}
Status 201: Created
{
  "operationResults" : {
    "test-connection" : {
      "status" : "error",
      "message" : "An unexpected error has occurred."
    }
  }
}
{code}


*Test the connection for an updated set of configuration data*
{noformat:title=URL}
PUT /api/v1/services/AMBARI/components/AMBARI_SERVER/configurations/ldap-configuration?op=test-connection
{noformat}
{code:title=Payload}
{
  "Configuration": {    
    "category" : "ldap-configuration",
    "properties": {
        "ambari.ldap.connectivity.server.host": "new.ldap.host.com"
      }
  }
}
{code}
{code:title=Success Response}
Status 200: OK
{
  "operationResults" : {
    "test-connection" : {
      "status" : "success"
    }
  }
}
{code}
{code:title=Error Response}
Status 200: OK
{
  "operationResults" : {
    "test-connection" : {
      "status" : "error",
      "message" : "An unexpected error has occurred."
    }
  }
}
{code}

*Test the attributes of a user for a new set of configuration data*
{noformat:title=URL}
POST /api/v1/services/AMBARI/components/AMBARI_SERVER/configurations?op=test-attributes
{noformat}
{code:title=Payload}
{
  "Configuration": {    
    "category" : "ldap-configuration",
    "properties": {
        "ambari.ldap.connectivity.server.host": "ldap.forumsys.com",
        "ambari.ldap.connectivity.server.port": "389",
        "ambari.ldap.connectivity.anonymous_bind": "true",
        "ambari.ldap.attributes.user.search_base": "dc=example,dc=com",
        "ambari.ldap.attributes.user.object_class": "person",
        "ambari.ldap.attributes.user.name_attr": "uid",
        "ambari.ldap.attributes.group.object_class": "groupOfUniqueNames",
        "ambari.ldap.attributes.group.name_attr": "cn",
        "ambari.ldap.attributes.group.member_attr": "uniqueMember",
        "ambari.ldap.attributes.group.search_base": "dc=example,dc=com"
      }
  },
 "RequestInfo":{
  	"parameters":{
  		"ambari.ldap.test.user.name": "euclid"
  	}
  }
}
{code}
{code:title=Success Response}
Status 201: Created
{
  "operationResults" : {
    "test-attributes" : {
      "status" : "success",
      "response" : {
        "groups" : [
          "Mathematicians"
        ]
      }
    }
  }
}
{code}
{code:title=Error Response}
Status 201: Created
{
  "operationResults" : {
    "test-attributes" : {
      "status" : "error",
      "message" : "An unexpected error has occurred."
    }
  }
}
{code}


*Test the attributes of a user for an updated set of configuration data*
{noformat:title=URL}
PUT /api/v1/services/AMBARI/components/AMBARI_SERVER/configurations/ldap-configuration?op=test-attributes
{noformat}
{code:title=Payload}
{
  "Configuration": {    
    "category" : "ldap-configuration",
    "properties": {
        "ambari.ldap.attributes.group.member_attr": "uniqueMember"
      }
  },
 "RequestInfo":{
  	"parameters":{
  		"ambari.ldap.test.user.name": "euclid"
  	}
  }
}
{code}
{code:title=Success Response}
Status 200: OK
{
  "operationResults" : {
    "test-attributes" : {
      "status" : "success",
      "response" : {
        "groups" : [
          "Mathematicians"
        ]
      }
    }
  }
}
{code}
{code:title=Error Response}
Status 200: OK
{
  "operationResults" : {
    "test-attributes" : {
      "status" : "error",
      "message" : "An unexpected error has occurred."
    }
  }
}
{code}

*Detect the attributes for a user and a group for a new set of configuration data*
{noformat:title=URL}
POST /api/v1/services/AMBARI/components/AMBARI_SERVER/configurations?op=detect-attributes
{noformat}
{code:title=Payload}
{
  "Configuration": {    
    "category" : "ldap-configuration",
    "properties": {
        "ambari.ldap.connectivity.server.host": "ldap.forumsys.com",
        "ambari.ldap.connectivity.server.port": "389",
        "ambari.ldap.connectivity.anonymous_bind": "true",
        "ambari.ldap.attributes.user.search_base": "dc=example,dc=com",
        "ambari.ldap.attributes.group.search_base": "dc=example,dc=com"
      }
  }
}
{code}
{code:title=Success Response}
Status 201: Created
{
  "operationResults" : {
    "detect-attributes" : {
      "status" : "success",
      "response" : {
        "attributes" : {
          "ambari.ldap.attributes.group.name_attr" : "cn",
          "ambari.ldap.attributes.user.object_class" : "person",
          "ambari.ldap.attributes.group.member_attr" : "memberUid",
          "ambari.ldap.attributes.user.group_member_attr" : "N/A",
          "ambari.ldap.attributes.user.search_base" : "dc=example,dc=com",
          "ambari.ldap.attributes.group.object_class" : "posixGroup",
          "ambari.ldap.attributes.group.search_base" : "dc=example,dc=com",
          "ambari.ldap.connectivity.server.host" : "ldap.forumsys.com",
          "ambari.ldap.connectivity.anonymous_bind" : "true",
          "ambari.ldap.connectivity.server.port" : "389",
          "ambari.ldap.attributes.user.name_attr" : "sAMAccountName"
        }
      }
    }
  }
}
{code}
{code:title=Error Response}
Status 201: Created
{
  "operationResults" : {
    "detect-attributes" : {
      "status" : "error",
      "message" : "An unexpected error has occurred."
    }
  }
}
{code}


*Detect the attributes for a user and a group for an updated set of configuration data*
{noformat:title=URL}
PUT /api/v1/services/AMBARI/components/AMBARI_SERVER/configurations/ldap-configuration?op=test-attributes
{noformat}
{code:title=Payload}
{
  "Configuration": {    
    "category" : "ldap-configuration",
    "properties": {
      "ambari.ldap.connectivity.anonymous_bind": "false",
      "ambari.ldap.connectivity.bind_dn": "cn=read-only-admin,dc=example,dc=com",
      "ambari.ldap.connectivity.bind_password": "password"
    }
  }
}
{code}
{code:title=Success Response}
Status 200: OK
{
  "operationResults" : {
    "detect-attributes" : {
      "status" : "success",
      "response" : {
        "attributes" : {
          "ambari.ldap.connectivity.bind_password" : "password",
          "ambari.ldap.attributes.group.name_attr" : "cn",
          "ambari.ldap.attributes.user.object_class" : "person",
          "ambari.ldap.attributes.group.member_attr" : "memberUid",
          "ambari.ldap.attributes.user.group_member_attr" : "N/A",
          "ambari.ldap.attributes.user.search_base" : "dc=example,dc=com",
          "ambari.ldap.connectivity.bind_dn" : "cn=read-only-admin,dc=example,dc=com",
          "ambari.ldap.attributes.group.object_class" : "posixGroup",
          "ambari.ldap.attributes.group.search_base" : "dc=example,dc=com",
          "ambari.ldap.connectivity.server.host" : "ldap.forumsys.com",
          "ambari.ldap.connectivity.anonymous_bind" : "false",
          "ambari.ldap.connectivity.server.port" : "389",
          "ambari.ldap.attributes.user.name_attr" : "sAMAccountName"
        }
      }
    }
  }
}
{code}
{code:title=Error Response}
Status 200: OK
{
  "operationResults" : {
    "detect-attributes" : {
      "status" : "error",
      "message" : "An unexpected error has occurred."
    }
  }
}
{code}



  was:
Make Ambari configuration API consistent with existing API. 

The current API entry point (as of AMBARI-21307) to set and test the LDAP configuration is {{/api/v1/ldapconfigs}}. This should be more inline with the existing entry point for Ambari server related data...  {{/api/v1/services/AMBARI/components/AMBARI_SERVER}}.  

The new API entry point for Ambari server related configuration data should be {{/api/v1/services/AMBARI/components/AMBARI_SERVER/configurations}}.  For the LDAP-specific configuration, the configuration category is *_"ldap-configuration"_*.  

See AMBARI-22418 for examples on setting and getting this configuration.

For testing the configuration, the following directives should be used:

* {{op=test-connection}}
* {{op=test-attributes}}
* {{op=detect-attributes}}

For example:
*Test the connection for a new set of data*
{noformat:title=URL}
POST /api/v1/services/AMBARI/components/AMBARI_SERVER/configurations?op=test-connection
{noformat}
{code:title=Payload}
{
  "Configuration": {    
    "category" : "ldap-configuration",
    "properties": {
        "ambari.ldap.connectivity.server.host": "ldap.forumsys.com",
        "ambari.ldap.connectivity.server.port": "389",
        "ambari.ldap.connectivity.anonymous_bind": "true",
        "ambari.ldap.attributes.user.search_base": "dc=example,dc=com",
        "ambari.ldap.attributes.user.object_class": "person",
        "ambari.ldap.attributes.user.name_attr": "uid",
        "ambari.ldap.attributes.group.object_class": "groupOfUniqueNames",
        "ambari.ldap.attributes.group.name_attr": "cn",
        "ambari.ldap.attributes.group.member_attr": "uniqueMember",
        "ambari.ldap.attributes.group.search_base": "dc=example,dc=com"
      }
  }
}
{code}

*Test the connection for an updated set of data*
{noformat:title=URL}
PUT /api/v1/services/AMBARI/components/AMBARI_SERVER/configurations/ldap-configuration?op=test-connection
{noformat}
{code:title=Payload}
{
  "Configuration": {    
    "category" : "ldap-configuration",
    "properties": {
        "ambari.ldap.connectivity.server.host": "new.ldap.host.com"
      }
  }
}
{code}




> Make Ambari LDAP configuration API consistent with existing API
> ---------------------------------------------------------------
>
>                 Key: AMBARI-22481
>                 URL: https://issues.apache.org/jira/browse/AMBARI-22481
>             Project: Ambari
>          Issue Type: Task
>          Components: ambari-server
>    Affects Versions: 3.0.0
>            Reporter: Robert Levas
>            Assignee: Robert Levas
>            Priority: Critical
>             Fix For: 3.0.0
>
>
> Make Ambari configuration API consistent with existing API. 
> The current API entry point (as of AMBARI-21307) to set and test the LDAP configuration is {{/api/v1/ldapconfigs}}. This should be more inline with the existing entry point for Ambari server related data...  {{/api/v1/services/AMBARI/components/AMBARI_SERVER}}.  
> The new API entry point for Ambari server related configuration data should be {{/api/v1/services/AMBARI/components/AMBARI_SERVER/configurations}}.  For the LDAP-specific configuration, the configuration category is *_"ldap-configuration"_*.  
> See AMBARI-22418 for examples on setting and getting this configuration.
> For testing the configuration, the following directives should be used:
> * {{op=test-connection}}
> * {{op=test-attributes}}
> * {{op=detect-attributes}}
> For example:
> *Test the connection for a new set of configuration data*
> {noformat:title=URL}
> POST /api/v1/services/AMBARI/components/AMBARI_SERVER/configurations?op=test-connection
> {noformat}
> {code:title=Payload}
> {
>   "Configuration": {    
>     "category" : "ldap-configuration",
>     "properties": {
>         "ambari.ldap.connectivity.server.host": "ldap.forumsys.com",
>         "ambari.ldap.connectivity.server.port": "389",
>         "ambari.ldap.connectivity.anonymous_bind": "true",
>         "ambari.ldap.attributes.user.search_base": "dc=example,dc=com",
>         "ambari.ldap.attributes.user.object_class": "person",
>         "ambari.ldap.attributes.user.name_attr": "uid",
>         "ambari.ldap.attributes.group.object_class": "groupOfUniqueNames",
>         "ambari.ldap.attributes.group.name_attr": "cn",
>         "ambari.ldap.attributes.group.member_attr": "uniqueMember",
>         "ambari.ldap.attributes.group.search_base": "dc=example,dc=com"
>       }
>   }
> }
> {code}
> {code:title=Success Response}
> Status 201: Created
> {
>   "operationResults" : {
>     "test-connection" : {
>       "status" : "success"
>     }
>   }
> }
> {code}
> {code:title=Error Response}
> Status 201: Created
> {
>   "operationResults" : {
>     "test-connection" : {
>       "status" : "error",
>       "message" : "An unexpected error has occurred."
>     }
>   }
> }
> {code}
> *Test the connection for an updated set of configuration data*
> {noformat:title=URL}
> PUT /api/v1/services/AMBARI/components/AMBARI_SERVER/configurations/ldap-configuration?op=test-connection
> {noformat}
> {code:title=Payload}
> {
>   "Configuration": {    
>     "category" : "ldap-configuration",
>     "properties": {
>         "ambari.ldap.connectivity.server.host": "new.ldap.host.com"
>       }
>   }
> }
> {code}
> {code:title=Success Response}
> Status 200: OK
> {
>   "operationResults" : {
>     "test-connection" : {
>       "status" : "success"
>     }
>   }
> }
> {code}
> {code:title=Error Response}
> Status 200: OK
> {
>   "operationResults" : {
>     "test-connection" : {
>       "status" : "error",
>       "message" : "An unexpected error has occurred."
>     }
>   }
> }
> {code}
> *Test the attributes of a user for a new set of configuration data*
> {noformat:title=URL}
> POST /api/v1/services/AMBARI/components/AMBARI_SERVER/configurations?op=test-attributes
> {noformat}
> {code:title=Payload}
> {
>   "Configuration": {    
>     "category" : "ldap-configuration",
>     "properties": {
>         "ambari.ldap.connectivity.server.host": "ldap.forumsys.com",
>         "ambari.ldap.connectivity.server.port": "389",
>         "ambari.ldap.connectivity.anonymous_bind": "true",
>         "ambari.ldap.attributes.user.search_base": "dc=example,dc=com",
>         "ambari.ldap.attributes.user.object_class": "person",
>         "ambari.ldap.attributes.user.name_attr": "uid",
>         "ambari.ldap.attributes.group.object_class": "groupOfUniqueNames",
>         "ambari.ldap.attributes.group.name_attr": "cn",
>         "ambari.ldap.attributes.group.member_attr": "uniqueMember",
>         "ambari.ldap.attributes.group.search_base": "dc=example,dc=com"
>       }
>   },
>  "RequestInfo":{
>   	"parameters":{
>   		"ambari.ldap.test.user.name": "euclid"
>   	}
>   }
> }
> {code}
> {code:title=Success Response}
> Status 201: Created
> {
>   "operationResults" : {
>     "test-attributes" : {
>       "status" : "success",
>       "response" : {
>         "groups" : [
>           "Mathematicians"
>         ]
>       }
>     }
>   }
> }
> {code}
> {code:title=Error Response}
> Status 201: Created
> {
>   "operationResults" : {
>     "test-attributes" : {
>       "status" : "error",
>       "message" : "An unexpected error has occurred."
>     }
>   }
> }
> {code}
> *Test the attributes of a user for an updated set of configuration data*
> {noformat:title=URL}
> PUT /api/v1/services/AMBARI/components/AMBARI_SERVER/configurations/ldap-configuration?op=test-attributes
> {noformat}
> {code:title=Payload}
> {
>   "Configuration": {    
>     "category" : "ldap-configuration",
>     "properties": {
>         "ambari.ldap.attributes.group.member_attr": "uniqueMember"
>       }
>   },
>  "RequestInfo":{
>   	"parameters":{
>   		"ambari.ldap.test.user.name": "euclid"
>   	}
>   }
> }
> {code}
> {code:title=Success Response}
> Status 200: OK
> {
>   "operationResults" : {
>     "test-attributes" : {
>       "status" : "success",
>       "response" : {
>         "groups" : [
>           "Mathematicians"
>         ]
>       }
>     }
>   }
> }
> {code}
> {code:title=Error Response}
> Status 200: OK
> {
>   "operationResults" : {
>     "test-attributes" : {
>       "status" : "error",
>       "message" : "An unexpected error has occurred."
>     }
>   }
> }
> {code}
> *Detect the attributes for a user and a group for a new set of configuration data*
> {noformat:title=URL}
> POST /api/v1/services/AMBARI/components/AMBARI_SERVER/configurations?op=detect-attributes
> {noformat}
> {code:title=Payload}
> {
>   "Configuration": {    
>     "category" : "ldap-configuration",
>     "properties": {
>         "ambari.ldap.connectivity.server.host": "ldap.forumsys.com",
>         "ambari.ldap.connectivity.server.port": "389",
>         "ambari.ldap.connectivity.anonymous_bind": "true",
>         "ambari.ldap.attributes.user.search_base": "dc=example,dc=com",
>         "ambari.ldap.attributes.group.search_base": "dc=example,dc=com"
>       }
>   }
> }
> {code}
> {code:title=Success Response}
> Status 201: Created
> {
>   "operationResults" : {
>     "detect-attributes" : {
>       "status" : "success",
>       "response" : {
>         "attributes" : {
>           "ambari.ldap.attributes.group.name_attr" : "cn",
>           "ambari.ldap.attributes.user.object_class" : "person",
>           "ambari.ldap.attributes.group.member_attr" : "memberUid",
>           "ambari.ldap.attributes.user.group_member_attr" : "N/A",
>           "ambari.ldap.attributes.user.search_base" : "dc=example,dc=com",
>           "ambari.ldap.attributes.group.object_class" : "posixGroup",
>           "ambari.ldap.attributes.group.search_base" : "dc=example,dc=com",
>           "ambari.ldap.connectivity.server.host" : "ldap.forumsys.com",
>           "ambari.ldap.connectivity.anonymous_bind" : "true",
>           "ambari.ldap.connectivity.server.port" : "389",
>           "ambari.ldap.attributes.user.name_attr" : "sAMAccountName"
>         }
>       }
>     }
>   }
> }
> {code}
> {code:title=Error Response}
> Status 201: Created
> {
>   "operationResults" : {
>     "detect-attributes" : {
>       "status" : "error",
>       "message" : "An unexpected error has occurred."
>     }
>   }
> }
> {code}
> *Detect the attributes for a user and a group for an updated set of configuration data*
> {noformat:title=URL}
> PUT /api/v1/services/AMBARI/components/AMBARI_SERVER/configurations/ldap-configuration?op=test-attributes
> {noformat}
> {code:title=Payload}
> {
>   "Configuration": {    
>     "category" : "ldap-configuration",
>     "properties": {
>       "ambari.ldap.connectivity.anonymous_bind": "false",
>       "ambari.ldap.connectivity.bind_dn": "cn=read-only-admin,dc=example,dc=com",
>       "ambari.ldap.connectivity.bind_password": "password"
>     }
>   }
> }
> {code}
> {code:title=Success Response}
> Status 200: OK
> {
>   "operationResults" : {
>     "detect-attributes" : {
>       "status" : "success",
>       "response" : {
>         "attributes" : {
>           "ambari.ldap.connectivity.bind_password" : "password",
>           "ambari.ldap.attributes.group.name_attr" : "cn",
>           "ambari.ldap.attributes.user.object_class" : "person",
>           "ambari.ldap.attributes.group.member_attr" : "memberUid",
>           "ambari.ldap.attributes.user.group_member_attr" : "N/A",
>           "ambari.ldap.attributes.user.search_base" : "dc=example,dc=com",
>           "ambari.ldap.connectivity.bind_dn" : "cn=read-only-admin,dc=example,dc=com",
>           "ambari.ldap.attributes.group.object_class" : "posixGroup",
>           "ambari.ldap.attributes.group.search_base" : "dc=example,dc=com",
>           "ambari.ldap.connectivity.server.host" : "ldap.forumsys.com",
>           "ambari.ldap.connectivity.anonymous_bind" : "false",
>           "ambari.ldap.connectivity.server.port" : "389",
>           "ambari.ldap.attributes.user.name_attr" : "sAMAccountName"
>         }
>       }
>     }
>   }
> }
> {code}
> {code:title=Error Response}
> Status 200: OK
> {
>   "operationResults" : {
>     "detect-attributes" : {
>       "status" : "error",
>       "message" : "An unexpected error has occurred."
>     }
>   }
> }
> {code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)