Select to view content in your preferred language

How do I determine if a specified service is secured or not.

627
2
04-09-2014 01:21 PM
glennmeister
Emerging Contributor
How can programmatically determine if a specified service has been secured or not. Ideally the application should check to see if the service is secure or not before trying to get a token.

As Admin I can secure a single service, so expect some way to test that without having to trying hitting the service and if I get an error try adding a token.

thanks.glenn
Tags (2)
0 Kudos
2 Replies
WilliamCraft
MVP Regular Contributor
Which version of ArcGIS for Server and which API are you using?  If you're not using an API, are you possibly creating an SOE?  On the other hand, this thread indicates the following information below:

To check if the service (10.1 or higher) is secured from the GIS Tier, you can use the ArcGIS for Server Admin API:

http://yourserver:6080/arcgis/admin/services/yourservice.MapServer/permissions

If the REST end point returned "esriEveryone", it means it is public.  Otherwise, it will return the permitted Roles or Group who can access the service.  What you're really checking for here is whether or not the service requires a GIS token or does not require a GIS token.  Using the REST Admin API in this manner and incorporating this logic into an application or SOE would likely require some sort of custom Python scripting. 

To check if it is secured from the Web Tier, you would somehow have to check and see if HTTP protocol (SSL) or port 443 is being used. 

This thread also have some relevant information. 

I hope this information is helpful to you.
0 Kudos
glennmeister
Emerging Contributor
Hi , 
I was using 10.1 server, expect the same for 10.2.

Thanks for the suggestions, however I was attempting this with a Windows Mobile Application, and not using the Windows WPF framework, so that code wouldn't work here.

This has to be available from the client side so that we don't force our users to log in to a service unless it is secured. Thus using the Admin tools is not an option.

A lot of strange errors found poking around the services with different urls, however settled on trying to hit the service using the WebRequest.GetResponse() , and using the ResponseUri property to check for a redirect to a login service.

thanks...glenn
0 Kudos