问题
I have a java code which has to be ported to android. Java code uses JAAS for security but javax.security libraries are missing for android. So, I compiled javax.security libraries separately and added to android libs. Now, I see that loginContext.login() gives null pointer exception. Is it a code issue or are there any other dependencies on android to make it work?. Will repackaging jars (which I did) work for all libraries which are missing in android?
回答1:
Since
The main goal of JAAS is to separate the concerns of user authentication so that they may be managed independently. While the former authentication mechanism contained information about where the code originated from and who signed that code, JAAS adds a marker about who runs the code. By extending the verification vectors JAAS extends the security architecture for Java applications that require authentication and authorization modules.
But With Android as Referenced jeffsix or this AhmedDrira resolution
JAAS doesn't really apply to Android. JAAS provides user-centric security to Java-based applications (who is the identity - usually a "user" such as an LDAP user id - that is "running" the application and are they allowed to do what they are trying to). In Android, user IDs are used differently in that each application runs with a different user ID in order to separate the applications from each other. As there are very different concepts of identity between a JAAS-enabled Java application and an Android application, the JAAS model doesn't reconcile well with the Android model, hence the warnings in the docs.
for details please refer jeffsixPost answer
来源:https://stackoverflow.com/questions/18863640/jaas-for-android