You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@guacamole.apache.org by Gabriel Huerta Araujo <hu...@globalhitss.com> on 2023/07/25 02:58:43 UTC
Using a PATCH request to remove logged users
I am trying to make a PATCH request in order to remove n tokens, as active connection does
{headers: {…}, method: 'PATCH', url: 'api/tokens', data: Array(1)}
data: Array(1)
0: {op: 'remove', path: '/9090FE7421EBADE951915BC458254C09CE021E3A5E8D37C377B5E4B476B40EDF'}
length: 1
[[Prototype]]:
Array(0)
headers:
{Guacamole-Token: '9090FE7421EBADE951915BC458254C09CE021E3A5E8D37C377B5E4B476B40EDF'}
method: "PATCH"
url: "api/tokens"
But it throws a 405 error (NOT ALLOWED).
Why active connections are posible remove them like that, but no logged users?
-Gabriel
Re: Using a PATCH request to remove logged users
Posted by Nick Couchman <vn...@apache.org>.
On Tue, Jul 25, 2023 at 3:29 PM Gabriel Huerta Araujo
<hu...@globalhitss.com> wrote:
>
>
> >> Because that endpoint has not been implemented in the Guacamole Client code. The Token REST service only has two endpoints:
> >> * POST that takes credentials and produces a token, assuming the authentication succeeds.
> >> * DELETE with a single token that invalidates the token.
>
> Ok, I have to extend DirectoryResource to manage LoggedUsers? Something that looks like ActiveConnectionDirectoryResource class?
I don't think DirectoryResource is what you need to extend or change -
since the tokens are managed through TokenRESTService, I suspect
that's where you'll need to add the code.
>
> If yes, some link which clarifies how to do this stuff?
Nothing specific, no, but if you have a look at the REST API code, you
should see roughly how to do it.
That said, why do you need to do this with a PATCH call? The PATCH
seems like it is better-suited for doing multiple types of operations
(add/remove/update) for multiple objects in a single shot. All you're
trying to do is remove one or more tokens. It seems like you could
either:
* Write a REST API client to loop through tokens and use the existing
DELETE endpoint to delete them one at a time.
* Update the TokenRESTService class with a DELETE endpoint that takes
an array of tokens instead of a single token.
The first accomplishes removal of multiple tokens without any
modification to the Guacamole REST code, the second will allow you to
do a single REST call, if, for some reason, there's value in doing it
all in one shot.
-Nick
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@guacamole.apache.org
For additional commands, e-mail: user-help@guacamole.apache.org
RE: Using a PATCH request to remove logged users
Posted by Gabriel Huerta Araujo <hu...@globalhitss.com>.
>> Because that endpoint has not been implemented in the Guacamole Client code. The Token REST service only has two endpoints:
>> * POST that takes credentials and produces a token, assuming the authentication succeeds.
>> * DELETE with a single token that invalidates the token.
Ok, I have to extend DirectoryResource to manage LoggedUsers? Something that looks like ActiveConnectionDirectoryResource class?
If yes, some link which clarifies how to do this stuff?
-- Gabriel
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@guacamole.apache.org
For additional commands, e-mail: user-help@guacamole.apache.org
Re: Using a PATCH request to remove logged users
Posted by Nick Couchman <vn...@apache.org>.
On Mon, Jul 24, 2023 at 10:59 PM Gabriel Huerta Araujo
<hu...@globalhitss.com> wrote:
>
> I am trying to make a PATCH request in order to remove n tokens, as active connection does
>
> {headers: {…}, method: 'PATCH', url: 'api/tokens', data: Array(1)}
> data: Array(1)
> 0: {op: 'remove', path: '/9090FE7421EBADE951915BC458254C09CE021E3A5E8D37C377B5E4B476B40EDF'}
> length: 1
> [[Prototype]]:
> Array(0)
> headers:
> {Guacamole-Token: '9090FE7421EBADE951915BC458254C09CE021E3A5E8D37C377B5E4B476B40EDF'}
> method: "PATCH"
> url: "api/tokens"
>
> But it throws a 405 error (NOT ALLOWED).
>
> Why active connections are posible remove them like that, but no logged users?
Because that endpoint has not been implemented in the Guacamole Client
code. The Token REST service only has two endpoints:
* POST that takes credentials and produces a token, assuming the
authentication succeeds.
* DELETE with a single token that invalidates the token.
-Nick
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@guacamole.apache.org
For additional commands, e-mail: user-help@guacamole.apache.org