OK so I have the following issue with the CredentialCache. When I access an on premise service the AuthenticationManager CredentialCache automatically adds in my credential, which includes username and password. When I close and reopen my Android application it retains the credential information in the CredentialCache and includes in plain text username and password...
AuthenticationManager.CredentialCache.toJson(); .
I know I can encrypt and store these credentials in a file for use between sessions but I would really like for the CredentialCache to not hang onto these credentials between sessions from a security standpoint.
I would like to have the CredentialCache clear when the application is closed. I know I can add code on the apps OnDestroy event to handle this as follows...
AuthenticationManager.CredentialCache.clear();
This is all well and good, but if the user force closes the application I am not able to clear the cache when the application terminates as I have no event for this (short of creating some sort of convoluted service to listen for a killing of the application).
Just wondering if there is something I am missing here? This seems like a security flaw that is hard to overcome with this implementation.