Select to view content in your preferred language

Custom GP Tool: Common Tool with user credentials

241
1
03-19-2025 04:20 AM
Labels (1)
MaximilianGlas
Esri Contributor

I am facing the challenge that I want to provide a GP tool on an ArcGIS Server 11.3, which should always use the credentials of the calling user when running.
The call is made from an Experience Builder client so that I can customize the request accordingly.
One possible solution would be to set up a separate parameter for the user token or the username. However, I don't like this solution for several reasons. I actually only want to receive the information required for processing in the parameters and not credentials. In addition, the signature of the tool would change. And I would have to do this for all my tools.
I would prefer a transfer via the HTTP header. But I can't find a way to read the HTTP header in the context of an ArcGIS Server GP tool.
An SOI doesn't seem to help either, as this can only be used for MapServices.
Is it possible to access the HTTP header information within a GP Tool in ArcGIS?
Are there any other ideas to realize this?

0 Kudos
1 Reply
TimWestern
MVP

One of the first Custom widgets I worked on, we had to validate a user against the auth point and get a token, then call a feature layer with parameters and pass the token with it to give it authorization.  If the GPTool had the ability to do something similar, take a auth token and map what it does scoped based on that, I think it could be passed in that way.

Otherwise, the only auth parts I've seen that might relate are creating the OAuth2.0 or client ID when setting up a client to run Experience Builder on a server (local EXB for eaxmple)

I don't know if the GP Tool itself is aware of the HTTP Headers, so I don't think that is possible, but you should be able to explicitly pass a value (like the token I described) to the gptool and it be consumed.
Ther eis a command somewhere that looks like:

GetActivePortalUser

I did find this over on Stack Exchange if that is helpful somehow:
https://gis.stackexchange.com/questions/336621/get-arcgis-pro-portal-user

I know the portal somehow knows who is logged in.

https://developers.arcgis.com/python/latest/guide/accessing-and-managing-users/

Feels like there ought to be a way to get information about the current logged in user somehow.






0 Kudos