SAF 角色映射器不允许访问。 (CICS 中的自由)

SAF role mapper not allowing access. (Liberty in CICS)

我在 CICS 的 Liberty 上有一个 Web 应用程序 运行,我正在尝试将 SAF 角色映射与 CICS 身份验证一起使用。我将以下 EJBROLE 映射到 CICS 中的三个用户以进行测试:应用程序名为 CPSM.APP

TECH.CPSM.APP.VIEWER

技术CPSM.APP.更新

技术CPSM.APP.管理

但是当这些用户登录到应用程序时,returns 3 个用户都出现了 403 错误。不确定我做错了什么。我将在下面 post 我的相关 server.xml 和相关 web.xml 组件。

Web.XML

<security-role>
    <description>Admin privileges</description>
    <role-name>ADMIN</role-name>
</security-role>

<security-role>
    <description>Viewer privileges</description>
    <role-name>VIEWER</role-name>
</security-role>

<security-role>
    <description>Updater privileges</description>
    <role-name>UPDATER</role-name>
</security-role>      

 <security-constraint>
    <display-name>com.ibm.cicsdev.jdbc.web.SecurityConstraint</display-name>
    <web-resource-collection>
        <web-resource-name>com.regions.cics.CPSM_Batch.jdbc</web-resource- 
  name>
        <url-pattern>/main.xhtml</url-pattern>
        <url-pattern>/viewgroups.xhtml</url-pattern>
        <url-pattern>/viewfileandtran.xhtml</url-pattern>
        <url-pattern>/viewgrouptable.xhtml</url-pattern>
    </web-resource-collection>

    <auth-constraint>
        <role-name>ADMIN</role-name>
        <role-name>VIEWER</role-name>
        <role-name>UPDATER</role-name>
    </auth-constraint>

    <user-data-constraint>
        <transport-guarantee>CONFIDENTIAL</transport-guarantee>
    </user-data-constraint>
</security-constraint>   

<security-constraint>
    <display-name>com.ibm.cicsdev.jdbc.web.SecurityConstraint</display-name>
    <web-resource-collection>
        <web-resource-name>com.regions.cics.CPSM_Batch.jdbc</web-resource- 
   name>
        <url-pattern>/editgroup.xhtml</url-pattern>
        <url-pattern>/addnewgroup.xhtml</url-pattern>
        <url-pattern>/entergroup.xhtml</url-pattern>
    </web-resource-collection>

    <auth-constraint>
        <role-name>ADMIN</role-name>
        <role-name>UPDATER</role-name>
    </auth-constraint>

    <user-data-constraint>
        <transport-guarantee>CONFIDENTIAL</transport-guarantee>
    </user-data-constraint>
</security-constraint>

<login-config>
<auth-method>BASIC</auth-method>
</login-config>    

Server.xml

    <featureManager>
     <feature>cicsts:core-1.0</feature>
    <feature>cicsts:defaultApp-1.0</feature>
    <feature>jsp-2.3</feature>

    <feature>javaMail-1.5</feature>

    <feature>jndi-1.0</feature>
    <feature>jsf-2.2</feature>
    <feature>jdbc-4.1</feature>
    <feature>jsp-2.3</feature>

    <feature>appSecurity-2.0</feature>

    <feature>cicsts:security-1.0</feature>
    <feature>ssl-1.0</feature>
</featureManager>

<!-- Use SAF registry -->
<safRegistry enableFailover="true" id="saf"/>
<safAuthorization id="saf"/>
<safCredentials profilePrefix="TECH" unauthenticatedUser="LIBGUEST"/>

<safRoleMapper profilePattern="%profilePrefix%.%resource%.%role%" 
toUpperCase="true"/>

当我尝试访问应用程序定义的任何 URL 时,我收到 403 错误。以及系统日志中的此错误消息:

.ibm.ws.webcontainer.security.WebAppSecurityCollaboratorImpl A CWWKS9104A: 
Authorization failed for user LIBTST1 while invoking CPSM on 
/viewgroups.xhtml. The user is not granted access to any of the required 
roles: [ADMIN, VIEWER, UPDATER].

更新:我正在从我的 installedapps.xml 添加对此应用程序的引用,以防它可能有助于解决问题。

 <application id="CPSM.APP" name="CPSM.APP" type="war" 
location="${server.output.dir}/installedApps/CPSM.APP.war" 
bundle="X11CPSM" token="1BEB96B000000199" bundlepart="CPSM_Batch" 
platform_id="" application_id="" appl_major_ver="-1" appl_minor_ver="-1" 
appl_micro_ver="-1">
    <application-bnd>
        <security-role name="cicsAllAuthenticated">
            <special-subject type="ALL_AUTHENTICATED_USERS"/>
        </security-role>
    </application-bnd>
</application>

您的 safAuthorization 元素已被注释掉 - 这就是启用 safAuthorization(即 EJBRoles 检查)的原因。然后还要检查您的 safRoleMapper 值,以确保它们使用正确的前缀映射到您创建的 EJBroles。

使用 EJBROLE 时,application-bnd 为 bypassed/ignored。映射保存在 SAF 中而不是绑定元素中。另请注意,您必须 'refresh' 在启动 CICS 区域之前更改 SAF。我认为必须 'read' 访问 EJBROLE(或 TOP SECRET 中的等效项)。

我还想知道您是否正确匹配了 profilePattern 的 resource 部分,您说该应用程序名为 CPSM.APP。通常,Eclipse 中的项目(如果那是您的开发环境)随后会反映到 installedApps.xml 中的 application 元素中,并具有更合格的名称。 CICS 提供的一个示例称为 com.ibm.cics.server.examples.wlp.hello.war,因此 EJBROLE 定义将是 TECH.com.ibm.cics.server.examples.wlp.hello.war.ADMIN.

more information here 以防我浏览时遗漏任何有用的信息。

我已经解决了这个问题。我在下面包含了一个 link 来解释需要为遇到相同问题的任何人更改的内容。对于那些使用 CA top secret 来保证 CICS 安全的人。必须设置一个工具控制选项 RES,以允许将前缀资源(例如 EJBROLES)的规则加载到给定用户的安全记录中。如果此选项设置为 NORES,则给定 EJBROLE 的所有安全检查都将失败。

Link求解:https://comm.support.ca.com/kb/permitted-resource-receiving-tss7250e-136/kb000005323