简体   繁体   English

不推荐使用com.tivoli.mts.PDPrincipal.implies(com.tivoli.mts.PDPermission)

[英]com.tivoli.mts.PDPrincipal.implies(com.tivoli.mts.PDPermission) deprecated

I am using the below code to do the authorizatin checks. 我正在使用以下代码进行授权检查。

PDPrincipal whoIsit = new PDPrincipal(userId,configURL);
PDPermission whatTheyWant = new PDPermission(objectSpaceName,"TbvA");
boolean haveAccess = whoIsit.implies(whatTheyWant);

However the implies method on com.tivoli.mts.PDPrincipal has been deprecated and has been replaced by implies method from the new PdPrincipal class from different package. 但是,不赞成com.tivoli.mts.PDPrincipal上的隐含方法,并已使用来自不同包的新PdPrincipal类中的隐含方法代替。

com.tivoli.pd.jazn.PDPrincipal 

the new method is as follows. 新方法如下。 public boolean implies(javax.security.auth.Subject subject) 公共布尔值隐含(javax.security.auth.Subject主题)

the new method takes a Subject. 新方法带有一个Subject。

Can you please let me know how can I change my code to use the new method? 您能否让我知道如何更改代码以使用新方法? How do i construct the Subject or can i get the Subject from somewhere? 我该如何构建主题或可以从某个地方获取主题?

Thanks, Rohit 谢谢罗希特

I was able to work out a solution for this hence sharing it here so that anyone else facing the same issue can use this code. 我能够为此解决一个问题,因此可以在这里共享它,以便其他面临相同问题的人都可以使用此代码。

I found that the new com.tivoli.pd.jazn.PDPermission class has a method implies which takes in a PdAuthorization context and a com.tivoli.pd.jazn.PDPrincipal object which does the same authorization checks that the previous class com.tivoli.mts.PDPrincipal use to do. 我发现新的com.tivoli.pd.jazn.PDPermission类具有一个隐含方法,该方法隐含PdAuthorization上下文,以及一个com.tivoli.pd.jazn.PDPrincipal对象,该对象执行与上一类com.tivoli相同的授权检查.mts.PDPrincipal使用来做。

Mentioned below is how the same authorization can be done. 下面提到的是如何完成相同的授权。 With this code you need not implement the JAAS code. 使用此代码,您无需实现JAAS代码。

First construct the PdAuthorizationContext as shown below. 首先构造PdAuthorizationContext,如下所示。 Make sure to define a static PdAuthorizationContext object so that it can be reused untill you close it. 确保定义一个静态PdAuthorizationContext对象,以便在您将其关闭之前可以重复使用它。 Constructing PDAuthorizationContext for every authorization check is resource intensive and not recommended. 为每个授权检查构造PDAuthorizationContext会占用大量资源,因此不建议这样做。 close the context at the end of your logic 在逻辑结尾处关闭上下文

URL configURL = new URL("file:" + String locationToTamConfigFile); PDAuthorizationContext pdAuthCtx = new PDAuthorizationContext(configURL);

Next Construct the new PDPrincipal and the PdPermission objects as shown below and call the implies method 下一步构造新的PDPrincipal和PdPermission对象,如下所示,并调用implies方法

com.tivoli.pd.jazn.PDPrincipal pdPrincipal = new com.tivoli.pd.jazn.PDPrincipal(pdAuthCtx,userId); com.tivoli.pd.jazn.PDPermission pdPermission = new com.tivoli.pd.jazn.PDPermission(objectSpaceName,"TbvA"); boolean newimpliesTry = pdPermission.implies(pdAuthCtx,pdPrincipal);

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在IBM Tivoli Identity Manager中添加角色 - How to add roles in IBM Tivoli Identity Manager IBM Security(Tivoli)Directory Integrator中的HTTP Server连接器 - HTTP Server Connector in IBM Security (Tivoli) Directory Integrator 通过SSL连接到IBM Tivoli Directory时,LDAP搜索断开连接 - LDAP Search disconnecting when connecting via SSL to IBM Tivoli Directory 不建议使用refreshInBackground(com.parse.RefreshCallback) - refreshInBackground(com.parse.RefreshCallback) is deprecated 如何将定制的Java程序作为Java插件添加到IBM Tivoli Provisioning Manager(TPM)? - How to add a custom made Java program to the IBM Tivoli Provisioning Manager ( TPM ) as a Java Plugin? 定制应用程序可以使用哪些API来通知Tivoli Service Request Manager(TSRM)错误? - What API's are available to a custom application to notify Tivoli Service Request Manager (TSRM) of errors? com.google.api.client.extensions.android.Z80791B3AE7002CB88C246876D9已弃用Android。 - com.google.api.client.extensions.android.http.androidhttp is deprecated 正在加载 class `com.mysql.jdbc.Driver'。 这已被弃用 - Loading class `com.mysql.jdbc.Driver'. This is deprecated 已弃用的com.apple.eawt.ApplicationListener的替代方法是什么 - What is the alternative for deprecated com.apple.eawt.ApplicationListener RedisConfig 中不推荐使用“enableDefaultTyping(com.fasterxml.jackson.databind.ObjectMapper.DefaultTyping)” - 'enableDefaultTyping(com.fasterxml.jackson.databind.ObjectMapper.DefaultTyping)' is deprecated in RedisConfig
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM