我有一个在CICS中运行的web应用程序,我尝试使用SAF角色映射以及CICS身份验证。为了进行测试,我将以下EJBROLE映射到CICS中的三个用户:应用程序名为CPSM.APP
TECH.CPSM.APP.VIEWER
TECH.CPSM.APP.UPDATER
TECH.CPSM.APP.ADMIN
但是,当这些用户登录到应用程序时,它会返回所有3个用户的403错误。不知道我做错了什么。我将在下面发布我的相关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错误。以及sys日志中的错误消息:
.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>发布于 2018-10-24 19:47:50
我已经解决了这个问题。我已经包括了下面的链接,解释什么需要改变谁有相同的问题。对于那些使用CA最高机密用于CICS安全的人。必须设置一个设施控制选项RES,以允许为给定用户将前缀资源(如EJBROLES )的规则加载到安全记录中。如果此选项设置为NORES,则给定EJBROLE的所有安全检查都将失败。
链接到解决方案:https://comm.support.ca.com/kb/permitted-resource-receiving-tss7250e-136/kb000005323
发布于 2018-10-03 16:00:01
您的safAuthorization元素被注释掉-这就是启用safAuthorization (即EJBRoles检查)的原因。然后还检查您的safRoleMapper值,以确保它们使用正确的前缀映射到您创建的EJBroles。
发布于 2018-10-03 22:09:51
当使用EJBROLEs时,application-bnd被绕过/忽略。映射保存在SAF中,而不是绑定元素中。还要注意,在启动CICS区域之前,您必须“刷新”您的SAF更改。我认为必须对EJBROLE (或最高机密中的类似内容)进行“读取”访问。
我还想知道,如果您的resource部分的profilePattern匹配正确,您说的应用程序被称为CPSM.APP。通常,Eclipse中的项目(如果是dev-env的话)会反映到installedApps.xml中的installedApps.xml元素中,并且有一个更限定的名称。CICS提供的一个示例称为com.ibm.cics.server.examples.wlp.hello.war,因此EJBROLE的定义将是TECH.com.ibm.cics.server.examples.wlp.hello.war.ADMIN。
这里有这里有更多的信息,以防我略读而错过任何有用的东西。
https://stackoverflow.com/questions/52630377
复制相似问题