Login to ArcGIS Server Secured Services

969
12
Jump to solution
01-16-2014 03:27 PM
TomSellsted
MVP Regular Contributor
Greetings!  I am working on a JS API app that uses some secured ArcGIS Server services.  The IdentityManager does work well for this purpose, but I am using a Windows Domain for my user store and the app users have to type in a complete domain\username to be able to properly log in.  This is not a big deal on a desktop, but it is much more difficult from an iPhone.

Is there a way to bypass the IdentityManager and save the username, so they don't have to type it in? They would still need to type in a password?

Thanks very much!
0 Kudos
1 Solution

Accepted Solutions
JonathanUihlein
Esri Regular Contributor
OK great! I had wrongfully assumed you had tried this method first as it is the easiest and most straight forward... my apologies.

Using the sample page as a demo:
http://developers.arcgis.com/en/javascript/samples/widget_identitymanager/

Using Firebug, I can see that the id of the input element is 'dijit_form_ValidationTextBox_0'

I can edit the value of the text field like so:
dijit.byId("dijit_form_ValidationTextBox_0").set("value", "jonuihlein");


Screenshot also attached.

Let me know if you have any more questions and don't forget to mark this thread as answered when you are completely satisfied!

View solution in original post

0 Kudos
12 Replies
JonathanUihlein
Esri Regular Contributor
What about local storage or a cookie?

This would require a user to log in once, but you could save the username for future logins on that device.
0 Kudos
TomSellsted
MVP Regular Contributor
I would definitely use local storage or a cookie, but how do I populate the IdentityManager with the username?
0 Kudos
JonathanUihlein
Esri Regular Contributor
Check out the Esri JSAPI documentation, there's alot of samples and tutorials for you to digest.

This sample uses local storage.... This is probably the one you're after:
https://developers.arcgis.com/en/javascript/jssamples/widget_identitymanager_client_side.html

Here's another sample about using the Identity Manager:
https://developers.arcgis.com/en/javascript/jssamples/widget_identitymanager.html

Hopefully this helps!
Let me know if you have any more questions and don't forget to mark this thread as answered when you are completely satisfied!
0 Kudos
TomSellsted
MVP Regular Contributor
I have used both of these examples.  This is not what I am looking for.  I am trying to populate the username field of the IdentityManager and have the user key their password to login.
0 Kudos
JonathanUihlein
Esri Regular Contributor
Why can't you use javascript to populate the username input element directly via DOM manipulation?

You know the id of the input element ahead of time so you can push a username into the value of that element from local storage. (Heck you can even use dijit.byId)

Can you explain why this wouldn't work?
0 Kudos
TomSellsted
MVP Regular Contributor
That is what I am trying to do.  I guess I don't know the id of the username input element presented by the IdentityManager.  I would use the on-create event of the IdentityManager to populate the username input field.  I am sure I am going to dope slap my forehead, but it has eluded me.  Thanks for your help!
0 Kudos
JonathanUihlein
Esri Regular Contributor
OK great! I had wrongfully assumed you had tried this method first as it is the easiest and most straight forward... my apologies.

Using the sample page as a demo:
http://developers.arcgis.com/en/javascript/samples/widget_identitymanager/

Using Firebug, I can see that the id of the input element is 'dijit_form_ValidationTextBox_0'

I can edit the value of the text field like so:
dijit.byId("dijit_form_ValidationTextBox_0").set("value", "jonuihlein");


Screenshot also attached.

Let me know if you have any more questions and don't forget to mark this thread as answered when you are completely satisfied!
0 Kudos
TomSellsted
MVP Regular Contributor
Jon,

Perfect!  You probably did hear me dope slap my forehead.  I use FireBug too.  I need to spend some time inspecting the HTML elements.  Thanks very much!

Best Regards,

Tom
0 Kudos
TomSellsted
MVP Regular Contributor
The dialog-create event fires before the dialog is created.  I have not been able to figure out how to populate the field as the dialog is presented.  Any ideas of what event I need to listen for?
0 Kudos