janus-ssp / janus

Fully featured metadata registration administration module built on top of simpleSAMLphp.
Other
13 stars 8 forks source link

Easy way to set/unset allowedConnection from API #580

Open baszoetekouw opened 9 years ago

baszoetekouw commented 9 years ago

Using the current API, it is possible to change the list of allowedConnection/blockedConnections using a PUT request:

curl -k -u user:pass -H "Content-type: application/json" --data-binary '{ "allowedConnections": [ {"id": 2} ] }' -v -X PUT https://serviceregistry.test2.surfconext.nl/janus/app.php/api/connections/21.json

This works well, but only allows replacement of the entire list.

It would be convenient if there were a way to set or unset one specific entry in the allowedConnection/blockedConnections list. For example, introduce an endpoint

/api/connections/21/allowedConnections/
/api/connections/21/allowedConnections/17.json

That would allow easy operations like

curl -k -u user:pass -v -X DELETE https://serviceregistry.test2.surfconext.nl/janus/app.php/api/connections/21/allowedConnections/17.json

to remove an entry and

curl -k -u user:pass -v -X POST -H "Content-type: application/json" --data-binary ' {"id": 2}' https://serviceregistry.test2.surfconext.nl/janus/app.php/api/connections/21/allowedConnections/

to add an entry to the list.

thijskh commented 9 years ago

This would certainly be useful.

relaxnow commented 8 years ago

Seems doable.