Check if a user is authorized to a specific secured map service

717
2
07-22-2013 06:25 AM
MattiasEkström
Regular Contributor
I'm developing a widget that will make different queries to a specific secured map service. We have set up our ArcGIS server 10.1 to use Integrated Windows Authentication. I don't want the users that are unauthorized to see this service to think they can use the widget but then receive an error message (that they probably don't understand). So I want the widget to check if the user are authorized to see the map service and if not just display a message in the widget explaining that this widget only works for users that are authorized.

What I've come up with so far is to make a simple query to the map service, and if the query doesn't work and the faultString that is returned is equal to "Unable to get token service url from (http://servername/arcgis/rest/info) Version 10.01+ required." Then the user is not authorized otherwise the user is authorized. (Because that's the faultString that is returned when an unauthorized user try to query the service, doesn't even get a faultCode or something like that).

This actually works but I'm thinking there should be a better way to do this. For example, I guess this faultString I'm using could be caused by something else.
Any thoughts?
Hopefully I've missed something useful in the API...
Tags (2)
0 Kudos
2 Replies
StephanMendler
New Contributor III
Hi Mattias,

did you find the solution yet? I didn't. I tried to use the getCredetials-method of the IdentityManagerBase, but it does not support the necessary information.
I couldn't be so complicated...

Thanks,
Stephan
0 Kudos
MattiasEkström
Regular Contributor
I still haven't found a better solution.

It would be really nice if the API could provide some functionality to just ask a service if the current user is authorized to see it or not.
But one thought that crossed my mind is that when you look at the services in the service directory, you don't see any information about service that your not authorized to see, they're just not there. So maybe you can't check if your authorized when the service, to that unauthorized user, doesn't seems to exist.
0 Kudos