CMDBuild Forum

Rest API: Impersonate

Hi,

I do not see how the impersonate mechanism is done throught the REST API.
Anyone have one example of use of this feature ?

I did a test through SoapUI
Cconnection with my webservice user

Get the session token YYYY

did a put  with the impersonate

PUT http://xxx8080/cmdev/services/rest/v2/sessions/YYYY/impersonate/jsmith/ 
with the header CMDBuild-Authorization:YYYY

Got a 204/No Content response

Did a try to retrieve the impersonnated session user and still have the webservice user information.

My webservice user is administrator of the instance and the webservice and privilegied options are set.

Regards

Oli

It seems that you did the right steps. 
 
We try to sumarize the whole steps:
* from CMDBuild's administration module, create a service user (you should find two new flags for accomplish that, the firt one is correct)
* create a new session using the service user
* read the session and it should be referred to the service user
* impersonate another valid user
* read the session again and it should be referred to the impersonated user
 
-- CMDBuild Team
 
Previously Oli v wrote:

Hi,

I do not see how the impersonate mechanism is done throught the REST API.
Anyone have one example of use of this feature ?

I did a test through SoapUI
Cconnection with my webservice user

Get the session token YYYY

did a put  with the impersonate

PUT http://xxx8080/cmdev/services/rest/v2/sessions/YYYY/impersonate/jsmith/ 
with the header CMDBuild-Authorization:YYYY

Got a 204/No Content response

Did a try to retrieve the impersonnated session user and still have the webservice user information.

My webservice user is administrator of the instance and the webservice and privilegied options are set.

Regards

Oli

 

Everything is fine, my only mistake was to impersonnate twice. That will cause an error (java exception + error 204)
 
thanks for your quick answer !
Oli
 
Previously Tecnoteca wrote:
It seems that you did the right steps. 
 
We try to sumarize the whole steps:
* from CMDBuild's administration module, create a service user (you should find two new flags for accomplish that, the firt one is correct)
* create a new session using the service user
* read the session and it should be referred to the service user
* impersonate another valid user
* read the session again and it should be referred to the impersonated user
 
-- CMDBuild Team
 
Previously Oli v wrote:

Hi,

I do not see how the impersonate mechanism is done throught the REST API.
Anyone have one example of use of this feature ?

I did a test through SoapUI
Cconnection with my webservice user

Get the session token YYYY

did a put  with the impersonate

PUT http://xxx8080/cmdev/services/rest/v2/sessions/YYYY/impersonate/jsmith/ 
with the header CMDBuild-Authorization:YYYY

Got a 204/No Content response

Did a try to retrieve the impersonnated session user and still have the webservice user information.

My webservice user is administrator of the instance and the webservice and privilegied options are set.

Regards

Oli