Java 具有用户特定功能的JSF webapp

Java 具有用户特定功能的JSF webapp,java,security,websphere,keystore,cics,Java,Security,Websphere,Keystore,Cics,非常广泛,如果我不理解,我道歉,但以下是: 我有一个在CICS区域的Liberty服务器上运行的webapp。我希望该应用程序的某些功能是特定于用户的。例如,如果用户登录到web应用程序,我希望他们只能根据自己的身份在页面上执行任务。我已经考虑过如何设置角色,但不能很好地把握。到目前为止,我有一个设置,在我的CICS中,任何具有ID和密码并访问该区域的用户都可以使用我的webapp。我将发布.xml安全部分。如果需要更多的阐述,请问我 <security-role> <

非常广泛,如果我不理解,我道歉,但以下是: 我有一个在CICS区域的Liberty服务器上运行的webapp。我希望该应用程序的某些功能是特定于用户的。例如,如果用户登录到web应用程序,我希望他们只能根据自己的身份在页面上执行任务。我已经考虑过如何设置角色,但不能很好地把握。到目前为止,我有一个设置,在我的CICS中,任何具有ID和密码并访问该区域的用户都可以使用我的webapp。我将发布.xml安全部分。如果需要更多的阐述,请问我

 <security-role>
    <description>All CICS auhenticated users</description>
    <role-name>cicsAllAuthenticated</role-name>
</security-role>
<security-constraint>
    <display-name>xxx.xxxx.xxx.jdbc.web.SecurityConstraint</display-name>
    <web-resource-collection>
        <web-resource-name>xxxx.xxxx.xxxx.xxxx_xxxx.jdbc</web-resource-name>
        <url-pattern>/*</url-pattern>
    </web-resource-collection>
    <auth-constraint>
        <role-name>cicsAllAuthenticated</role-name>
    </auth-constraint>
    <user-data-constraint>
        <transport-guarantee>CONFIDENTIAL</transport-guarantee>
    </user-data-constraint>
</security-constraint>

所有CICS认证用户
西沙
xxx.xxxx.xxx.jdbc.web.SecurityConstraint
xxxx.xxxx.xxxx.xxxx\U xxxx.jdbc
/*
西沙
保密的

我通过服务器配置中的一些SAF注册表和密钥库设置来获取ID。我只想知道是否有一种方法可以在Java中使用它来授予特权。谢谢你的建议

您可以在Liberty中使用SAF角色映射。这将SAF EJBROLE映射到JavaEE角色,然后可以使用该角色保护应用程序

EJBROLEs到Java EE角色的映射是通过
server.xml
元素
safRoleMapper
控制的,例如,SAF角色映射器:

<safRoleMapper profilePattern="myprofile.%resource%.%role%" toUpperCase="true" />
有关详细信息,请参阅:。默认情况下,profilePattern是
%profilePefix%。%resource%。%role%

在CICS中,您应该安装
cicsts:security-1.0
功能,因为这还将CICS事务用户映射到Liberty用户

有关在CICS中的Liberty JVM服务器中配置安全性的更多信息,请参阅:

为了回到您最初的问题,如果您使用SAF EJBROLEs,您应该能够创建SAF角色映射器,然后在
web.xml
中使用与
%role%
匹配的部分来保护资源

您还可以使用

<% if (request.isUserInRole("role")) { %>
  <!-- Content to display for users in role 'role' -->
<% } %>


非常感谢!这真的很有帮助。为需要类似功能的人更新。如果您使用的是jsf而不是servlet,那么FacesContext.getCurrentInstance().getExternalContext().isUserInRole(角色)的工作方式与请求完全相同。
<% if (request.isUserInRole("role")) { %>
  <!-- Content to display for users in role 'role' -->
<% } %>