适用于Android的JAAS

编程入门 行业动态 更新时间:2024-10-24 04:32:49
本文介绍了适用于Android的JAAS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一个必须移植到android的java代码.Java代码使用JAAS来提高安全性,但android缺少javax.security库.因此,我分别编译了javax.security库,并将其添加到android库中.现在,我看到loginContext.login()给出了空指针异常.这是代码问题还是在android上存在其他依赖项才能使其正常工作?重新打包jars(我所做过的)是否可以在android中缺少的所有库中使用?

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?

推荐答案

JAAS的主要目标是分离用户的关注点身份验证,以便可以对其进行独立管理.而前一种身份验证机制包含有关以下内容的信息:源于该代码并由其签名的代码,JAAS添加了一个标记关于谁运行代码.通过扩展验证向量JAAS扩展了需要的Java应用程序的安全体系结构身份验证和授权模块.

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.

但使用Android作为参考 jeffsix 或此 AhmedDrira分辨率

But With Android as Referenced jeffsix or this AhmedDrira resolution

JAAS并不真正适用于Android.JAAS提供以用户为中心的对基于Java的应用程序的安全性(身份是谁-通常是用户"(例如LDAP用户ID)-正在运行"应用程序,并且是否允许他们做自己想做的事情).在Android中,用户ID的使用方式不同,因为每个应用程序都以不同的方式运行用户ID,以便将应用程序彼此分开.作为启用JAAS的身份之间存在完全不同的身份概念Java应用程序和Android应用程序,JAAS模型没有与Android模型很好地协调一致,因此文档中出现了警告.

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.

有关详细信息,请参阅 jeffsixPost 答案

for details please refer jeffsixPost answer

更多推荐

适用于Android的JAAS

本文发布于:2023-11-23 14:11:15,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1621723.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:适用于   Android   JAAS

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!