Identity Manager- logout

2470
5
Jump to solution
06-28-2013 06:18 AM
MikeDahm
Occasional Contributor
I am working with Flex Mobile and have secure layers within an application.  I am using the Identity Manager and I have it working for logging in and using the layers.  I have multiple maps in my application and I want the Identity Manager to release or log out of the user when the view that contains the map and secure layers is closed.  It seems that the Identity Manager is not tied to the the individual map and the token persists after closing the map.  When the map is opened back up, the Identity Manager instance is still using the credentials and remains logged in. 

Is there a way to release the credentials when closing a view in Flex Mobile?  All of my attempts such as IdentityManager.instance.enabled = false; seems to do nothing.

Also, if multiple layers within a map are secure, when a user clicks cancel on the sign in window, they are forced to hit cancel the number of times corresponding to the number of secure layers.  Is there a way to restrict this?
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
DasaPaddock
Esri Regular Contributor
Is there a way to release the credentials when closing a view in Flex Mobile?  All of my attempts such as IdentityManager.instance.enabled = false; seems to do nothing.


You can call destroy() on the Credential. See:
http://resources.arcgis.com/en/help/flex-api/apiref/com/esri/ags/components/supportClasses/Credentia...

Also, if multiple layers within a map are secure, when a user clicks cancel on the sign in window, they are forced to hit cancel the number of times corresponding to the number of secure layers.  Is there a way to restrict this?


You could create a custom version of the SignInWindow that saved the URL of the service that the user cancels to a shared application model. Then add a listener for the "showSignInWindow" event and in the handler, check if the URL of the service was canceled before, and if it was, call event.preventDefault() and setCredentialForCurrentSignIn(null).

See:
http://resources.arcgis.com/en/help/flex-api/apiref/com/esri/ags/components/IdentityManager.html#sig...
http://resources.arcgis.com/en/help/flex-api/apiref/com/esri/ags/components/IdentityManager.html#eve...
http://resources.arcgis.com/en/help/flex-api/apiref/com/esri/ags/components/IdentityManager.html#set...

View solution in original post

0 Kudos
5 Replies
DasaPaddock
Esri Regular Contributor
Is there a way to release the credentials when closing a view in Flex Mobile?  All of my attempts such as IdentityManager.instance.enabled = false; seems to do nothing.


You can call destroy() on the Credential. See:
http://resources.arcgis.com/en/help/flex-api/apiref/com/esri/ags/components/supportClasses/Credentia...

Also, if multiple layers within a map are secure, when a user clicks cancel on the sign in window, they are forced to hit cancel the number of times corresponding to the number of secure layers.  Is there a way to restrict this?


You could create a custom version of the SignInWindow that saved the URL of the service that the user cancels to a shared application model. Then add a listener for the "showSignInWindow" event and in the handler, check if the URL of the service was canceled before, and if it was, call event.preventDefault() and setCredentialForCurrentSignIn(null).

See:
http://resources.arcgis.com/en/help/flex-api/apiref/com/esri/ags/components/IdentityManager.html#sig...
http://resources.arcgis.com/en/help/flex-api/apiref/com/esri/ags/components/IdentityManager.html#eve...
http://resources.arcgis.com/en/help/flex-api/apiref/com/esri/ags/components/IdentityManager.html#set...
0 Kudos
MikeDahm
Occasional Contributor
How do you call the destroy() method to a credential?  From the view I am only working with the IdentityManager.instance
0 Kudos
ClintonCooper1
New Contributor III
mike,

I am running into an error that I cannot figure out using the identitymanager.  I am getting an error of:
ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
 at flash.display::DisplayObjectContainer/getChildIndex()


I am running this on a mobile project in the simulator. 

If I remove the security settings /users and roles from my server manager, the data shows up fine without being asked for a login.

however after I set the users and roles and add the permissions this error appears.  I was also getting this same error using the sample code provided by esri.  However in that case, I would get it to fires once (asking for credentials and then showing me the secure data) , and each subsequent case after I close the initial simulator, the error would appear over and over again.  

Would you be willing to share your code on how you got the identitymanager to work properly?
0 Kudos
ClintonCooper1
New Contributor III
0 Kudos
MikeDahm
Occasional Contributor
Whenever I use the "setCredentialForCurrentSignIn(null)" on the IdentityManager instance it gives an error 1009 cannot access a property or method of a null object reference.  How do I call the credential to destroy it?
0 Kudos